diff options
author | Andy Polyakov <appro@openssl.org> | 2011-08-07 17:47:56 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2011-08-07 17:47:56 +0000 |
commit | 267b481c47a937d926aca4a9c866af7397fc040d (patch) | |
tree | 7220eb927434e848aed35b685ea80f6c665795a7 /crypto/modes | |
parent | 8a8cc84f745c84dcb79c8eee3aa0c10e53c0bc6a (diff) |
aes/asm/aesni-*.pl: fix CCM and further optimize it.
modes/ccm128.c: minor branch optimization.
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/ccm128.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/modes/ccm128.c b/crypto/modes/ccm128.c index 001fdff658..c9b35e5b35 100644 --- a/crypto/modes/ccm128.c +++ b/crypto/modes/ccm128.c @@ -356,10 +356,10 @@ int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, inp += n; out += n; len -= n; + if (len) ctr64_add(ctx->nonce.c,n/16); } if (len) { - if (n) ctr64_add(ctx->nonce.c,n/16); for (i=0; i<len; ++i) ctx->cmac.c[i] ^= inp[i]; (*block)(ctx->cmac.c,ctx->cmac.c,key); (*block)(ctx->nonce.c,scratch.c,key); @@ -409,10 +409,10 @@ int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, inp += n; out += n; len -= n; + if (len) ctr64_add(ctx->nonce.c,n/16); } if (len) { - if (n) ctr64_add(ctx->nonce.c,n/16); (*block)(ctx->nonce.c,scratch.c,key); for (i=0; i<len; ++i) ctx->cmac.c[i] ^= (out[i] = scratch.c[i]^inp[i]); |