diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_gen.c')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_gen.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index dcfa957884..c1664d5f8a 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.18 2015/02/09 15:49:22 jsing Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.19 2015/02/15 08:48:24 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 | * |
| @@ -126,12 +126,10 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
| 126 | 126 | ||
| 127 | bits = (bits + 63) / 64 * 64; | 127 | bits = (bits + 63) / 64 * 64; |
| 128 | 128 | ||
| 129 | /* | 129 | if (seed_len < (size_t)qsize) { |
| 130 | * NB: seed_len == 0 is special case: copy generated seed to | ||
| 131 | * seed_in if it is not NULL. | ||
| 132 | */ | ||
| 133 | if (seed_len && seed_len < (size_t)qsize) | ||
| 134 | seed_in = NULL; /* seed buffer too small -- ignore */ | 130 | seed_in = NULL; /* seed buffer too small -- ignore */ |
| 131 | seed_len = 0; | ||
| 132 | } | ||
| 135 | /* | 133 | /* |
| 136 | * App. 2.2 of FIPS PUB 186 allows larger SEED, | 134 | * App. 2.2 of FIPS PUB 186 allows larger SEED, |
| 137 | * but our internal buffers are restricted to 160 bits | 135 | * but our internal buffers are restricted to 160 bits |
| @@ -176,7 +174,7 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
| 176 | if (!BN_GENCB_call(cb, 0, m++)) | 174 | if (!BN_GENCB_call(cb, 0, m++)) |
| 177 | goto err; | 175 | goto err; |
| 178 | 176 | ||
| 179 | if (!seed_len) { | 177 | if (seed_len == 0) { |
| 180 | arc4random_buf(seed, qsize); | 178 | arc4random_buf(seed, qsize); |
| 181 | seed_is_random = 1; | 179 | seed_is_random = 1; |
| 182 | } else { | 180 | } else { |
| @@ -344,7 +342,7 @@ err: | |||
| 344 | *counter_ret = counter; | 342 | *counter_ret = counter; |
| 345 | if (h_ret != NULL) | 343 | if (h_ret != NULL) |
| 346 | *h_ret = h; | 344 | *h_ret = h; |
| 347 | if (seed_out) | 345 | if (seed_out != NULL) |
| 348 | memcpy(seed_out, seed, qsize); | 346 | memcpy(seed_out, seed, qsize); |
| 349 | } | 347 | } |
| 350 | if (ctx) { | 348 | if (ctx) { |
