/src/botan/src/fuzzer/bn_sqr.cpp
Line | Count | Source |
1 | | /* |
2 | | * (C) 2015,2016 Jack Lloyd |
3 | | * |
4 | | * Botan is released under the Simplified BSD License (see license.txt) |
5 | | */ |
6 | | |
7 | | #include "fuzzers.h" |
8 | | |
9 | | #include <botan/bigint.h> |
10 | | #include <botan/numthry.h> |
11 | | |
12 | | void fuzz(const uint8_t in[], size_t len) |
13 | 217 | { |
14 | 217 | if(len > 8192/8) |
15 | 17 | return; |
16 | 200 | |
17 | 200 | Botan::BigInt x = Botan::BigInt::decode(in, len); |
18 | 200 | |
19 | 200 | Botan::BigInt x_sqr = square(x); |
20 | 200 | Botan::BigInt x_mul = x * x; |
21 | 200 | |
22 | 200 | FUZZER_ASSERT_EQUAL(x_sqr, x_mul); |
23 | 200 | } |
24 | | |