diff options
author | doug <> | 2016-03-04 16:06:38 +0000 |
---|---|---|
committer | doug <> | 2016-03-04 16:06:38 +0000 |
commit | af37e0cd640a36968c4e3b6c009e96ba25b3e51c (patch) | |
tree | 2e6090daa892d24010d56a2fa3067f060765d22b /src/lib | |
parent | fc058410955c015c49e2b0bea7d294f5565009cf (diff) | |
download | openbsd-af37e0cd640a36968c4e3b6c009e96ba25b3e51c.tar.gz openbsd-af37e0cd640a36968c4e3b6c009e96ba25b3e51c.tar.bz2 openbsd-af37e0cd640a36968c4e3b6c009e96ba25b3e51c.zip |
Revert bn_expand until there's consensus on a fix.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bn/bn.h | 17 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bn/bn.h | 17 |
2 files changed, 6 insertions, 28 deletions
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 @@ | |||
1 | /* $OpenBSD: bn.h,v 1.29 2016/03/02 06:16:11 doug Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.30 2016/03/04 16:06:38 doug Exp $ */ |
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -125,7 +125,6 @@ | |||
125 | #ifndef HEADER_BN_H | 125 | #ifndef HEADER_BN_H |
126 | #define HEADER_BN_H | 126 | #define HEADER_BN_H |
127 | 127 | ||
128 | #include <limits.h> | ||
129 | #include <stdio.h> | 128 | #include <stdio.h> |
130 | #include <stdlib.h> | 129 | #include <stdlib.h> |
131 | 130 | ||
@@ -620,20 +619,10 @@ const BIGNUM *BN_get0_nist_prime_521(void); | |||
620 | 619 | ||
621 | /* library internal functions */ | 620 | /* library internal functions */ |
622 | 621 | ||
622 | #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ | ||
623 | (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) | ||
623 | #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) | 624 | #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) |
624 | BIGNUM *bn_expand2(BIGNUM *a, int words); | 625 | BIGNUM *bn_expand2(BIGNUM *a, int words); |
625 | |||
626 | static inline BIGNUM *bn_expand(BIGNUM *a, int bits) | ||
627 | { | ||
628 | if (bits > (INT_MAX - BN_BITS2 + 1)) | ||
629 | return (NULL); | ||
630 | |||
631 | if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) | ||
632 | return (a); | ||
633 | |||
634 | return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); | ||
635 | } | ||
636 | |||
637 | #ifndef OPENSSL_NO_DEPRECATED | 626 | #ifndef OPENSSL_NO_DEPRECATED |
638 | BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ | 627 | BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ |
639 | #endif | 628 | #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 @@ | |||
1 | /* $OpenBSD: bn.h,v 1.29 2016/03/02 06:16:11 doug Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.30 2016/03/04 16:06:38 doug Exp $ */ |
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -125,7 +125,6 @@ | |||
125 | #ifndef HEADER_BN_H | 125 | #ifndef HEADER_BN_H |
126 | #define HEADER_BN_H | 126 | #define HEADER_BN_H |
127 | 127 | ||
128 | #include <limits.h> | ||
129 | #include <stdio.h> | 128 | #include <stdio.h> |
130 | #include <stdlib.h> | 129 | #include <stdlib.h> |
131 | 130 | ||
@@ -620,20 +619,10 @@ const BIGNUM *BN_get0_nist_prime_521(void); | |||
620 | 619 | ||
621 | /* library internal functions */ | 620 | /* library internal functions */ |
622 | 621 | ||
622 | #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ | ||
623 | (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) | ||
623 | #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) | 624 | #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) |
624 | BIGNUM *bn_expand2(BIGNUM *a, int words); | 625 | BIGNUM *bn_expand2(BIGNUM *a, int words); |
625 | |||
626 | static inline BIGNUM *bn_expand(BIGNUM *a, int bits) | ||
627 | { | ||
628 | if (bits > (INT_MAX - BN_BITS2 + 1)) | ||
629 | return (NULL); | ||
630 | |||
631 | if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) | ||
632 | return (a); | ||
633 | |||
634 | return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); | ||
635 | } | ||
636 | |||
637 | #ifndef OPENSSL_NO_DEPRECATED | 626 | #ifndef OPENSSL_NO_DEPRECATED |
638 | BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ | 627 | BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ |
639 | #endif | 628 | #endif |