Coverage Report

Created: 2020-05-23 13:54

/src/botan/src/fuzzer/redc_p192.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
#include <botan/reducer.h>
9
#include <botan/curve_nistp.h>
10
11
void fuzz(const uint8_t in[], size_t len)
12
343
   {
13
343
   if(len > 2*192/8)
14
122
      return;
15
221
16
221
   static const Botan::BigInt& prime = Botan::prime_p192();
17
221
   static const Botan::BigInt prime_2 = prime * prime;
18
221
   static Botan::Modular_Reducer prime_redc(prime);
19
221
20
221
   Botan::BigInt input = Botan::BigInt::decode(in, len);
21
221
22
221
   if(input < prime_2)
23
215
      {
24
215
      const Botan::BigInt ref = prime_redc.reduce(input);
25
215
26
215
      Botan::secure_vector<Botan::word> ws;
27
215
      Botan::redc_p192(input, ws);
28
215
29
215
      FUZZER_ASSERT_EQUAL(ref, input);
30
215
      }
31
221
   }