diff options
author | Kenny Root <kroot@google.com> | 2015-09-25 00:37:00 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-25 00:37:00 +0000 |
commit | 00bc53f6f4436972b7a8dcf2c1e5fd0ad7515872 (patch) | |
tree | dc62c249d595198e0d99e43890019d21e901fbec /src/crypto/bn/bn.c | |
parent | 3781a60670f92c3c6fca860cb4589495cefa2e56 (diff) | |
parent | a04d78d392463df4e69a64360c952ffa5abd22f7 (diff) | |
download | external_boringssl-00bc53f6f4436972b7a8dcf2c1e5fd0ad7515872.zip external_boringssl-00bc53f6f4436972b7a8dcf2c1e5fd0ad7515872.tar.gz external_boringssl-00bc53f6f4436972b7a8dcf2c1e5fd0ad7515872.tar.bz2 |
am a04d78d3: Revert "external/boringssl: sync with upstream."
* commit 'a04d78d392463df4e69a64360c952ffa5abd22f7':
Revert "external/boringssl: sync with upstream."
Diffstat (limited to 'src/crypto/bn/bn.c')
-rw-r--r-- | src/crypto/bn/bn.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/crypto/bn/bn.c b/src/crypto/bn/bn.c index b342749..f32d6b0 100644 --- a/src/crypto/bn/bn.c +++ b/src/crypto/bn/bn.c @@ -69,7 +69,7 @@ BIGNUM *BN_new(void) { BIGNUM *bn = OPENSSL_malloc(sizeof(BIGNUM)); if (bn == NULL) { - OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE); + OPENSSL_PUT_ERROR(BN, BN_new, ERR_R_MALLOC_FAILURE); return NULL; } @@ -279,26 +279,26 @@ void BN_set_negative(BIGNUM *bn, int sign) { } } -BIGNUM *bn_wexpand(BIGNUM *bn, size_t words) { +BIGNUM *bn_wexpand(BIGNUM *bn, unsigned words) { BN_ULONG *a; - if (words <= (size_t)bn->dmax) { + if (words <= (unsigned) bn->dmax) { return bn; } if (words > (INT_MAX / (4 * BN_BITS2))) { - OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG); + OPENSSL_PUT_ERROR(BN, bn_wexpand, BN_R_BIGNUM_TOO_LONG); return NULL; } if (bn->flags & BN_FLG_STATIC_DATA) { - OPENSSL_PUT_ERROR(BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); + OPENSSL_PUT_ERROR(BN, bn_wexpand, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } a = (BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG) * words); if (a == NULL) { - OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE); + OPENSSL_PUT_ERROR(BN, bn_wexpand, ERR_R_MALLOC_FAILURE); return NULL; } @@ -306,16 +306,12 @@ BIGNUM *bn_wexpand(BIGNUM *bn, size_t words) { OPENSSL_free(bn->d); bn->d = a; - bn->dmax = (int)words; + bn->dmax = words; return bn; } -BIGNUM *bn_expand(BIGNUM *bn, size_t bits) { - if (bits + BN_BITS2 - 1 < bits) { - OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG); - return NULL; - } +BIGNUM *bn_expand(BIGNUM *bn, unsigned bits) { return bn_wexpand(bn, (bits+BN_BITS2-1)/BN_BITS2); } |