tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ech.cc (875B)


      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 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t len) {
     17  static NSSDatabase db = NSSDatabase();
     18  static PRDescIdentity id = PR_GetUniqueIdentity("fuzz-ech");
     19 
     20  static TlsSocket::DummyPrSocket socket = TlsSocket::DummyPrSocket(nullptr, 0);
     21  static ScopedPRFileDesc prFd(DummyIOLayerMethods::CreateFD(id, &socket));
     22  static PRFileDesc* sslFd = SSL_ImportFD(nullptr, prFd.get());
     23  assert(sslFd == prFd.get());
     24 
     25  SSL_SetClientEchConfigs(sslFd, data, len);
     26 
     27  return 0;
     28 }