aboutsummaryrefslogtreecommitdiffstats
path: root/src/fuzzer/redc_p256.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-26 16:34:44 -0500
committerJack Lloyd <[email protected]>2018-02-26 16:44:49 -0500
commit72b12e25bfdacc2e9553f64b3d87a48cb46bd682 (patch)
treee3f3a326c8db2219e86d1f530e1cd8735659a404 /src/fuzzer/redc_p256.cpp
parent3b84e568bd591a9a76d8d3778d90a8d761c1698b (diff)
Remove use of redc_helper in fuzzers
This runs into the same weird UbSan issue as in #1370
Diffstat (limited to 'src/fuzzer/redc_p256.cpp')
-rw-r--r--src/fuzzer/redc_p256.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fuzzer/redc_p256.cpp b/src/fuzzer/redc_p256.cpp
index b8d78e7bb..4c3809f08 100644
--- a/src/fuzzer/redc_p256.cpp
+++ b/src/fuzzer/redc_p256.cpp
@@ -5,7 +5,7 @@
*/
#include "fuzzers.h"
-#include "redc_helper.h"
+#include <botan/reducer.h>
#include <botan/curve_nistp.h>
void fuzz(const uint8_t in[], size_t len)
@@ -17,10 +17,15 @@ void fuzz(const uint8_t in[], size_t len)
static const Botan::BigInt prime_2 = prime * prime;
static Botan::Modular_Reducer prime_redc(prime);
- Botan::BigInt x = Botan::BigInt::decode(in, len);
+ Botan::BigInt input = Botan::BigInt::decode(in, len);
- if(x < prime_2)
+ if(input < prime_2)
{
- check_redc(Botan::redc_p256, prime_redc, prime, x);
+ const Botan::BigInt ref = prime_redc.reduce(input);
+
+ Botan::secure_vector<Botan::word> ws;
+ Botan::redc_p256(input, ws);
+
+ FUZZER_ASSERT_EQUAL(ref, input);
}
}