Sha256: 9cd508af03303be8b4999458e3d9746b929f9e1d3799de843c2cb57c92913a1e

Contents?: true

Size: 1.89 KB

Versions: 19

Compression:

Stored size: 1.89 KB

Contents

/* Copyright (c) 2021, Google Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */

#include <openssl/bytestring.h>
#include <openssl/ssl.h>
#include <openssl/span.h>

#include "../ssl/internal.h"


extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
  static bssl::UniquePtr<SSL_CTX> ctx(SSL_CTX_new(TLS_method()));
  static bssl::UniquePtr<SSL> ssl(SSL_new(ctx.get()));

  CBS reader(bssl::MakeConstSpan(buf, len));
  CBS encoded_client_hello_inner_cbs;

  if (!CBS_get_u24_length_prefixed(&reader, &encoded_client_hello_inner_cbs)) {
    return 0;
  }

  bssl::Array<uint8_t> encoded_client_hello_inner;
  if (!encoded_client_hello_inner.CopyFrom(encoded_client_hello_inner_cbs)) {
    return 0;
  }

  // Use the remaining bytes in |reader| as the ClientHelloOuter.
  SSL_CLIENT_HELLO client_hello_outer;
  if (!bssl::ssl_client_hello_init(ssl.get(), &client_hello_outer, reader)) {
    return 0;
  }

  // Recover the ClientHelloInner from the EncodedClientHelloInner and
  // ClientHelloOuter.
  uint8_t alert_unused;
  bssl::Array<uint8_t> client_hello_inner;
  bssl::ssl_decode_client_hello_inner(
      ssl.get(), &alert_unused, &client_hello_inner, encoded_client_hello_inner,
      &client_hello_outer);
  return 0;
}

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
couchbase-3.5.5 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
aws-crt-0.4.0 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
couchbase-3.5.4 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
aws-crt-0.3.0 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
couchbase-3.5.3 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
couchbase-3.5.2 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
aws-crt-0.2.1 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
couchbase-3.5.1 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
couchbase-3.5.0 ext/cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/fuzz/decode_client_hello_inner.cc
aws-crt-0.2.0 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.9 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.8 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.7 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.6 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.5 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.4 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.2 aws-crt-ffi/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.1.pre native/crt/aws-lc/fuzz/decode_client_hello_inner.cc
aws-crt-0.1.0.pre native/crt/aws-lc/fuzz/decode_client_hello_inner.cc