aboutsummaryrefslogtreecommitdiff
path: root/fuzz/bn_mod_exp.cc
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2018-01-23 17:03:26 -0500
committerAdam Langley <agl@google.com>2018-02-02 20:23:25 +0000
commitf4b708cc1e56cb46291c7d2d0b78396b648e93be (patch)
treeccc8fc52e3468d07ac63af70eb487fe1849d2815 /fuzz/bn_mod_exp.cc
parentfeffb871689d8ecb14b1c0f6a781c84871829269 (diff)
downloadboringssl-f4b708cc1e56cb46291c7d2d0b78396b648e93be.zip
boringssl-f4b708cc1e56cb46291c7d2d0b78396b648e93be.tar.gz
boringssl-f4b708cc1e56cb46291c7d2d0b78396b648e93be.tar.bz2
Add a function which folds BN_MONT_CTX_{new,set} together.
These empty states aren't any use to either caller or implementor. Change-Id: If0b748afeeb79e4a1386182e61c5b5ecf838de62 Reviewed-on: https://boringssl-review.googlesource.com/25254 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'fuzz/bn_mod_exp.cc')
-rw-r--r--fuzz/bn_mod_exp.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/fuzz/bn_mod_exp.cc b/fuzz/bn_mod_exp.cc
index 46e3c88..997c3a6 100644
--- a/fuzz/bn_mod_exp.cc
+++ b/fuzz/bn_mod_exp.cc
@@ -93,11 +93,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
}
bssl::UniquePtr<BN_CTX> ctx(BN_CTX_new());
- bssl::UniquePtr<BN_MONT_CTX> mont(BN_MONT_CTX_new());
bssl::UniquePtr<BIGNUM> result(BN_new());
bssl::UniquePtr<BIGNUM> expected(BN_new());
CHECK(ctx);
- CHECK(mont);
CHECK(result);
CHECK(expected);
@@ -108,7 +106,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
CHECK(BN_cmp(result.get(), expected.get()) == 0);
if (BN_is_odd(modulus.get())) {
- CHECK(BN_MONT_CTX_set(mont.get(), modulus.get(), ctx.get()));
+ bssl::UniquePtr<BN_MONT_CTX> mont(
+ BN_MONT_CTX_new_for_modulus(modulus.get(), ctx.get()));
+ CHECK(mont);
CHECK(BN_mod_exp_mont(result.get(), base.get(), power.get(), modulus.get(),
ctx.get(), mont.get()));
CHECK(BN_cmp(result.get(), expected.get()) == 0);