summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 7c85e7ad08..15bbdf1273 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.58 2022/11/23 03:00:12 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.59 2022/11/23 03:04:52 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 *
@@ -377,6 +377,9 @@ bn_expand2(BIGNUM *b, int words)
377BIGNUM * 377BIGNUM *
378bn_expand(BIGNUM *a, int bits) 378bn_expand(BIGNUM *a, int bits)
379{ 379{
380 if (bits < 0)
381 return (NULL);
382
380 if (bits > (INT_MAX - BN_BITS2 + 1)) 383 if (bits > (INT_MAX - BN_BITS2 + 1))
381 return (NULL); 384 return (NULL);
382 385
@@ -389,6 +392,9 @@ bn_expand(BIGNUM *a, int bits)
389BIGNUM * 392BIGNUM *
390bn_wexpand(BIGNUM *a, int words) 393bn_wexpand(BIGNUM *a, int words)
391{ 394{
395 if (words < 0)
396 return NULL;
397
392 if (words <= a->dmax) 398 if (words <= a->dmax)
393 return a; 399 return a;
394 400