Coverage Report

Created: 2025-08-18 06:36

/src/nss/fuzz/targets/ech.cc
Line
Count
Source
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/. */
4
5
#include <cassert>
6
#include <cstddef>
7
#include <cstdint>
8
9
#include "nss_scoped_ptrs.h"
10
#include "prio.h"
11
#include "sslexp.h"
12
13
#include "base/database.h"
14
#include "tls/socket.h"
15
16
894
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t len) {
17
894
  static NSSDatabase db = NSSDatabase();
18
894
  static PRDescIdentity id = PR_GetUniqueIdentity("fuzz-ech");
19
20
894
  static TlsSocket::DummyPrSocket socket = TlsSocket::DummyPrSocket(nullptr, 0);
21
894
  static ScopedPRFileDesc prFd(DummyIOLayerMethods::CreateFD(id, &socket));
22
894
  static PRFileDesc* sslFd = SSL_ImportFD(nullptr, prFd.get());
23
894
  assert(sslFd == prFd.get());
24
25
894
  SSL_SetClientEchConfigs(sslFd, data, len);
26
27
894
  return 0;
28
894
}