Coverage Report

Created: 2020-02-14 15:38

/src/botan/src/fuzzer/os2ecp.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
#include "fuzzers.h"
7
#include <botan/ec_group.h>
8
#include <botan/point_gfp.h>
9
10
namespace {
11
12
void check_os2ecp(const Botan::EC_Group& group, const uint8_t in[], size_t len)
13
7.41k
   {
14
7.41k
   try
15
7.41k
      {
16
7.41k
      Botan::PointGFp point = group.OS2ECP(in, len);
17
7.41k
      }
18
7.41k
   catch(Botan::Exception& e) {}
19
7.41k
   }
20
21
}
22
23
void fuzz(const uint8_t in[], size_t len)
24
949
   {
25
949
   if(len >= 256)
26
22
      return;
27
927
28
927
   static Botan::EC_Group p192("secp192r1");
29
927
   static Botan::EC_Group p224("secp224r1");
30
927
   static Botan::EC_Group p256("secp256r1");
31
927
   static Botan::EC_Group p384("secp384r1");
32
927
   static Botan::EC_Group p521("secp521r1");
33
927
   static Botan::EC_Group bp256("brainpool256r1");
34
927
   static Botan::EC_Group bp512("brainpool512r1");
35
927
36
927
   check_os2ecp(p192, in, len);
37
927
   check_os2ecp(p224, in, len);
38
927
   check_os2ecp(p256, in, len);
39
927
   check_os2ecp(p384, in, len);
40
927
   check_os2ecp(p521, in, len);
41
927
   check_os2ecp(p521, in, len);
42
927
   check_os2ecp(bp256, in, len);
43
927
   check_os2ecp(bp512, in, len);
44
927
   }