diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 09:55:40 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-10 09:55:40 +0000 |
commit | 7abc523262bd54b1a7473786e6310de35d22f8f1 (patch) | |
tree | 2be5685e1abb23ec519f033bf19b96b4954ea260 /lib/libcrypto/evp | |
parent | 935f03f76968db2c0995f02b41a6492af33d2bb7 (diff) |
EVP_BytesToKey(): return through the error path (which cleans things up)
if EVP_DigestInit_ex() fails.
Diffstat (limited to 'lib/libcrypto/evp')
-rw-r--r-- | lib/libcrypto/evp/evp_key.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/evp/evp_key.c b/lib/libcrypto/evp/evp_key.c index 4718ab61758..0678536ccb4 100644 --- a/lib/libcrypto/evp/evp_key.c +++ b/lib/libcrypto/evp/evp_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_key.c,v 1.21 2015/02/10 09:52:35 miod Exp $ */ +/* $OpenBSD: evp_key.c,v 1.22 2015/02/10 09:55:39 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -149,7 +149,7 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, EVP_MD_CTX_init(&c); for (;;) { if (!EVP_DigestInit_ex(&c, md, NULL)) - return 0; + goto err; if (addmd++) if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) goto err; @@ -201,6 +201,6 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, err: EVP_MD_CTX_cleanup(&c); - OPENSSL_cleanse(&(md_buf[0]), EVP_MAX_MD_SIZE); + OPENSSL_cleanse(md_buf, sizeof md_buf); return rv; } |