summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-11-19 22:42:34 +0000
committersam <sam@FreeBSD.org>2003-11-19 22:42:34 +0000
commit6b540b6f1a6df366c428369b9089cbaf6361e561 (patch)
tree36fb8126ee4d5b62f39fb2a2b1ddca19ad63c6e0 /sys/opencrypto
parent13274cd79882739b3b3750c1ac997f7c6a7553af (diff)
downloadFreeBSD-src-6b540b6f1a6df366c428369b9089cbaf6361e561.zip
FreeBSD-src-6b540b6f1a6df366c428369b9089cbaf6361e561.tar.gz
eliminate an unnecessary 8Kbyte bzero that was being done for each
submitted operation Submitted by: Thor Lancelot Simon Reviewed by: jhb Approved by: re (jhb)
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/cryptodev.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 51617f5..1d2398f 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -72,7 +72,7 @@ struct csession {
int mackeylen;
u_char tmp_mac[CRYPTO_MAX_MAC_LEN];
- struct iovec iovec[UIO_MAXIOV];
+ struct iovec iovec;
struct uio uio;
int error;
};
@@ -317,7 +317,7 @@ cryptodev_op(
{
struct cryptop *crp = NULL;
struct cryptodesc *crde = NULL, *crda = NULL;
- int i, error;
+ int error;
if (cop->len > 256*1024-4)
return (E2BIG);
@@ -325,18 +325,15 @@ cryptodev_op(
if (cse->txform && (cop->len % cse->txform->blocksize) != 0)
return (EINVAL);
- bzero(&cse->uio, sizeof(cse->uio));
+ cse->uio.uio_iov = &cse->iovec;
cse->uio.uio_iovcnt = 1;
- cse->uio.uio_resid = 0;
+ cse->uio.uio_offset = 0;
+ cse->uio.uio_resid = cop->len;
cse->uio.uio_segflg = UIO_SYSSPACE;
cse->uio.uio_rw = UIO_WRITE;
cse->uio.uio_td = td;
- cse->uio.uio_iov = cse->iovec;
- bzero(&cse->iovec, sizeof(cse->iovec));
cse->uio.uio_iov[0].iov_len = cop->len;
cse->uio.uio_iov[0].iov_base = malloc(cop->len, M_XDATA, M_WAITOK);
- for (i = 0; i < cse->uio.uio_iovcnt; i++)
- cse->uio.uio_resid += cse->uio.uio_iov[0].iov_len;
crp = crypto_getreq((cse->txform != NULL) + (cse->thash != NULL));
if (crp == NULL) {
OpenPOWER on IntegriCloud