diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/bn/bn_mod_exp.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index 236851bc75..f7be5110ea 100644 --- a/src/regress/lib/libcrypto/bn/bn_mod_exp.c +++ b/src/regress/lib/libcrypto/bn/bn_mod_exp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_mod_exp.c,v 1.5 2022/12/02 18:31:40 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_exp.c,v 1.6 2022/12/03 08:05:52 tb 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 | * |
@@ -73,7 +73,7 @@ main(int argc, char *argv[]) | |||
73 | BIGNUM *r_mont, *r_mont_const, *r_recp, *r_simple; | 73 | BIGNUM *r_mont, *r_mont_const, *r_recp, *r_simple; |
74 | BIGNUM *r_mont_ct, *r_mont_nonct, *a, *b, *m; | 74 | BIGNUM *r_mont_ct, *r_mont_nonct, *a, *b, *m; |
75 | BN_CTX *ctx; | 75 | BN_CTX *ctx; |
76 | unsigned char c; | 76 | int c; |
77 | int i, ret; | 77 | int i, ret; |
78 | 78 | ||
79 | ERR_load_BN_strings(); | 79 | ERR_load_BN_strings(); |
@@ -103,18 +103,15 @@ main(int argc, char *argv[]) | |||
103 | goto err; | 103 | goto err; |
104 | 104 | ||
105 | for (i = 0; i < 200; i++) { | 105 | for (i = 0; i < 200; i++) { |
106 | arc4random_buf(&c, 1); | 106 | c = (arc4random() % BN_BITS) - BN_BITS2; |
107 | c = (c % BN_BITS) - BN_BITS2; | ||
108 | if (!BN_rand(a, NUM_BITS + c, 0, 0)) | 107 | if (!BN_rand(a, NUM_BITS + c, 0, 0)) |
109 | goto err; | 108 | goto err; |
110 | 109 | ||
111 | arc4random_buf(&c, 1); | 110 | c = (arc4random() % BN_BITS) - BN_BITS2; |
112 | c = (c % BN_BITS) - BN_BITS2; | ||
113 | if (!BN_rand(b, NUM_BITS + c, 0, 0)) | 111 | if (!BN_rand(b, NUM_BITS + c, 0, 0)) |
114 | goto err; | 112 | goto err; |
115 | 113 | ||
116 | arc4random_buf(&c, 1); | 114 | c = (arc4random() % BN_BITS) - BN_BITS2; |
117 | c = (c % BN_BITS) - BN_BITS2; | ||
118 | if (!BN_rand(m, NUM_BITS + c, 0, 1)) | 115 | if (!BN_rand(m, NUM_BITS + c, 0, 1)) |
119 | goto err; | 116 | goto err; |
120 | 117 | ||