diff options
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/crypto/bn/bn.h | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/bn/bn_lib.c | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/libssl/src/crypto/bn/bn.h b/lib/libssl/src/crypto/bn/bn.h index 7d11a049d0f..4ae6a8195da 100644 --- a/lib/libssl/src/crypto/bn/bn.h +++ b/lib/libssl/src/crypto/bn/bn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn.h,v 1.30 2016/03/04 16:06:38 doug Exp $ */ +/* $OpenBSD: bn.h,v 1.31 2016/03/04 16:23:30 deraadt Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -619,10 +619,10 @@ const BIGNUM *BN_get0_nist_prime_521(void); /* library internal functions */ -#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ - (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) BIGNUM *bn_expand2(BIGNUM *a, int words); +BIGNUM *bn_expand(BIGNUM *a, int bits); + #ifndef OPENSSL_NO_DEPRECATED BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ #endif diff --git a/lib/libssl/src/crypto/bn/bn_lib.c b/lib/libssl/src/crypto/bn/bn_lib.c index 7cc76c1e854..311ec2044d4 100644 --- a/lib/libssl/src/crypto/bn/bn_lib.c +++ b/lib/libssl/src/crypto/bn/bn_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_lib.c,v 1.34 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: bn_lib.c,v 1.35 2016/03/04 16:23:30 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -550,6 +550,18 @@ BN_get_word(const BIGNUM *a) return 0; } +BIGNUM * +bn_expand(BIGNUM *a, int bits) +{ + if (bits > (INT_MAX - BN_BITS2 + 1)) + return (NULL); + + if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) + return (a); + + return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); +} + int BN_set_word(BIGNUM *a, BN_ULONG w) { |