summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-12-11 14:49:32 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-12-11 14:49:32 +0000
commit264b29a013191071e403b6ce8ef088d356037447 (patch)
tree422555c50e516e79cd3444489f502e7e03de67fb
parent4f12f0ba40f8137dec741d2fb8b53ee3c60929c4 (diff)
Bring back a small copy optimization in the aes-gcm handling:
with ESN AAD is 12 bytes long so it's faster to zero out 4 bytes than to copy 12. Without ESN it's either copying or zeroing out 8 bytes but we'll rely on the cache locality here.
-rw-r--r--sys/crypto/cryptosoft.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index df8a5b2997e..e091818dc1d 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.67 2012/12/07 20:55:51 mikeb Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.68 2012/12/11 14:49:31 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -603,7 +603,8 @@ swcr_authenc(struct cryptop *crp)
for (i = iskip; i < crda->crd_len; i += blksz) {
len = MIN(crda->crd_len - i, blksz - oskip);
COPYDATA(outtype, buf, crda->crd_skip + i, len, blk + oskip);
- axf->Update(&ctx, blk, len + oskip);
+ bzero(blk + len + oskip, blksz - len - oskip);
+ axf->Update(&ctx, blk, blksz);
oskip = 0; /* reset initial output offset */
}