diff options
author | miod <> | 2015-07-15 16:32:29 +0000 |
---|---|---|
committer | miod <> | 2015-07-15 16:32:29 +0000 |
commit | 3cddaeeea39827924b6b7ffc99df9f511a635fa7 (patch) | |
tree | 6d909adac6ceaa4f69e260f5a9b701edcef3490a | |
parent | 370c300ca14472f9c425a65aae243e3b9a143858 (diff) | |
download | openbsd-3cddaeeea39827924b6b7ffc99df9f511a635fa7.tar.gz openbsd-3cddaeeea39827924b6b7ffc99df9f511a635fa7.tar.bz2 openbsd-3cddaeeea39827924b6b7ffc99df9f511a635fa7.zip |
Previous fix for Coverity CID 21785 did not cope correctly with seed_len != 0,
seed_in == NULL case. Since this situation is an error anyway, bail out
early.
with and ok beck@
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_gen.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/dsa/dsa_gen.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index 73ae485349..342764397c 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_gen.c,v 1.20 2015/02/15 22:29:02 doug Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.21 2015/07/15 16:32:29 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 | * |
@@ -138,6 +138,8 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
138 | seed_len = qsize; | 138 | seed_len = qsize; |
139 | if (seed_in != NULL) | 139 | if (seed_in != NULL) |
140 | memcpy(seed, seed_in, seed_len); | 140 | memcpy(seed, seed_in, seed_len); |
141 | else if (seed_len == 0) | ||
142 | goto err; | ||
141 | 143 | ||
142 | if ((mont=BN_MONT_CTX_new()) == NULL) | 144 | if ((mont=BN_MONT_CTX_new()) == NULL) |
143 | goto err; | 145 | goto err; |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_gen.c b/src/lib/libssl/src/crypto/dsa/dsa_gen.c index 73ae485349..342764397c 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_gen.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_gen.c,v 1.20 2015/02/15 22:29:02 doug Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.21 2015/07/15 16:32:29 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 | * |
@@ -138,6 +138,8 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
138 | seed_len = qsize; | 138 | seed_len = qsize; |
139 | if (seed_in != NULL) | 139 | if (seed_in != NULL) |
140 | memcpy(seed, seed_in, seed_len); | 140 | memcpy(seed, seed_in, seed_len); |
141 | else if (seed_len == 0) | ||
142 | goto err; | ||
141 | 143 | ||
142 | if ((mont=BN_MONT_CTX_new()) == NULL) | 144 | if ((mont=BN_MONT_CTX_new()) == NULL) |
143 | goto err; | 145 | goto err; |