1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 * This target fuzzes NSS mpi against openssl bignum.
7 * It therefore requires openssl to be installed.
10 #include "mpi_helper.h"
12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
) {
13 // We require at least size 3 to get two integers from Data.
19 auto modulus
= get_modulus(data
, size
, ctx
);
20 // Compare with OpenSSL add mod
21 m1
= &std::get
<1>(modulus
);
22 assert(mp_addmod(&a
, &b
, m1
, &c
) == MP_OKAY
);
23 (void)BN_mod_add(C
, A
, B
, std::get
<0>(modulus
), ctx
);
24 check_equal(C
, &c
, max_size
);