diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-25 11:02:27 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-25 11:02:27 +0000 |
commit | 3dc9365b720155da3b230fef42a5bc050485751a (patch) | |
tree | fc9198bab6b2a4e57dc7ed0800c1741115f72643 /lib/libcrypto/bn | |
parent | 274456973cb499ee33bc2ee6f685aa99c8191d58 (diff) |
Add checks to ensure the uint16_t array isn't overflowed when this
script is run. This is more of an issue with uint16_t now than it
was with prime_t aka BN_ULONG before r1.6.
Diffstat (limited to 'lib/libcrypto/bn')
-rw-r--r-- | lib/libcrypto/bn/bn_prime.pl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libcrypto/bn/bn_prime.pl b/lib/libcrypto/bn/bn_prime.pl index bc85909bfb1..4692e7f419d 100644 --- a/lib/libcrypto/bn/bn_prime.pl +++ b/lib/libcrypto/bn/bn_prime.pl @@ -4,6 +4,9 @@ $num=2048; $num=$ARGV[0] if ($#ARGV >= 0); +# The 6543rd prime is 2^16 + 1. +die "$num must be smaller than 6543" if $num >= 6543; + push(@primes,2); $p=1; loop: while ($#primes < $num-1) @@ -46,6 +49,7 @@ for ($i=0; $i <= $#primes; $i++) } else { printf(" "); } + die "\$primes[$i] is too large: $primes[$i]" if $primes[$i] > 65535; printf("%5d,",$primes[$i]); } print "\n};\n"; |