Coverage Report

Created: 2025-07-05 06:15

/src/botan/src/fuzzer/pkcs8.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/data_src.h>
10
#include <botan/ec_group.h>
11
#include <botan/pk_keys.h>
12
#include <botan/pkcs8.h>
13
14
40.7k
void fuzz(std::span<const uint8_t> in) {
15
40.7k
   try {
16
40.7k
      Botan::DataSource_Memory input(in);
17
40.7k
      std::unique_ptr<Botan::Private_Key> key = Botan::PKCS8::load_key(input);
18
40.7k
   } catch(Botan::Exception& e) {}
19
20
   /*
21
   * This avoids OOMs in OSS-Fuzz caused by storing precomputations
22
   * for thousands of curves randomly generated by the fuzzer.
23
   *
24
   * TODO(Botan4) we can remove this call once support for explicit curves
25
   * is removed
26
   */
27
40.7k
   Botan::EC_Group::clear_registered_curve_data();
28
40.7k
}