summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-06-28 08:54:13 +0000
committerYann Ylavic <ylavic@apache.org>2018-06-28 08:54:13 +0000
commitcbe1e9f6a35e08d5873448ed972c82f27cc68a85 (patch)
tree4a841cf15e9e11c6868eddc59b6211125bdb4cf1 /crypto
parent44c2b6ddf10c7e9236503ef30165972b58018177 (diff)
downloadapr-cbe1e9f6a35e08d5873448ed972c82f27cc68a85.tar.gz
apr_crypto: follow up to r1833359: save a memset().
We can avoid zeroing the key before overwriting it since we have plenty of zeros available in cprng->buf already. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1834583 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'crypto')
-rw-r--r--crypto/apr_crypto_prng.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/apr_crypto_prng.c b/crypto/apr_crypto_prng.c
index 178f58164..81363fd2e 100644
--- a/crypto/apr_crypto_prng.c
+++ b/crypto/apr_crypto_prng.c
@@ -158,8 +158,7 @@ apr_status_t cprng_stream_ctx_bytes(cprng_stream_ctx_t **pctx,
cprng_stream_setkey(ctx, key, z);
EVP_CIPHER_CTX_set_padding(ctx, 0);
if (rekey) {
- memset(key, 0, CPRNG_KEY_SIZE);
- EVP_EncryptUpdate(ctx, key, &len, key, CPRNG_KEY_SIZE);
+ EVP_EncryptUpdate(ctx, key, &len, z, CPRNG_KEY_SIZE);
}
if (n) {
EVP_EncryptUpdate(ctx, to, &len, z, n);