diff options
| author | miod <> | 2015-02-10 09:55:39 +0000 |
|---|---|---|
| committer | miod <> | 2015-02-10 09:55:39 +0000 |
| commit | f801e3b0ae96bcc98cbe6390456e30ff4efecd20 (patch) | |
| tree | 891c83a32e8d78193bb4e5202f38e156789091d2 /src/lib/libcrypto/evp/evp_key.c | |
| parent | edf340ccfb8b64c1c344e29963a2093fe1298a86 (diff) | |
| download | openbsd-f801e3b0ae96bcc98cbe6390456e30ff4efecd20.tar.gz openbsd-f801e3b0ae96bcc98cbe6390456e30ff4efecd20.tar.bz2 openbsd-f801e3b0ae96bcc98cbe6390456e30ff4efecd20.zip | |
EVP_BytesToKey(): return through the error path (which cleans things up)
if EVP_DigestInit_ex() fails.
Diffstat (limited to 'src/lib/libcrypto/evp/evp_key.c')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_key.c | 6 |
1 files changed, 3 insertions, 3 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 | } |
