Coverage Report

Created: 2025-04-11 06:34

/src/botan/src/fuzzer/x509_path.cpp
Line
Count
Source
1
/*
2
* (C) 2022 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/x509cert.h>
11
#include <botan/x509path.h>
12
13
28.7k
void fuzz(std::span<const uint8_t> in) {
14
28.7k
   Botan::DataSource_Memory input(in);
15
16
28.7k
   try {
17
28.7k
      Botan::X509_Certificate subject(input);
18
28.7k
      Botan::X509_Certificate issuer(input);
19
20
28.7k
      std::vector<Botan::Certificate_Store*> roots;
21
28.7k
      std::unique_ptr<Botan::Certificate_Store> root_store(new Botan::Certificate_Store_In_Memory(issuer));
22
28.7k
      roots.push_back(root_store.get());
23
24
28.7k
      Botan::Path_Validation_Restrictions restrictions;
25
26
28.7k
      x509_path_validate({subject}, restrictions, roots);
27
28.7k
   } catch(Botan::Exception& e) {}
28
28.7k
}