diff options
author | miod <> | 2015-02-10 09:55:39 +0000 |
---|---|---|
committer | miod <> | 2015-02-10 09:55:39 +0000 |
commit | a23c986bc79db61aa706aa1951c3b2a0c0acdaee (patch) | |
tree | 891c83a32e8d78193bb4e5202f38e156789091d2 /src | |
parent | d2f68f95d95ff1ca4370b66eb67e8add10d9d079 (diff) | |
download | openbsd-a23c986bc79db61aa706aa1951c3b2a0c0acdaee.tar.gz openbsd-a23c986bc79db61aa706aa1951c3b2a0c0acdaee.tar.bz2 openbsd-a23c986bc79db61aa706aa1951c3b2a0c0acdaee.zip |
EVP_BytesToKey(): return through the error path (which cleans things up)
if EVP_DigestInit_ex() fails.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/evp_key.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/evp_key.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c index 4718ab6175..0678536ccb 100644 --- a/src/lib/libcrypto/evp/evp_key.c +++ b/src/lib/libcrypto/evp/evp_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_key.c,v 1.21 2015/02/10 09:52:35 miod Exp $ */ | 1 | /* $OpenBSD: evp_key.c,v 1.22 2015/02/10 09:55:39 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -149,7 +149,7 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | |||
149 | EVP_MD_CTX_init(&c); | 149 | EVP_MD_CTX_init(&c); |
150 | for (;;) { | 150 | for (;;) { |
151 | if (!EVP_DigestInit_ex(&c, md, NULL)) | 151 | if (!EVP_DigestInit_ex(&c, md, NULL)) |
152 | return 0; | 152 | goto err; |
153 | if (addmd++) | 153 | if (addmd++) |
154 | if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) | 154 | if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) |
155 | goto err; | 155 | goto err; |
@@ -201,6 +201,6 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | |||
201 | 201 | ||
202 | err: | 202 | err: |
203 | EVP_MD_CTX_cleanup(&c); | 203 | EVP_MD_CTX_cleanup(&c); |
204 | OPENSSL_cleanse(&(md_buf[0]), EVP_MAX_MD_SIZE); | 204 | OPENSSL_cleanse(md_buf, sizeof md_buf); |
205 | return rv; | 205 | return rv; |
206 | } | 206 | } |
diff --git a/src/lib/libssl/src/crypto/evp/evp_key.c b/src/lib/libssl/src/crypto/evp/evp_key.c index 4718ab6175..0678536ccb 100644 --- a/src/lib/libssl/src/crypto/evp/evp_key.c +++ b/src/lib/libssl/src/crypto/evp/evp_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_key.c,v 1.21 2015/02/10 09:52:35 miod Exp $ */ | 1 | /* $OpenBSD: evp_key.c,v 1.22 2015/02/10 09:55:39 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -149,7 +149,7 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | |||
149 | EVP_MD_CTX_init(&c); | 149 | EVP_MD_CTX_init(&c); |
150 | for (;;) { | 150 | for (;;) { |
151 | if (!EVP_DigestInit_ex(&c, md, NULL)) | 151 | if (!EVP_DigestInit_ex(&c, md, NULL)) |
152 | return 0; | 152 | goto err; |
153 | if (addmd++) | 153 | if (addmd++) |
154 | if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) | 154 | if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) |
155 | goto err; | 155 | goto err; |
@@ -201,6 +201,6 @@ EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | |||
201 | 201 | ||
202 | err: | 202 | err: |
203 | EVP_MD_CTX_cleanup(&c); | 203 | EVP_MD_CTX_cleanup(&c); |
204 | OPENSSL_cleanse(&(md_buf[0]), EVP_MAX_MD_SIZE); | 204 | OPENSSL_cleanse(md_buf, sizeof md_buf); |
205 | return rv; | 205 | return rv; |
206 | } | 206 | } |