diff options
| author | tb <> | 2025-11-06 09:04:14 +0000 |
|---|---|---|
| committer | tb <> | 2025-11-06 09:04:14 +0000 |
| commit | 6ed58e3a351fdb740941af76336021fa436f2fda (patch) | |
| tree | 5e90db9eb77871054518e24571ae9557ec5b60b0 /src | |
| parent | cfaf7540f6b19032df0f388ad6a4d0e0714671c6 (diff) | |
| download | openbsd-6ed58e3a351fdb740941af76336021fa436f2fda.tar.gz openbsd-6ed58e3a351fdb740941af76336021fa436f2fda.tar.bz2 openbsd-6ed58e3a351fdb740941af76336021fa436f2fda.zip | |
Use BN_ULONG in probable_prime_dh()
This was the last user of BN_LONG in code. It had no reason to do so.
BN_mod_word() returns a BN_ULONG and since the largest prime in the
small primes table primes[] is well below 20000, the only return value
that could cause 'mod' to be negative was the error sentinel (BN_ULONG)-1.
ok jsing kenjiro
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_prime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c index d85595e0dd..c07fcedcda 100644 --- a/src/lib/libcrypto/bn/bn_prime.c +++ b/src/lib/libcrypto/bn/bn_prime.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_prime.c,v 1.35 2025/05/10 05:54:38 tb Exp $ */ | 1 | /* $OpenBSD: bn_prime.c,v 1.36 2025/11/06 09:04:14 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 | * |
| @@ -338,7 +338,7 @@ probable_prime_dh(BIGNUM *rnd, int bits, const BIGNUM *add, const BIGNUM *rem, | |||
| 338 | loop: | 338 | loop: |
| 339 | for (i = 1; i < NUMPRIMES; i++) { | 339 | for (i = 1; i < NUMPRIMES; i++) { |
| 340 | /* check that rnd is a prime */ | 340 | /* check that rnd is a prime */ |
| 341 | BN_LONG mod = BN_mod_word(rnd, primes[i]); | 341 | BN_ULONG mod = BN_mod_word(rnd, primes[i]); |
| 342 | if (mod == (BN_ULONG)-1) | 342 | if (mod == (BN_ULONG)-1) |
| 343 | goto err; | 343 | goto err; |
| 344 | if (mod <= 1) { | 344 | if (mod <= 1) { |
