summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p5_crpt2.c
diff options
context:
space:
mode:
authorGergely Nagy <ngg@ngg.hu>2016-10-13 18:50:31 +0200
committerRich Salz <rsalz@openssl.org>2017-04-04 10:44:17 -0400
commitb98530d6e09f4cb34c791b8840e936c1fc1467cf (patch)
tree629ef403353fddfc5eb8c736c3b5594d41468d09 /crypto/evp/p5_crpt2.c
parent79b3452faf04f2572f57eb37b618cc603d9983da (diff)
PBKDF2 computation speedup (15-40%)
This commit contains some optimizations in PKCS5_PBKDF2_HMAC() and HMAC_CTX_copy() functions which together makes PBKDF2 computations faster by 15-40% according to my measurements made on x64 Linux with both asm optimized and no-asm versions of SHA1, SHA256 and SHA512. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1708)
Diffstat (limited to 'crypto/evp/p5_crpt2.c')
-rw-r--r--crypto/evp/p5_crpt2.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c
index c7b08e164f..b9ea1a7400 100644
--- a/crypto/evp/p5_crpt2.c
+++ b/crypto/evp/p5_crpt2.c
@@ -88,7 +88,6 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
- HMAC_CTX_reset(hctx);
memcpy(p, digtmp, cplen);
for (j = 1; j < iter; j++) {
if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
@@ -102,7 +101,6 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
- HMAC_CTX_reset(hctx);
for (k = 0; k < cplen; k++)
p[k] ^= digtmp[k];
}