diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_rand.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_rand.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 783f6c22f8..812fa6a575 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_rand.c,v 1.18 2015/09/10 15:56:25 jsing Exp $ */ | 1 | /* $OpenBSD: bn_rand.c,v 1.19 2017/01/29 17:49:22 beck 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 | * |
@@ -125,7 +125,7 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
125 | int ret = 0, bit, bytes, mask; | 125 | int ret = 0, bit, bytes, mask; |
126 | 126 | ||
127 | if (rnd == NULL) { | 127 | if (rnd == NULL) { |
128 | BNerr(BN_F_BNRAND, ERR_R_PASSED_NULL_PARAMETER); | 128 | BNerror(ERR_R_PASSED_NULL_PARAMETER); |
129 | return (0); | 129 | return (0); |
130 | } | 130 | } |
131 | 131 | ||
@@ -140,7 +140,7 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
140 | 140 | ||
141 | buf = malloc(bytes); | 141 | buf = malloc(bytes); |
142 | if (buf == NULL) { | 142 | if (buf == NULL) { |
143 | BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); | 143 | BNerror(ERR_R_MALLOC_FAILURE); |
144 | goto err; | 144 | goto err; |
145 | } | 145 | } |
146 | 146 | ||
@@ -224,7 +224,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
224 | int count = 100; | 224 | int count = 100; |
225 | 225 | ||
226 | if (range->neg || BN_is_zero(range)) { | 226 | if (range->neg || BN_is_zero(range)) { |
227 | BNerr(BN_F_BN_RAND_RANGE, BN_R_INVALID_RANGE); | 227 | BNerror(BN_R_INVALID_RANGE); |
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | 230 | ||
@@ -254,8 +254,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | if (!--count) { | 256 | if (!--count) { |
257 | BNerr(BN_F_BN_RAND_RANGE, | 257 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
258 | BN_R_TOO_MANY_ITERATIONS); | ||
259 | return 0; | 258 | return 0; |
260 | } | 259 | } |
261 | 260 | ||
@@ -267,8 +266,7 @@ bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) | |||
267 | return 0; | 266 | return 0; |
268 | 267 | ||
269 | if (!--count) { | 268 | if (!--count) { |
270 | BNerr(BN_F_BN_RAND_RANGE, | 269 | BNerror(BN_R_TOO_MANY_ITERATIONS); |
271 | BN_R_TOO_MANY_ITERATIONS); | ||
272 | return 0; | 270 | return 0; |
273 | } | 271 | } |
274 | } while (BN_cmp(r, range) >= 0); | 272 | } while (BN_cmp(r, range) >= 0); |