From 6ed58e3a351fdb740941af76336021fa436f2fda Mon Sep 17 00:00:00 2001 From: tb <> Date: Thu, 6 Nov 2025 09:04:14 +0000 Subject: 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 --- src/lib/libcrypto/bn/bn_prime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: bn_prime.c,v 1.35 2025/05/10 05:54:38 tb Exp $ */ +/* $OpenBSD: bn_prime.c,v 1.36 2025/11/06 09:04:14 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -338,7 +338,7 @@ probable_prime_dh(BIGNUM *rnd, int bits, const BIGNUM *add, const BIGNUM *rem, loop: for (i = 1; i < NUMPRIMES; i++) { /* check that rnd is a prime */ - BN_LONG mod = BN_mod_word(rnd, primes[i]); + BN_ULONG mod = BN_mod_word(rnd, primes[i]); if (mod == (BN_ULONG)-1) goto err; if (mod <= 1) { -- cgit v1.2.3-55-g6feb