PERFORCE change 1202876 for review
John-Mark Gurney
jmg at FreeBSD.org
Sun Nov 16 05:40:47 UTC 2014
http://p4web.freebsd.org/@@1202876?ac=10
Change 1202876 by jmg at jmg_carbon2 on 2014/11/16 05:40:36
for some reason, when I access mbuf directly, things don't
work... more investigation is needed...
Simplify how IV's are calculated.. There needs to be more
work in this area...
Sponsored by: FreeBSD Foundation
Sponsored by: Netgate
Affected files ...
.. //depot/projects/opencrypto/sys/crypto/aesni/aesni.c#15 edit
Differences ...
==== //depot/projects/opencrypto/sys/crypto/aesni/aesni.c#15 (text+ko) ====
@@ -382,6 +382,7 @@
uint8_t *addr;
if (crp->crp_flags & CRYPTO_F_IMBUF) {
+ goto alloc;
m = (struct mbuf *)crp->crp_buf;
if (m->m_next != NULL)
goto alloc;
@@ -505,7 +506,7 @@
switch (enccrd->crd_alg) {
case CRYPTO_AES_CBC:
case CRYPTO_AES_ICM:
- ivlen = 16;
+ ivlen = AES_BLOCK_LEN;
break;
case CRYPTO_AES_XTS:
ivlen = 8;
@@ -517,21 +518,13 @@
/* Setup ses->iv */
bzero(ses->iv, sizeof ses->iv);
- if (encflag) {
- if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0)
- bcopy(enccrd->crd_iv, ses->iv, ivlen);
- else
- arc4rand(ses->iv, ivlen, 0);
- if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0)
- crypto_copyback(crp->crp_flags, crp->crp_buf,
- enccrd->crd_inject, ivlen, ses->iv);
- } else {
- if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0)
- bcopy(enccrd->crd_iv, ses->iv, ivlen);
- else
- crypto_copydata(crp->crp_flags, crp->crp_buf,
- enccrd->crd_inject, ivlen, ses->iv);
- }
+ if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0)
+ bcopy(enccrd->crd_iv, ses->iv, ivlen);
+ else if (encflag && ((enccrd->crd_flags & CRD_F_IV_PRESENT) != 0))
+ arc4rand(ses->iv, ivlen, 0);
+ else
+ crypto_copydata(crp->crp_flags, crp->crp_buf,
+ enccrd->crd_inject, ivlen, ses->iv);
if (authcrd != NULL && !encflag)
crypto_copydata(crp->crp_flags, crp->crp_buf,
More information about the p4-projects
mailing list