summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_lib.c
diff options
context:
space:
mode:
authorjsing <>2024-04-16 13:04:05 +0000
committerjsing <>2024-04-16 13:04:05 +0000
commite03bf717d1c2f2ba657a6fdd6993fa1299c5cef6 (patch)
tree8dbd9f8dfed2cf56495620fb9bf397eb64231f61 /src/lib/libcrypto/bn/bn_lib.c
parentc86897ee35675bd6822b90b4b484a3a40d633c90 (diff)
downloadopenbsd-e03bf717d1c2f2ba657a6fdd6993fa1299c5cef6.tar.gz
openbsd-e03bf717d1c2f2ba657a6fdd6993fa1299c5cef6.tar.bz2
openbsd-e03bf717d1c2f2ba657a6fdd6993fa1299c5cef6.zip
Rename bn_expand() to bn_expand_bits().
Also change the bits type from int to size_t, since that's what the callers are passing and we can avoid unnecessary input validation. ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index b59e65a1e1..6988a70f3b 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.91 2024/04/15 14:35:25 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.92 2024/04/16 13:04:05 jsing 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 *
@@ -219,13 +219,10 @@ bn_expand_internal(BIGNUM *bn, int words)
219} 219}
220 220
221int 221int
222bn_expand(BIGNUM *bn, int bits) 222bn_expand_bits(BIGNUM *bn, size_t bits)
223{ 223{
224 int words; 224 int words;
225 225
226 if (bits < 0)
227 return 0;
228
229 if (bits > (INT_MAX - BN_BITS2 + 1)) 226 if (bits > (INT_MAX - BN_BITS2 + 1))
230 return 0; 227 return 0;
231 228