summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp/p5_crpt.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-05-12 02:18:41 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-05-12 02:18:41 +0000
commitb47e6f30e82ff649c06cdfcf587a4ad9d127a4f5 (patch)
treef98b2f00f52dd4fd004708bd26d63f3c24a78355 /lib/libcrypto/evp/p5_crpt.c
parentf97744c656f2a5c7d4e42bcaba08dbe146a49425 (diff)
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'lib/libcrypto/evp/p5_crpt.c')
-rw-r--r--lib/libcrypto/evp/p5_crpt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libcrypto/evp/p5_crpt.c b/lib/libcrypto/evp/p5_crpt.c
index 27a8286489f..a1874e83b25 100644
--- a/lib/libcrypto/evp/p5_crpt.c
+++ b/lib/libcrypto/evp/p5_crpt.c
@@ -140,12 +140,14 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
EVP_DigestFinal_ex (&ctx, md_tmp, NULL);
}
EVP_MD_CTX_cleanup(&ctx);
+ OPENSSL_assert(EVP_CIPHER_key_length(cipher) <= sizeof md_tmp);
memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
+ OPENSSL_assert(EVP_CIPHER_iv_length(cipher) <= 16);
memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),
EVP_CIPHER_iv_length(cipher));
EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de);
- memset(md_tmp, 0, EVP_MAX_MD_SIZE);
- memset(key, 0, EVP_MAX_KEY_LENGTH);
- memset(iv, 0, EVP_MAX_IV_LENGTH);
+ OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE);
+ OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH);
+ OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH);
return 1;
}