summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2010-11-15 11:52:59 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2010-11-15 11:52:59 +0000
commitb544b81be549db791fa1e4454d9d3eae90d66c06 (patch)
tree5c800530001ecc733df6d6f3274345f3e4513e27 /sys
parent2922b556b0734015db426bbb45aa58ba4048f4e0 (diff)
there's either mbuf or an iovec, no other option is possible
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/aesni.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c
index d3ce982f480..1a135bd9579 100644
--- a/sys/arch/amd64/amd64/aesni.c
+++ b/sys/arch/amd64/amd64/aesni.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aesni.c,v 1.10 2010/11/10 17:05:39 mikeb Exp $ */
+/* $OpenBSD: aesni.c,v 1.11 2010/11/15 11:52:58 mikeb Exp $ */
/*-
* Copyright (c) 2003 Jason Wright
* Copyright (c) 2003, 2004 Theo de Raadt
@@ -35,7 +35,6 @@
#include <machine/fpu.h>
-
/* defines from crypto/xform.c */
#define AESCTR_NONCESIZE 4
#define AESCTR_IVSIZE 8
@@ -353,15 +352,12 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF) {
if (m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, ivlen, iv, M_NOWAIT)) {
- err = ENOMEM;
- goto out;
+ err = ENOMEM;
+ goto out;
}
- } else if (crp->crp_flags & CRYPTO_F_IOV)
+ } else
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, ivlen, iv);
- else
- bcopy(iv, crp->crp_buf + crd->crd_inject,
- ivlen);
}
} else {
if (crd->crd_flags & CRD_F_IV_EXPLICIT)
@@ -370,12 +366,9 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata((struct mbuf *)crp->crp_buf,
crd->crd_inject, ivlen, iv);
- else if (crp->crp_flags & CRYPTO_F_IOV)
+ else
cuio_copydata((struct uio *)crp->crp_buf,
crd->crd_inject, ivlen, iv);
- else
- bcopy(crp->crp_buf + crd->crd_inject,
- iv, ivlen);
}
}
@@ -383,11 +376,9 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata((struct mbuf *)crp->crp_buf, crd->crd_skip,
crd->crd_len, buf);
- else if (crp->crp_flags & CRYPTO_F_IOV)
+ else
cuio_copydata((struct uio *)crp->crp_buf, crd->crd_skip,
crd->crd_len, buf);
- else
- bcopy(crp->crp_buf + crd->crd_skip, buf, crd->crd_len);
/* Apply cipher */
fpu_kernel_enter();
@@ -413,11 +404,9 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
err = ENOMEM;
goto out;
}
- } else if (crp->crp_flags & CRYPTO_F_IOV)
+ } else
cuio_copyback((struct uio *)crp->crp_buf, crd->crd_skip,
crd->crd_len, buf);
- else
- bcopy(buf, crp->crp_buf + crd->crd_skip, crd->crd_len);
/*
* Copy out last block for use as next session IV for CBC,
@@ -429,13 +418,10 @@ aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
m_copydata((struct mbuf *)crp->crp_buf,
crd->crd_skip + crd->crd_len - ivlen, ivlen,
ses->ses_iv);
- else if (crp->crp_flags & CRYPTO_F_IOV)
+ else
cuio_copydata((struct uio *)crp->crp_buf,
crd->crd_skip + crd->crd_len - ivlen, ivlen,
ses->ses_iv);
- else
- bcopy(crp->crp_buf + crd->crd_skip +
- crd->crd_len - ivlen, ses->ses_iv, ivlen);
} else if (crd->crd_alg == CRYPTO_AES_CTR)
arc4random_buf(ses->ses_iv, ivlen);
}