From af37e0cd640a36968c4e3b6c009e96ba25b3e51c Mon Sep 17 00:00:00 2001 From: doug <> Date: Fri, 4 Mar 2016 16:06:38 +0000 Subject: Revert bn_expand until there's consensus on a fix. --- src/lib/libcrypto/bn/bn.h | 17 +++-------------- src/lib/libssl/src/crypto/bn/bn.h | 17 +++-------------- 2 files changed, 6 insertions(+), 28 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 5efccd180b..7d11a049d0 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn.h,v 1.29 2016/03/02 06:16:11 doug Exp $ */ +/* $OpenBSD: bn.h,v 1.30 2016/03/04 16:06:38 doug Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -125,7 +125,6 @@ #ifndef HEADER_BN_H #define HEADER_BN_H -#include #include #include @@ -620,20 +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); - -static inline 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); -} - #ifndef OPENSSL_NO_DEPRECATED BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ #endif diff --git a/src/lib/libssl/src/crypto/bn/bn.h b/src/lib/libssl/src/crypto/bn/bn.h index 5efccd180b..7d11a049d0 100644 --- a/src/lib/libssl/src/crypto/bn/bn.h +++ b/src/lib/libssl/src/crypto/bn/bn.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn.h,v 1.29 2016/03/02 06:16:11 doug Exp $ */ +/* $OpenBSD: bn.h,v 1.30 2016/03/04 16:06:38 doug Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -125,7 +125,6 @@ #ifndef HEADER_BN_H #define HEADER_BN_H -#include #include #include @@ -620,20 +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); - -static inline 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); -} - #ifndef OPENSSL_NO_DEPRECATED BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ #endif -- cgit v1.2.3-55-g6feb