Adding in curl and openssl repos

This commit is contained in:
2025-08-14 12:09:30 -04:00
parent af2117b574
commit 0ace93e303
21174 changed files with 3607720 additions and 2 deletions

View File

@@ -0,0 +1,203 @@
Fuzzing OpenSSL
===============
OpenSSL can use either LibFuzzer or AFL to do fuzzing.
LibFuzzer
---------
How to fuzz OpenSSL with [libfuzzer](http://llvm.org/docs/LibFuzzer.html),
starting from a vanilla+OpenSSH server Ubuntu install.
With `clang` from a package manager
-----------------------------------
Install `clang`, which [ships with `libfuzzer`](http://llvm.org/docs/LibFuzzer.html#fuzzer-usage)
since version 6.0:
sudo apt-get install clang
Configure `openssl` for fuzzing. For now, you'll still need to pass in the path
to the `libFuzzer` library file while configuring; this is represented as
`$PATH_TO_LIBFUZZER` below. A typical value would be
`/usr/lib/llvm-7/lib/clang/7.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a`.
CC=clang ./config enable-fuzz-libfuzzer \
--with-fuzzer-lib=$PATH_TO_LIBFUZZER \
-DPEDANTIC enable-asan enable-ubsan no-shared \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
-fsanitize=fuzzer-no-link \
enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment \
enable-weak-ssl-ciphers enable-rc5 enable-md2 \
enable-ssl3 enable-ssl3-method enable-nextprotoneg \
--debug
Clang uses the gcc libstdc++ library so this must also be installed. You can
check which version of gcc clang is using like this:
$ clang --verbose
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/12
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
So, in the above example clang is using gcc version 12. Ensure that the selected
gcc version has the relevant libstdc++ files installed:
$ ls /usr/lib/gcc/x86_64-linux-gnu/12 | grep stdc++
libstdc++.a
libstdc++fs.a
libstdc++.so
On Ubuntu for gcc-12 this requires the libstdc++-12-dev package installed.
$ sudo apt-get install libstdc++-12-dev
Compile:
sudo apt-get install make
make clean
LDCMD=clang++ make -j4
Finally, perform the actual fuzzing:
fuzz/helper.py $FUZZER
where $FUZZER is one of the executables in `fuzz/`.
It will run until you stop it.
If you get a crash, you should find a corresponding input file in
`fuzz/corpora/$FUZZER-crash/`.
With `clang` from source/pre-built binaries
-------------------------------------------
You may also wish to use a pre-built binary from the [LLVM Download
site](http://releases.llvm.org/download.html), or to [build `clang` from
source](https://clang.llvm.org/get_started.html). After adding `clang` to your
path and locating the `libfuzzer` library file, the procedure for configuring
fuzzing is the same, except that you also need to specify
a `--with-fuzzer-include` option, which should be the parent directory of the
prebuilt fuzzer library. This is represented as `$PATH_TO_LIBFUZZER_DIR` below.
CC=clang ./config enable-fuzz-libfuzzer \
--with-fuzzer-include=$PATH_TO_LIBFUZZER_DIR \
--with-fuzzer-lib=$PATH_TO_LIBFUZZER \
-DPEDANTIC enable-asan enable-ubsan no-shared \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
-fsanitize=fuzzer-no-link \
enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment \
enable-weak-ssl-ciphers enable-rc5 enable-md2 \
enable-ssl3 enable-ssl3-method enable-nextprotoneg \
--debug
AFL
---
This is an alternative to using LibFuzzer.
Configure for fuzzing:
sudo apt-get install afl-clang
CC=afl-clang-fast ./config enable-fuzz-afl no-shared no-module \
-DPEDANTIC enable-tls1_3 enable-weak-ssl-ciphers enable-rc5 \
enable-md2 enable-ssl3 enable-ssl3-method enable-nextprotoneg \
enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment \
--debug
make clean
make
The following options can also be enabled: enable-asan, enable-ubsan, enable-msan
Run one of the fuzzers:
afl-fuzz -i fuzz/corpora/$FUZZER -o fuzz/corpora/$FUZZER/out fuzz/$FUZZER
Where $FUZZER is one of the executables in `fuzz/`.
Reproducing issues
------------------
If a fuzzer generates a reproducible error, you can reproduce the problem using
the fuzz/*-test binaries and the file generated by the fuzzer. They binaries
don't need to be built for fuzzing, there is no need to set CC or the call
config with enable-fuzz-* or -fsanitize-coverage, but some of the other options
above might be needed. For instance the enable-asan or enable-ubsan option might
be useful to show you when the problem happens. For the client and server fuzzer
it might be needed to use -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION to
reproduce the generated random numbers.
To reproduce the crash you can run:
fuzz/$FUZZER-test $file
To do all the tests of a specific fuzzer such as asn1 you can run
fuzz/asn1-test fuzz/corpora/asn1
or
make test TESTS=fuzz_test_asn1
To run several fuzz tests you can use for instance:
make test TESTS='test_fuzz_cmp test_fuzz_cms'
To run all fuzz tests you can use:
make test TESTS='test_fuzz_*'
Random numbers
--------------
The client and server fuzzer normally generate random numbers as part of the TLS
connection setup. This results in the coverage of the fuzzing corpus changing
depending on the random numbers. This also has an effect for coverage of the
rest of the test suite and you see the coverage change for each commit even when
no code has been modified.
Since we want to maximize the coverage of the fuzzing corpus, the client and
server fuzzer will use predictable numbers instead of the random numbers. This
is controlled by the FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION define.
The coverage depends on the way the numbers are generated. We don't disable any
check of hashes, but the corpus has the correct hash in it for the random
numbers that were generated. For instance the client fuzzer will always generate
the same client hello with the same random number in it, and so the server, as
emulated by the file, can be generated for that client hello.
Coverage changes
----------------
Since the corpus depends on the default behaviour of the client and the server,
changes in what they send by default will have an impact on the coverage. The
corpus will need to be updated in that case.
Updating the corpus
-------------------
The client and server corpus is generated with multiple config options:
- The options as documented above
- Without enable-ec_nistp_64_gcc_128 and without --debug
- With no-asm
- Using 32 bit
- A default config, plus options needed to generate the fuzzer.
The libfuzzer merge option is used to add the additional coverage
from each config to the minimal set.
Minimizing the corpus
---------------------
When you have gathered corpus data from more than one fuzzer run
or for any other reason want to minimize the data
in some corpus subdirectory `fuzz/corpora/DIR` this can be done as follows:
mkdir fuzz/corpora/NEWDIR
fuzz/$FUZZER -merge=1 fuzz/corpora/NEWDIR fuzz/corpora/DIR

BIN
openssl-3.4.2/fuzz/acert-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,25 @@
fuzz/acert-test-bin-acert.o: fuzz/acert.c include/openssl/x509_acert.h \
include/openssl/x509v3.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/bio.h include/openssl/e_os2.h \
include/openssl/crypto.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/types.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/bioerr.h include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/x509v3err.h include/openssl/pem.h \
include/openssl/pemerr.h include/openssl/err.h include/openssl/rand.h \
include/openssl/randerr.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/acert-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/x509_acert.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
const unsigned char *p = buf;
unsigned char *der = NULL;
X509_ACERT *acert = d2i_X509_ACERT(NULL, &p, len);
if (acert != NULL) {
BIO *bio = BIO_new(BIO_s_null());
X509_ACERT_print(bio, acert);
BIO_free(bio);
i2d_X509_ACERT(acert, &der);
OPENSSL_free(der);
X509_ACERT_free(acert);
}
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/asn1-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,37 @@
fuzz/asn1-test-bin-asn1.o: fuzz/asn1.c include/openssl/asn1.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/bio.h include/openssl/crypto.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bioerr.h \
include/openssl/asn1err.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/asn1t.h include/openssl/dh.h include/openssl/dherr.h \
include/openssl/dsa.h include/openssl/dsaerr.h include/openssl/ec.h \
include/openssl/ecerr.h include/openssl/params.h include/openssl/ocsp.h \
include/openssl/http.h include/openssl/conf.h include/openssl/lhash.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/objectserr.h \
include/openssl/rsa.h include/openssl/rsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/pkcs7.h include/openssl/pkcs7err.h \
include/openssl/x509v3.h include/openssl/x509v3err.h \
include/openssl/ocsperr.h include/openssl/pkcs12.h \
include/openssl/pkcs12err.h include/openssl/ts.h include/openssl/tserr.h \
include/openssl/ess.h include/openssl/esserr.h include/openssl/cms.h \
include/openssl/cmserr.h include/openssl/err.h include/openssl/rand.h \
include/openssl/randerr.h include/openssl/ssl.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/comperr.h include/openssl/pem.h include/openssl/pemerr.h \
include/openssl/hmac.h include/openssl/async.h \
include/openssl/asyncerr.h include/openssl/ct.h include/openssl/cterr.h \
include/openssl/sslerr.h include/openssl/sslerr_legacy.h \
include/openssl/prov_ssl.h include/openssl/ssl2.h include/openssl/ssl3.h \
include/openssl/tls1.h include/openssl/dtls1.h include/openssl/srtp.h \
include/openssl/quic.h include/openssl/x509_acert.h \
include/internal/nelem.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/asn1-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/asn1-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

383
openssl-3.4.2/fuzz/asn1.c Normal file
View File

@@ -0,0 +1,383 @@
/*
* Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Fuzz ASN.1 parsing for various data structures. Specify which on the
* command line:
*
* asn1 <data structure>
*/
/* We need to use some deprecated APIs */
#define OPENSSL_SUPPRESS_DEPRECATED
#include <stdio.h>
#include <string.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/dh.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
#include <openssl/ocsp.h>
#include <openssl/pkcs12.h>
#include <openssl/rsa.h>
#include <openssl/ts.h>
#include <openssl/x509v3.h>
#include <openssl/cms.h>
#include <openssl/ess.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
#include <openssl/x509_acert.h>
#include "internal/nelem.h"
#include "fuzzer.h"
static ASN1_ITEM_EXP *item_type[] = {
ASN1_ITEM_ref(ACCESS_DESCRIPTION),
#ifndef OPENSSL_NO_RFC3779
ASN1_ITEM_ref(ASIdentifierChoice),
ASN1_ITEM_ref(ASIdentifiers),
ASN1_ITEM_ref(ASIdOrRange),
#endif
ASN1_ITEM_ref(ASN1_ANY),
ASN1_ITEM_ref(ASN1_BIT_STRING),
ASN1_ITEM_ref(ASN1_BMPSTRING),
ASN1_ITEM_ref(ASN1_BOOLEAN),
ASN1_ITEM_ref(ASN1_ENUMERATED),
ASN1_ITEM_ref(ASN1_FBOOLEAN),
ASN1_ITEM_ref(ASN1_GENERALIZEDTIME),
ASN1_ITEM_ref(ASN1_GENERALSTRING),
ASN1_ITEM_ref(ASN1_IA5STRING),
ASN1_ITEM_ref(ASN1_INTEGER),
ASN1_ITEM_ref(ASN1_NULL),
ASN1_ITEM_ref(ASN1_OBJECT),
ASN1_ITEM_ref(ASN1_OCTET_STRING),
ASN1_ITEM_ref(ASN1_OCTET_STRING_NDEF),
ASN1_ITEM_ref(ASN1_PRINTABLE),
ASN1_ITEM_ref(ASN1_PRINTABLESTRING),
ASN1_ITEM_ref(ASN1_SEQUENCE),
ASN1_ITEM_ref(ASN1_SEQUENCE_ANY),
ASN1_ITEM_ref(ASN1_SET_ANY),
ASN1_ITEM_ref(ASN1_T61STRING),
ASN1_ITEM_ref(ASN1_TBOOLEAN),
ASN1_ITEM_ref(ASN1_TIME),
ASN1_ITEM_ref(ASN1_UNIVERSALSTRING),
ASN1_ITEM_ref(ASN1_UTCTIME),
ASN1_ITEM_ref(ASN1_UTF8STRING),
ASN1_ITEM_ref(ASN1_VISIBLESTRING),
#ifndef OPENSSL_NO_RFC3779
ASN1_ITEM_ref(ASRange),
#endif
ASN1_ITEM_ref(AUTHORITY_INFO_ACCESS),
ASN1_ITEM_ref(AUTHORITY_KEYID),
ASN1_ITEM_ref(BASIC_CONSTRAINTS),
ASN1_ITEM_ref(BIGNUM),
ASN1_ITEM_ref(CBIGNUM),
ASN1_ITEM_ref(CERTIFICATEPOLICIES),
#ifndef OPENSSL_NO_CMS
ASN1_ITEM_ref(CMS_ContentInfo),
ASN1_ITEM_ref(CMS_ReceiptRequest),
ASN1_ITEM_ref(CRL_DIST_POINTS),
#endif
#ifndef OPENSSL_NO_DH
ASN1_ITEM_ref(DHparams),
#endif
ASN1_ITEM_ref(DIRECTORYSTRING),
ASN1_ITEM_ref(DISPLAYTEXT),
ASN1_ITEM_ref(DIST_POINT),
ASN1_ITEM_ref(DIST_POINT_NAME),
#if !defined(OPENSSL_NO_EC) && !defined(OPENSSL_NO_DEPRECATED_3_0)
ASN1_ITEM_ref(ECPARAMETERS),
ASN1_ITEM_ref(ECPKPARAMETERS),
#endif
ASN1_ITEM_ref(EDIPARTYNAME),
ASN1_ITEM_ref(EXTENDED_KEY_USAGE),
ASN1_ITEM_ref(GENERAL_NAME),
ASN1_ITEM_ref(GENERAL_NAMES),
ASN1_ITEM_ref(GENERAL_SUBTREE),
#ifndef OPENSSL_NO_RFC3779
ASN1_ITEM_ref(IPAddressChoice),
ASN1_ITEM_ref(IPAddressFamily),
ASN1_ITEM_ref(IPAddressOrRange),
ASN1_ITEM_ref(IPAddressRange),
#endif
ASN1_ITEM_ref(ISSUING_DIST_POINT),
#ifndef OPENSSL_NO_DEPRECATED_3_0
ASN1_ITEM_ref(LONG),
#endif
ASN1_ITEM_ref(NAME_CONSTRAINTS),
ASN1_ITEM_ref(NETSCAPE_CERT_SEQUENCE),
ASN1_ITEM_ref(NETSCAPE_SPKAC),
ASN1_ITEM_ref(NETSCAPE_SPKI),
ASN1_ITEM_ref(NOTICEREF),
#ifndef OPENSSL_NO_OCSP
ASN1_ITEM_ref(OCSP_BASICRESP),
ASN1_ITEM_ref(OCSP_CERTID),
ASN1_ITEM_ref(OCSP_CERTSTATUS),
ASN1_ITEM_ref(OCSP_CRLID),
ASN1_ITEM_ref(OCSP_ONEREQ),
ASN1_ITEM_ref(OCSP_REQINFO),
ASN1_ITEM_ref(OCSP_REQUEST),
ASN1_ITEM_ref(OCSP_RESPBYTES),
ASN1_ITEM_ref(OCSP_RESPDATA),
ASN1_ITEM_ref(OCSP_RESPID),
ASN1_ITEM_ref(OCSP_RESPONSE),
ASN1_ITEM_ref(OCSP_REVOKEDINFO),
ASN1_ITEM_ref(OCSP_SERVICELOC),
ASN1_ITEM_ref(OCSP_SIGNATURE),
ASN1_ITEM_ref(OCSP_SINGLERESP),
#endif
ASN1_ITEM_ref(OTHERNAME),
ASN1_ITEM_ref(PBE2PARAM),
ASN1_ITEM_ref(PBEPARAM),
ASN1_ITEM_ref(PBKDF2PARAM),
ASN1_ITEM_ref(PKCS12),
ASN1_ITEM_ref(PKCS12_AUTHSAFES),
ASN1_ITEM_ref(PKCS12_BAGS),
ASN1_ITEM_ref(PKCS12_MAC_DATA),
ASN1_ITEM_ref(PKCS12_SAFEBAG),
ASN1_ITEM_ref(PKCS12_SAFEBAGS),
ASN1_ITEM_ref(PKCS7),
ASN1_ITEM_ref(PKCS7_ATTR_SIGN),
ASN1_ITEM_ref(PKCS7_ATTR_VERIFY),
ASN1_ITEM_ref(PKCS7_DIGEST),
ASN1_ITEM_ref(PKCS7_ENC_CONTENT),
ASN1_ITEM_ref(PKCS7_ENCRYPT),
ASN1_ITEM_ref(PKCS7_ENVELOPE),
ASN1_ITEM_ref(PKCS7_ISSUER_AND_SERIAL),
ASN1_ITEM_ref(PKCS7_RECIP_INFO),
ASN1_ITEM_ref(PKCS7_SIGNED),
ASN1_ITEM_ref(PKCS7_SIGN_ENVELOPE),
ASN1_ITEM_ref(PKCS7_SIGNER_INFO),
ASN1_ITEM_ref(PKCS8_PRIV_KEY_INFO),
ASN1_ITEM_ref(PKEY_USAGE_PERIOD),
ASN1_ITEM_ref(POLICY_CONSTRAINTS),
ASN1_ITEM_ref(POLICYINFO),
ASN1_ITEM_ref(POLICY_MAPPING),
ASN1_ITEM_ref(POLICY_MAPPINGS),
ASN1_ITEM_ref(POLICYQUALINFO),
ASN1_ITEM_ref(PROXY_CERT_INFO_EXTENSION),
ASN1_ITEM_ref(PROXY_POLICY),
ASN1_ITEM_ref(RSA_OAEP_PARAMS),
ASN1_ITEM_ref(RSA_PSS_PARAMS),
#ifndef OPENSSL_NO_DEPRECATED_3_0
ASN1_ITEM_ref(RSAPrivateKey),
ASN1_ITEM_ref(RSAPublicKey),
#endif
ASN1_ITEM_ref(SXNET),
ASN1_ITEM_ref(SXNETID),
ASN1_ITEM_ref(OSSL_TARGETING_INFORMATION),
ASN1_ITEM_ref(USERNOTICE),
ASN1_ITEM_ref(X509),
ASN1_ITEM_ref(X509_ALGOR),
ASN1_ITEM_ref(X509_ALGORS),
ASN1_ITEM_ref(X509_ATTRIBUTE),
ASN1_ITEM_ref(X509_CERT_AUX),
ASN1_ITEM_ref(X509_CINF),
ASN1_ITEM_ref(X509_CRL),
ASN1_ITEM_ref(X509_CRL_INFO),
ASN1_ITEM_ref(X509_EXTENSION),
ASN1_ITEM_ref(X509_EXTENSIONS),
ASN1_ITEM_ref(X509_NAME),
ASN1_ITEM_ref(X509_NAME_ENTRY),
ASN1_ITEM_ref(X509_PUBKEY),
ASN1_ITEM_ref(X509_REQ),
ASN1_ITEM_ref(X509_REQ_INFO),
ASN1_ITEM_ref(X509_REVOKED),
ASN1_ITEM_ref(X509_SIG),
ASN1_ITEM_ref(X509_VAL),
#ifndef OPENSSL_NO_DEPRECATED_3_0
ASN1_ITEM_ref(ZLONG),
#endif
ASN1_ITEM_ref(INT32),
ASN1_ITEM_ref(ZINT32),
ASN1_ITEM_ref(UINT32),
ASN1_ITEM_ref(ZUINT32),
ASN1_ITEM_ref(INT64),
ASN1_ITEM_ref(ZINT64),
ASN1_ITEM_ref(UINT64),
ASN1_ITEM_ref(ZUINT64),
NULL
};
static ASN1_PCTX *pctx;
#define DO_TEST(TYPE, D2I, I2D, PRINT) { \
const unsigned char *p = buf; \
unsigned char *der = NULL; \
TYPE *type = D2I(NULL, &p, len); \
\
if (type != NULL) { \
int len2; \
BIO *bio = BIO_new(BIO_s_null()); \
\
if (bio != NULL) { \
PRINT(bio, type); \
BIO_free(bio); \
} \
len2 = I2D(type, &der); \
if (len2 != 0) {} \
OPENSSL_free(der); \
TYPE ## _free(type); \
} \
}
#define DO_TEST_PRINT_OFFSET(TYPE, D2I, I2D, PRINT) { \
const unsigned char *p = buf; \
unsigned char *der = NULL; \
TYPE *type = D2I(NULL, &p, len); \
\
if (type != NULL) { \
BIO *bio = BIO_new(BIO_s_null()); \
\
if (bio != NULL) { \
PRINT(bio, type, 0); \
BIO_free(bio); \
} \
I2D(type, &der); \
OPENSSL_free(der); \
TYPE ## _free(type); \
} \
}
#define DO_TEST_PRINT_PCTX(TYPE, D2I, I2D, PRINT) { \
const unsigned char *p = buf; \
unsigned char *der = NULL; \
TYPE *type = D2I(NULL, &p, len); \
\
if (type != NULL) { \
BIO *bio = BIO_new(BIO_s_null()); \
\
if (bio != NULL) { \
PRINT(bio, type, 0, pctx); \
BIO_free(bio); \
} \
I2D(type, &der); \
OPENSSL_free(der); \
TYPE ## _free(type); \
} \
}
#define DO_TEST_NO_PRINT(TYPE, D2I, I2D) { \
const unsigned char *p = buf; \
unsigned char *der = NULL; \
TYPE *type = D2I(NULL, &p, len); \
\
if (type != NULL) { \
BIO *bio = BIO_new(BIO_s_null()); \
\
BIO_free(bio); \
I2D(type, &der); \
OPENSSL_free(der); \
TYPE ## _free(type); \
} \
}
int FuzzerInitialize(int *argc, char ***argv)
{
FuzzerSetRand();
pctx = ASN1_PCTX_new();
ASN1_PCTX_set_flags(pctx, ASN1_PCTX_FLAGS_SHOW_ABSENT |
ASN1_PCTX_FLAGS_SHOW_SEQUENCE | ASN1_PCTX_FLAGS_SHOW_SSOF |
ASN1_PCTX_FLAGS_SHOW_TYPE | ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME);
ASN1_PCTX_set_str_flags(pctx, ASN1_STRFLGS_UTF8_CONVERT |
ASN1_STRFLGS_SHOW_TYPE | ASN1_STRFLGS_DUMP_ALL);
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int n;
for (n = 0; item_type[n] != NULL; ++n) {
const uint8_t *b = buf;
unsigned char *der = NULL;
const ASN1_ITEM *i = ASN1_ITEM_ptr(item_type[n]);
ASN1_VALUE *o = ASN1_item_d2i(NULL, &b, len, i);
if (o != NULL) {
/*
* Don't print excessively long output to prevent spurious fuzzer
* timeouts.
*/
if (b - buf < 10000) {
BIO *bio = BIO_new(BIO_s_null());
if (bio != NULL) {
ASN1_item_print(bio, o, 4, i, pctx);
BIO_free(bio);
}
}
if (ASN1_item_i2d(o, &der, i) > 0) {
OPENSSL_free(der);
}
ASN1_item_free(o, i);
}
}
#ifndef OPENSSL_NO_TS
DO_TEST(TS_REQ, d2i_TS_REQ, i2d_TS_REQ, TS_REQ_print_bio);
DO_TEST(TS_MSG_IMPRINT, d2i_TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT, TS_MSG_IMPRINT_print_bio);
DO_TEST(TS_RESP, d2i_TS_RESP, i2d_TS_RESP, TS_RESP_print_bio);
DO_TEST(TS_STATUS_INFO, d2i_TS_STATUS_INFO, i2d_TS_STATUS_INFO, TS_STATUS_INFO_print_bio);
DO_TEST(TS_TST_INFO, d2i_TS_TST_INFO, i2d_TS_TST_INFO, TS_TST_INFO_print_bio);
DO_TEST_NO_PRINT(TS_ACCURACY, d2i_TS_ACCURACY, i2d_TS_ACCURACY);
#endif
DO_TEST_NO_PRINT(ESS_ISSUER_SERIAL, d2i_ESS_ISSUER_SERIAL, i2d_ESS_ISSUER_SERIAL);
DO_TEST_NO_PRINT(ESS_CERT_ID, d2i_ESS_CERT_ID, i2d_ESS_CERT_ID);
DO_TEST_NO_PRINT(ESS_SIGNING_CERT, d2i_ESS_SIGNING_CERT, i2d_ESS_SIGNING_CERT);
DO_TEST_NO_PRINT(ESS_CERT_ID_V2, d2i_ESS_CERT_ID_V2, i2d_ESS_CERT_ID_V2);
DO_TEST_NO_PRINT(ESS_SIGNING_CERT_V2, d2i_ESS_SIGNING_CERT_V2, i2d_ESS_SIGNING_CERT_V2);
#if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0)
DO_TEST_NO_PRINT(DH, d2i_DHparams, i2d_DHparams);
DO_TEST_NO_PRINT(DH, d2i_DHxparams, i2d_DHxparams);
#endif
#ifndef OPENSSL_NO_DSA
DO_TEST_NO_PRINT(DSA_SIG, d2i_DSA_SIG, i2d_DSA_SIG);
# ifndef OPENSSL_NO_DEPRECATED_3_0
DO_TEST_NO_PRINT(DSA, d2i_DSAPrivateKey, i2d_DSAPrivateKey);
DO_TEST_NO_PRINT(DSA, d2i_DSAPublicKey, i2d_DSAPublicKey);
DO_TEST_NO_PRINT(DSA, d2i_DSAparams, i2d_DSAparams);
# endif
#endif
#ifndef OPENSSL_NO_DEPRECATED_3_0
DO_TEST_NO_PRINT(RSA, d2i_RSAPublicKey, i2d_RSAPublicKey);
#endif
#ifndef OPENSSL_NO_EC
# ifndef OPENSSL_NO_DEPRECATED_3_0
DO_TEST_PRINT_OFFSET(EC_GROUP, d2i_ECPKParameters, i2d_ECPKParameters, ECPKParameters_print);
DO_TEST_PRINT_OFFSET(EC_KEY, d2i_ECPrivateKey, i2d_ECPrivateKey, EC_KEY_print);
DO_TEST(EC_KEY, d2i_ECParameters, i2d_ECParameters, ECParameters_print);
DO_TEST_NO_PRINT(ECDSA_SIG, d2i_ECDSA_SIG, i2d_ECDSA_SIG);
# endif
#endif
DO_TEST_PRINT_PCTX(EVP_PKEY, d2i_AutoPrivateKey, i2d_PrivateKey, EVP_PKEY_print_private);
DO_TEST(SSL_SESSION, d2i_SSL_SESSION, i2d_SSL_SESSION, SSL_SESSION_print);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
ASN1_PCTX_free(pctx);
FuzzerClearRand();
}

BIN
openssl-3.4.2/fuzz/asn1parse-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fuzz/asn1parse-test-bin-asn1parse.o: fuzz/asn1parse.c \
include/openssl/asn1.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h include/openssl/bio.h \
include/openssl/crypto.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/types.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/bioerr.h include/openssl/asn1err.h include/openssl/bn.h \
include/openssl/bnerr.h include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/objectserr.h include/openssl/ec.h \
include/openssl/ecerr.h include/openssl/rsa.h include/openssl/rsaerr.h \
include/openssl/dsa.h include/openssl/dh.h include/openssl/dherr.h \
include/openssl/dsaerr.h include/openssl/sha.h include/openssl/x509err.h \
include/openssl/x509_vfy.h include/openssl/lhash.h \
include/openssl/pkcs7.h include/openssl/pkcs7err.h \
include/openssl/http.h include/openssl/conf.h include/openssl/conferr.h \
include/openssl/conftypes.h include/openssl/x509v3.h \
include/openssl/x509v3err.h include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/asn1parse-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,45 @@
/*
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Fuzz the parser used for dumping ASN.1 using "openssl asn1parse".
*/
#include <stdio.h>
#include <openssl/asn1.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/err.h>
#include "fuzzer.h"
static BIO *bio_out;
int FuzzerInitialize(int *argc, char ***argv)
{
bio_out = BIO_new(BIO_s_null()); /* output will be ignored */
if (bio_out == NULL)
return 0;
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
(void)ASN1_parse_dump(bio_out, buf, len, 0, 0);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
BIO_free(bio_out);
}

BIN
openssl-3.4.2/fuzz/bignum-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,10 @@
fuzz/bignum-test-bin-bignum.o: fuzz/bignum.c include/openssl/bn.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/types.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/crypto.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bnerr.h include/openssl/err.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/lhash.h \
fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/bignum-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

110
openssl-3.4.2/fuzz/bignum.c Normal file
View File

@@ -0,0 +1,110 @@
/*
* Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Confirm that a^b mod c agrees when calculated cleverly vs naively, for
* random a, b and c.
*/
#include <stdio.h>
#include <openssl/bn.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int success = 0;
size_t l1 = 0, l2 = 0, l3 = 0;
int s1 = 0, s3 = 0;
BN_CTX *ctx;
BIGNUM *b1;
BIGNUM *b2;
BIGNUM *b3;
BIGNUM *b4;
BIGNUM *b5;
b1 = BN_new();
b2 = BN_new();
b3 = BN_new();
b4 = BN_new();
b5 = BN_new();
ctx = BN_CTX_new();
/* Divide the input into three parts, using the values of the first two
* bytes to choose lengths, which generate b1, b2 and b3. Use three bits
* of the third byte to choose signs for the three numbers.
*/
if (len > 2) {
len -= 3;
/* limit l1, l2, and l3 to be no more than 512 bytes */
l1 = ((buf[0] * len) / 255) % 512;
++buf;
l2 = ((buf[0] * (len - l1)) / 255) % 512;
++buf;
l3 = (len - l1 - l2) % 512;
s1 = buf[0] & 1;
s3 = buf[0] & 4;
++buf;
}
OPENSSL_assert(BN_bin2bn(buf, l1, b1) == b1);
BN_set_negative(b1, s1);
OPENSSL_assert(BN_bin2bn(buf + l1, l2, b2) == b2);
OPENSSL_assert(BN_bin2bn(buf + l1 + l2, l3, b3) == b3);
BN_set_negative(b3, s3);
/* mod 0 is undefined */
if (BN_is_zero(b3)) {
success = 1;
goto done;
}
OPENSSL_assert(BN_mod_exp(b4, b1, b2, b3, ctx));
OPENSSL_assert(BN_mod_exp_simple(b5, b1, b2, b3, ctx));
success = BN_cmp(b4, b5) == 0;
if (!success) {
BN_print_fp(stdout, b1);
putchar('\n');
BN_print_fp(stdout, b2);
putchar('\n');
BN_print_fp(stdout, b3);
putchar('\n');
BN_print_fp(stdout, b4);
putchar('\n');
BN_print_fp(stdout, b5);
putchar('\n');
}
done:
OPENSSL_assert(success);
BN_free(b1);
BN_free(b2);
BN_free(b3);
BN_free(b4);
BN_free(b5);
BN_CTX_free(ctx);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/bndiv-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,10 @@
fuzz/bndiv-test-bin-bndiv.o: fuzz/bndiv.c include/openssl/bn.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/types.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/crypto.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bnerr.h include/openssl/err.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/lhash.h \
fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/bndiv-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

131
openssl-3.4.2/fuzz/bndiv.c Normal file
View File

@@ -0,0 +1,131 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Confirm that if (d, r) = a / b, then b * d + r == a, and that sign(d) ==
* sign(a), and 0 <= r <= b
*/
#include <stdio.h>
#include <openssl/bn.h>
#include <openssl/err.h>
#include "fuzzer.h"
/* 256 kB */
#define MAX_LEN (256 * 1000)
static BN_CTX *ctx;
static BIGNUM *b1;
static BIGNUM *b2;
static BIGNUM *b3;
static BIGNUM *b4;
static BIGNUM *b5;
int FuzzerInitialize(int *argc, char ***argv)
{
b1 = BN_new();
b2 = BN_new();
b3 = BN_new();
b4 = BN_new();
b5 = BN_new();
ctx = BN_CTX_new();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int success = 0;
size_t l1 = 0, l2 = 0;
/* s1 and s2 will be the signs for b1 and b2. */
int s1 = 0, s2 = 0;
/* limit the size of the input to avoid timeout */
if (len > MAX_LEN)
len = MAX_LEN;
/* We are going to split the buffer in two, sizes l1 and l2, giving b1 and
* b2.
*/
if (len > 0) {
--len;
/* Use first byte to divide the remaining buffer into 3Fths. I admit
* this disallows some number sizes. If it matters, better ideas are
* welcome (Ben).
*/
l1 = ((buf[0] & 0x3f) * len) / 0x3f;
s1 = buf[0] & 0x40;
s2 = buf[0] & 0x80;
++buf;
l2 = len - l1;
}
OPENSSL_assert(BN_bin2bn(buf, l1, b1) == b1);
BN_set_negative(b1, s1);
OPENSSL_assert(BN_bin2bn(buf + l1, l2, b2) == b2);
BN_set_negative(b2, s2);
/* divide by 0 is an error */
if (BN_is_zero(b2)) {
success = 1;
goto done;
}
OPENSSL_assert(BN_div(b3, b4, b1, b2, ctx));
if (BN_is_zero(b1))
success = BN_is_zero(b3) && BN_is_zero(b4);
else if (BN_is_negative(b1))
success = (BN_is_negative(b3) != BN_is_negative(b2) || BN_is_zero(b3))
&& (BN_is_negative(b4) || BN_is_zero(b4));
else
success = (BN_is_negative(b3) == BN_is_negative(b2) || BN_is_zero(b3))
&& (!BN_is_negative(b4) || BN_is_zero(b4));
OPENSSL_assert(BN_mul(b5, b3, b2, ctx));
OPENSSL_assert(BN_add(b5, b5, b4));
success = success && BN_cmp(b5, b1) == 0;
if (!success) {
BN_print_fp(stdout, b1);
putchar('\n');
BN_print_fp(stdout, b2);
putchar('\n');
BN_print_fp(stdout, b3);
putchar('\n');
BN_print_fp(stdout, b4);
putchar('\n');
BN_print_fp(stdout, b5);
putchar('\n');
printf("%d %d %d %d %d %d %d\n", BN_is_negative(b1),
BN_is_negative(b2),
BN_is_negative(b3), BN_is_negative(b4), BN_is_zero(b4),
BN_is_negative(b3) != BN_is_negative(b2)
&& (BN_is_negative(b4) || BN_is_zero(b4)),
BN_cmp(b5, b1));
puts("----\n");
}
done:
OPENSSL_assert(success);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
BN_free(b1);
BN_free(b2);
BN_free(b3);
BN_free(b4);
BN_free(b5);
BN_CTX_free(ctx);
}

View File

@@ -0,0 +1,281 @@
{- use File::Spec::Functions;
our $ex_inc = $withargs{fuzzer_include} &&
(file_name_is_absolute($withargs{fuzzer_include}) ?
$withargs{fuzzer_include} : catdir(updir(), $withargs{fuzzer_include}));
our $ex_lib = $withargs{fuzzer_lib} &&
(file_name_is_absolute($withargs{fuzzer_lib}) ?
$withargs{fuzzer_lib} : catfile(updir(), $withargs{fuzzer_lib}));
""
-}
IF[{- !$disabled{"fuzz-afl"} || !$disabled{"fuzz-libfuzzer"} -}]
PROGRAMS{noinst}=asn1 asn1parse bignum bndiv client conf crl server smime
PROGRAMS{noinst}=punycode pem decoder hashtable acert
PROGRAMS{noinst}=v3name
PROGRAMS{noinst}=provider
IF[{- !$disabled{"cmp"} -}]
PROGRAMS{noinst}=cmp
ENDIF
IF[{- !$disabled{"cms"} -}]
PROGRAMS{noinst}=cms
ENDIF
IF[{- !$disabled{"ct"} -}]
PROGRAMS{noinst}=ct
ENDIF
IF[{- !$disabled{"ocsp"} -}]
PROGRAMS{noinst}=x509
ENDIF
IF[{- !$disabled{"quic"} -}]
PROGRAMS{noinst}=quic-client quic-srtm quic-lcidm quic-rcidm
ENDIF
IF[{- !$disabled{"dtls"} -}]
PROGRAMS{noinst}=dtlsclient dtlsserver
ENDIF
SOURCE[asn1]=asn1.c driver.c fuzz_rand.c
INCLUDE[asn1]=../include {- $ex_inc -}
DEPEND[asn1]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[asn1parse]=asn1parse.c driver.c
INCLUDE[asn1parse]=../include {- $ex_inc -}
DEPEND[asn1parse]=../libcrypto {- $ex_lib -}
SOURCE[bignum]=bignum.c driver.c
INCLUDE[bignum]=../include {- $ex_inc -}
DEPEND[bignum]=../libcrypto {- $ex_lib -}
SOURCE[bndiv]=bndiv.c driver.c
INCLUDE[bndiv]=../include {- $ex_inc -}
DEPEND[bndiv]=../libcrypto {- $ex_lib -}
SOURCE[client]=client.c driver.c fuzz_rand.c
INCLUDE[client]=../include {- $ex_inc -}
DEPEND[client]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[cmp]=cmp.c driver.c fuzz_rand.c
INCLUDE[cmp]=../include {- $ex_inc -}
DEPEND[cmp]=../libcrypto {- $ex_lib -}
SOURCE[cms]=cms.c driver.c
INCLUDE[cms]=../include {- $ex_inc -}
DEPEND[cms]=../libcrypto {- $ex_lib -}
SOURCE[conf]=conf.c driver.c
INCLUDE[conf]=../include {- $ex_inc -}
DEPEND[conf]=../libcrypto {- $ex_lib -}
SOURCE[crl]=crl.c driver.c
INCLUDE[crl]=../include {- $ex_inc -}
DEPEND[crl]=../libcrypto {- $ex_lib -}
SOURCE[ct]=ct.c driver.c
INCLUDE[ct]=../include {- $ex_inc -}
DEPEND[ct]=../libcrypto {- $ex_lib -}
SOURCE[dtlsclient]=dtlsclient.c driver.c fuzz_rand.c
INCLUDE[dtlsclient]=../include {- $ex_inc -}
DEPEND[dtlsclient]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[dtlsserver]=dtlsserver.c driver.c fuzz_rand.c
INCLUDE[dtlsserver]=../include {- $ex_inc -}
DEPEND[dtlsserver]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[pem]=pem.c driver.c
INCLUDE[pem]=../include {- $ex_inc -}
DEPEND[pem]=../libcrypto.a {- $ex_lib -}
SOURCE[decoder]=decoder.c driver.c fuzz_rand.c
INCLUDE[decoder]=../include {- $ex_inc -}
DEPEND[decoder]=../libcrypto {- $ex_lib -}
SOURCE[hashtable]=hashtable.c driver.c
INCLUDE[hashtable]=../include {- $ex_inc -}
DEPEND[hashtable]=../libcrypto {- $ex_lib -}
SOURCE[acert]=acert.c driver.c
INCLUDE[acert]=../include {- $ex_inc -}
DEPEND[acert]=../libcrypto {- $ex_lib -}
SOURCE[punycode]=punycode.c driver.c
INCLUDE[punycode]=../include {- $ex_inc -}
DEPEND[punycode]=../libcrypto.a {- $ex_lib -}
SOURCE[smime]=smime.c driver.c
INCLUDE[smime]=../include {- $ex_inc -}
DEPEND[smime]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[v3name]=v3name.c driver.c
INCLUDE[v3name]=../include {- $ex_inc -}
DEPEND[v3name]=../libcrypto.a {- $ex_lib -}
SOURCE[quic-client]=quic-client.c driver.c fuzz_rand.c
INCLUDE[quic-client]=../include {- $ex_inc -}
DEPEND[quic-client]=../libcrypto.a ../libssl.a {- $ex_lib -}
SOURCE[quic-srtm]=quic-srtm.c driver.c fuzz_rand.c
INCLUDE[quic-srtm]=../include {- $ex_inc -}
DEPEND[quic-srtm]=../libcrypto.a ../libssl.a {- $ex_lib -}
SOURCE[quic-lcidm]=quic-lcidm.c driver.c fuzz_rand.c
INCLUDE[quic-lcidm]=../include {- $ex_inc -}
DEPEND[quic-lcidm]=../libcrypto.a ../libssl.a {- $ex_lib -}
SOURCE[quic-rcidm]=quic-rcidm.c driver.c fuzz_rand.c
INCLUDE[quic-rcidm]=../include {- $ex_inc -}
DEPEND[quic-rcidm]=../libcrypto.a ../libssl.a {- $ex_lib -}
SOURCE[server]=server.c driver.c fuzz_rand.c
INCLUDE[server]=../include {- $ex_inc -}
DEPEND[server]=../libcrypto ../libssl {- $ex_lib -}
SOURCE[x509]=x509.c driver.c fuzz_rand.c
INCLUDE[x509]=../include {- $ex_inc -}
DEPEND[x509]=../libcrypto {- $ex_lib -}
SOURCE[provider]=provider.c driver.c
INCLUDE[provider]=../include {- $ex_inc -}
DEPEND[provider]=../libcrypto {- $ex_lib -}
ENDIF
IF[{- !$disabled{tests} -}]
PROGRAMS{noinst}=asn1-test asn1parse-test bignum-test bndiv-test client-test conf-test crl-test server-test smime-test
PROGRAMS{noinst}=punycode-test pem-test decoder-test hashtable-test acert-test
PROGRAMS{noinst}=v3name-test
PROGRAMS{noinst}=provider-test
IF[{- !$disabled{"cmp"} -}]
PROGRAMS{noinst}=cmp-test
ENDIF
IF[{- !$disabled{"cms"} -}]
PROGRAMS{noinst}=cms-test
ENDIF
IF[{- !$disabled{"ct"} -}]
PROGRAMS{noinst}=ct-test
ENDIF
IF[{- !$disabled{"ocsp"} -}]
PROGRAMS{noinst}=x509-test
ENDIF
IF[{- !$disabled{"quic"} -}]
PROGRAMS{noinst}=quic-client-test quic-srtm-test quic-lcidm-test
PROGRAMS{noinst}=quic-rcidm-test
ENDIF
IF[{- !$disabled{"dtls"} -}]
PROGRAMS{noinst}=dtlsclient-test dtlsserver-test
ENDIF
SOURCE[asn1-test]=asn1.c test-corpus.c fuzz_rand.c
INCLUDE[asn1-test]=../include
DEPEND[asn1-test]=../libcrypto ../libssl
SOURCE[asn1parse-test]=asn1parse.c test-corpus.c
INCLUDE[asn1parse-test]=../include
DEPEND[asn1parse-test]=../libcrypto
SOURCE[bignum-test]=bignum.c test-corpus.c
INCLUDE[bignum-test]=../include
DEPEND[bignum-test]=../libcrypto
SOURCE[bndiv-test]=bndiv.c test-corpus.c
INCLUDE[bndiv-test]=../include
DEPEND[bndiv-test]=../libcrypto
SOURCE[client-test]=client.c test-corpus.c fuzz_rand.c
INCLUDE[client-test]=../include
DEPEND[client-test]=../libcrypto ../libssl
SOURCE[cmp-test]=cmp.c test-corpus.c fuzz_rand.c
INCLUDE[cmp-test]=../include
DEPEND[cmp-test]=../libcrypto.a
# referring to static lib allows using non-exported functions
SOURCE[cms-test]=cms.c test-corpus.c
INCLUDE[cms-test]=../include
DEPEND[cms-test]=../libcrypto
SOURCE[conf-test]=conf.c test-corpus.c
INCLUDE[conf-test]=../include
DEPEND[conf-test]=../libcrypto
SOURCE[crl-test]=crl.c test-corpus.c
INCLUDE[crl-test]=../include
DEPEND[crl-test]=../libcrypto
SOURCE[ct-test]=ct.c test-corpus.c
INCLUDE[ct-test]=../include
DEPEND[ct-test]=../libcrypto
SOURCE[dtlsclient-test]=dtlsclient.c test-corpus.c fuzz_rand.c
INCLUDE[dtlsclient-test]=../include
DEPEND[dtlsclient-test]=../libcrypto ../libssl
SOURCE[dtlsserver-test]=dtlsserver.c test-corpus.c fuzz_rand.c
INCLUDE[dtlsserver-test]=../include
DEPEND[dtlsserver-test]=../libcrypto ../libssl
SOURCE[pem-test]=pem.c test-corpus.c
INCLUDE[pem-test]=../include
DEPEND[pem-test]=../libcrypto.a
SOURCE[decoder-test]=decoder.c test-corpus.c fuzz_rand.c
INCLUDE[decoder-test]=../include
DEPEND[decoder-test]=../libcrypto
SOURCE[hashtable-test]=hashtable.c test-corpus.c fuzz_rand.c
INCLUDE[hashtable-test]=../include
DEPEND[hashtable-test]=../libcrypto.a
SOURCE[acert-test]=acert.c test-corpus.c
INCLUDE[acert-test]=../include
DEPEND[acert-test]=../libcrypto
SOURCE[punycode-test]=punycode.c test-corpus.c
INCLUDE[punycode-test]=../include
DEPEND[punycode-test]=../libcrypto.a
SOURCE[smime-test]=smime.c test-corpus.c
INCLUDE[smime-test]=../include
DEPEND[smime-test]=../libcrypto ../libssl
SOURCE[v3name-test]=v3name.c test-corpus.c
INCLUDE[v3name-test]=../include
DEPEND[v3name-test]=../libcrypto.a
SOURCE[quic-client-test]=quic-client.c test-corpus.c fuzz_rand.c
INCLUDE[quic-client-test]=../include
DEPEND[quic-client-test]=../libcrypto.a ../libssl.a
SOURCE[quic-srtm-test]=quic-srtm.c test-corpus.c fuzz_rand.c
INCLUDE[quic-srtm-test]=../include
DEPEND[quic-srtm-test]=../libcrypto.a ../libssl.a
SOURCE[quic-lcidm-test]=quic-lcidm.c test-corpus.c fuzz_rand.c
INCLUDE[quic-lcidm-test]=../include
DEPEND[quic-lcidm-test]=../libcrypto.a ../libssl.a
SOURCE[quic-rcidm-test]=quic-rcidm.c test-corpus.c fuzz_rand.c
INCLUDE[quic-rcidm-test]=../include
DEPEND[quic-rcidm-test]=../libcrypto.a ../libssl.a
SOURCE[server-test]=server.c test-corpus.c fuzz_rand.c
INCLUDE[server-test]=../include
DEPEND[server-test]=../libcrypto ../libssl
SOURCE[x509-test]=x509.c test-corpus.c fuzz_rand.c
INCLUDE[x509-test]=../include
DEPEND[x509-test]=../libcrypto
SOURCE[provider-test]=provider.c test-corpus.c
INCLUDE[provider-test]=../include
DEPEND[provider-test]=../libcrypto
ENDIF

BIN
openssl-3.4.2/fuzz/client-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,32 @@
fuzz/client-test-bin-client.o: fuzz/client.c include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/ssl.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/comperr.h include/openssl/x509.h \
include/openssl/buffer.h include/openssl/buffererr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/pem.h include/openssl/pemerr.h include/openssl/hmac.h \
include/openssl/async.h include/openssl/asyncerr.h include/openssl/ct.h \
include/openssl/cterr.h include/openssl/sslerr.h \
include/openssl/sslerr_legacy.h include/openssl/prov_ssl.h \
include/openssl/ssl2.h include/openssl/ssl3.h include/openssl/tls1.h \
include/openssl/dtls1.h include/openssl/srtp.h include/openssl/quic.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/client-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/client-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

108
openssl-3.4.2/fuzz/client.c Normal file
View File

@@ -0,0 +1,108 @@
/*
* Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <time.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
#include <openssl/dh.h>
#include <openssl/err.h>
#include "fuzzer.h"
/* unused, to avoid warning. */
static int idx;
#define FUZZTIME 1485898104
#define TIME_IMPL(t) { if (t != NULL) *t = FUZZTIME; return FUZZTIME; }
/*
* This might not work in all cases (and definitely not on Windows
* because of the way linkers are) and callees can still get the
* current time instead of the fixed time. This will just result
* in things not being fully reproducible and have a slightly
* different coverage.
*/
#if !defined(_WIN32)
time_t time(time_t *t) TIME_IMPL(t)
#endif
int FuzzerInitialize(int *argc, char ***argv)
{
STACK_OF(SSL_COMP) *comp_methods;
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
comp_methods = SSL_COMP_get_compression_methods();
if (comp_methods != NULL)
sk_SSL_COMP_sort(comp_methods);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
SSL *client = NULL;
BIO *in;
BIO *out;
SSL_CTX *ctx;
if (len == 0)
return 0;
/* This only fuzzes the initial flow from the client so far. */
ctx = SSL_CTX_new(SSLv23_method());
if (ctx == NULL)
goto end;
client = SSL_new(ctx);
if (client == NULL)
goto end;
OPENSSL_assert(SSL_set_min_proto_version(client, 0) == 1);
OPENSSL_assert(SSL_set_cipher_list(client, "ALL:eNULL:@SECLEVEL=0") == 1);
SSL_set_tlsext_host_name(client, "localhost");
in = BIO_new(BIO_s_mem());
if (in == NULL)
goto end;
out = BIO_new(BIO_s_mem());
if (out == NULL) {
BIO_free(in);
goto end;
}
SSL_set_bio(client, in, out);
SSL_set_connect_state(client);
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
if (SSL_do_handshake(client) == 1) {
/* Keep reading application data until error or EOF. */
uint8_t tmp[1024];
for (;;) {
if (SSL_read(client, tmp, sizeof(tmp)) <= 0) {
break;
}
}
}
end:
SSL_free(client);
ERR_clear_error();
SSL_CTX_free(ctx);
return 0;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

BIN
openssl-3.4.2/fuzz/cmp-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,30 @@
fuzz/cmp-test-bin-cmp.o: fuzz/cmp.c include/openssl/bio.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/crypto.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bioerr.h include/openssl/cmp.h \
include/openssl/crmf.h include/openssl/crmferr.h \
include/openssl/x509v3.h include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/x509v3err.h include/openssl/cmperr.h \
include/openssl/cmp_util.h include/openssl/trace.h \
fuzz/../crypto/cmp/cmp_local.h include/internal/cryptlib.h \
include/internal/common.h include/internal/e_os.h \
include/internal/numbers.h include/internal/nelem.h \
include/openssl/err.h include/crypto/x509.h include/internal/refcount.h \
include/crypto/types.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/cmp-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/cmp-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

217
openssl-3.4.2/fuzz/cmp.c Normal file
View File

@@ -0,0 +1,217 @@
/*
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* Test CMP DER parsing.
*/
#include <openssl/bio.h>
#include <openssl/cmp.h>
#include "../crypto/cmp/cmp_local.h"
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
static int num_responses;
static OSSL_CMP_MSG *transfer_cb(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *req)
{
if (num_responses++ > 2)
return NULL; /* prevent loops due to repeated pollRep */
return OSSL_CMP_MSG_dup((OSSL_CMP_MSG *)
OSSL_CMP_CTX_get_transfer_cb_arg(ctx));
}
static int print_noop(const char *func, const char *file, int line,
OSSL_CMP_severity level, const char *msg)
{
return 1;
}
static int allow_unprotected(const OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *rep,
int invalid_protection, int expected_type)
{
return 1;
}
static void cmp_client_process_response(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg)
{
X509_NAME *name = X509_NAME_new();
ASN1_INTEGER *serial = ASN1_INTEGER_new();
ctx->unprotectedSend = 1; /* satisfy ossl_cmp_msg_protect() */
ctx->disableConfirm = 1; /* check just one response message */
ctx->popoMethod = OSSL_CRMF_POPO_NONE; /* satisfy ossl_cmp_certReq_new() */
ctx->oldCert = X509_new(); /* satisfy crm_new() and ossl_cmp_rr_new() */
if (!OSSL_CMP_CTX_set1_secretValue(ctx, (unsigned char *)"",
0) /* prevent too unspecific error */
|| ctx->oldCert == NULL
|| name == NULL || !X509_set_issuer_name(ctx->oldCert, name)
|| serial == NULL || !X509_set_serialNumber(ctx->oldCert, serial))
goto err;
(void)OSSL_CMP_CTX_set_transfer_cb(ctx, transfer_cb);
(void)OSSL_CMP_CTX_set_transfer_cb_arg(ctx, msg);
(void)OSSL_CMP_CTX_set_log_cb(ctx, print_noop);
num_responses = 0;
switch (msg->body != NULL ? msg->body->type : -1) {
case OSSL_CMP_PKIBODY_IP:
(void)OSSL_CMP_exec_IR_ses(ctx);
break;
case OSSL_CMP_PKIBODY_CP:
(void)OSSL_CMP_exec_CR_ses(ctx);
(void)OSSL_CMP_exec_P10CR_ses(ctx);
break;
case OSSL_CMP_PKIBODY_KUP:
(void)OSSL_CMP_exec_KUR_ses(ctx);
break;
case OSSL_CMP_PKIBODY_POLLREP:
ctx->status = OSSL_CMP_PKISTATUS_waiting;
(void)OSSL_CMP_try_certreq(ctx, OSSL_CMP_PKIBODY_CR, NULL, NULL);
break;
case OSSL_CMP_PKIBODY_RP:
(void)OSSL_CMP_exec_RR_ses(ctx);
break;
case OSSL_CMP_PKIBODY_GENP:
sk_OSSL_CMP_ITAV_pop_free(OSSL_CMP_exec_GENM_ses(ctx),
OSSL_CMP_ITAV_free);
break;
default:
(void)ossl_cmp_msg_check_update(ctx, msg, allow_unprotected, 0);
break;
}
err:
X509_NAME_free(name);
ASN1_INTEGER_free(serial);
}
static OSSL_CMP_PKISI *process_cert_request(OSSL_CMP_SRV_CTX *srv_ctx,
const OSSL_CMP_MSG *cert_req,
int certReqId,
const OSSL_CRMF_MSG *crm,
const X509_REQ *p10cr,
X509 **certOut,
STACK_OF(X509) **chainOut,
STACK_OF(X509) **caPubs)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
return NULL;
}
static OSSL_CMP_PKISI *process_rr(OSSL_CMP_SRV_CTX *srv_ctx,
const OSSL_CMP_MSG *rr,
const X509_NAME *issuer,
const ASN1_INTEGER *serial)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
return NULL;
}
static int process_genm(OSSL_CMP_SRV_CTX *srv_ctx,
const OSSL_CMP_MSG *genm,
const STACK_OF(OSSL_CMP_ITAV) *in,
STACK_OF(OSSL_CMP_ITAV) **out)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
return 0;
}
static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
const OSSL_CMP_PKISI *statusInfo,
const ASN1_INTEGER *errorCode,
const OSSL_CMP_PKIFREETEXT *errorDetails)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
}
static int process_certConf(OSSL_CMP_SRV_CTX *srv_ctx,
const OSSL_CMP_MSG *certConf, int certReqId,
const ASN1_OCTET_STRING *certHash,
const OSSL_CMP_PKISI *si)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
return 0;
}
static int process_pollReq(OSSL_CMP_SRV_CTX *srv_ctx,
const OSSL_CMP_MSG *pollReq, int certReqId,
OSSL_CMP_MSG **certReq, int64_t *check_after)
{
ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE);
return 0;
}
static int clean_transaction(ossl_unused OSSL_CMP_SRV_CTX *srv_ctx,
ossl_unused const ASN1_OCTET_STRING *id)
{
return 1;
}
static int delayed_delivery(ossl_unused OSSL_CMP_SRV_CTX *srv_ctx,
ossl_unused const OSSL_CMP_MSG *req)
{
return 0;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
OSSL_CMP_MSG *msg;
BIO *in;
if (len == 0)
return 0;
in = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
msg = d2i_OSSL_CMP_MSG_bio(in, NULL);
if (msg != NULL) {
BIO *out = BIO_new(BIO_s_null());
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new(NULL, NULL);
OSSL_CMP_CTX *client_ctx = OSSL_CMP_CTX_new(NULL, NULL);
i2d_OSSL_CMP_MSG_bio(out, msg);
ASN1_item_print(out, (ASN1_VALUE *)msg, 4,
ASN1_ITEM_rptr(OSSL_CMP_MSG), NULL);
BIO_free(out);
if (client_ctx != NULL)
cmp_client_process_response(client_ctx, msg);
if (srv_ctx != NULL
&& OSSL_CMP_CTX_set_log_cb(OSSL_CMP_SRV_CTX_get0_cmp_ctx(srv_ctx),
print_noop)
&& OSSL_CMP_SRV_CTX_init(srv_ctx, NULL, process_cert_request,
process_rr, process_genm, process_error,
process_certConf, process_pollReq)
&& OSSL_CMP_SRV_CTX_init_trans(srv_ctx, delayed_delivery,
clean_transaction))
OSSL_CMP_MSG_free(OSSL_CMP_SRV_process_request(srv_ctx, msg));
OSSL_CMP_CTX_free(client_ctx);
OSSL_CMP_SRV_CTX_free(srv_ctx);
OSSL_CMP_MSG_free(msg);
}
BIO_free(in);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

BIN
openssl-3.4.2/fuzz/cms-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
fuzz/cms-test-bin-cms.o: fuzz/cms.c include/openssl/bio.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/crypto.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bioerr.h include/openssl/cms.h \
include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/x509v3.h include/openssl/x509v3err.h \
include/openssl/cmserr.h include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/cms-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

55
openssl-3.4.2/fuzz/cms.c Normal file
View File

@@ -0,0 +1,55 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Test CMS DER parsing.
*/
#include <openssl/bio.h>
#include <openssl/cms.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
CMS_ContentInfo *cms;
BIO *in;
if (len == 0)
return 0;
in = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
cms = d2i_CMS_bio(in, NULL);
if (cms != NULL) {
BIO *out = BIO_new(BIO_s_null());
i2d_CMS_bio(out, cms);
BIO_free(out);
CMS_ContentInfo_free(cms);
}
BIO_free(in);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/conf-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,10 @@
fuzz/conf-test-bin-conf.o: fuzz/conf.c include/openssl/conf.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/bio.h include/openssl/e_os2.h include/openssl/crypto.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bioerr.h include/openssl/lhash.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/conf-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

48
openssl-3.4.2/fuzz/conf.c Normal file
View File

@@ -0,0 +1,48 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Test configuration parsing.
*/
#include <openssl/conf.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
CONF *conf;
BIO *in;
long eline;
if (len == 0)
return 0;
conf = NCONF_new(NULL);
in = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
NCONF_load_bio(conf, in, &eline);
NCONF_free(conf);
BIO_free(in);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/crl-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,22 @@
fuzz/crl-test-bin-crl.o: fuzz/crl.c include/openssl/x509.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/types.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/symhacks.h include/openssl/buffer.h \
include/openssl/crypto.h include/openssl/cryptoerr.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/ec.h \
include/openssl/ecerr.h include/openssl/rsa.h include/openssl/rsaerr.h \
include/openssl/dsa.h include/openssl/dh.h include/openssl/dherr.h \
include/openssl/dsaerr.h include/openssl/sha.h include/openssl/x509err.h \
include/openssl/x509_vfy.h include/openssl/lhash.h \
include/openssl/pkcs7.h include/openssl/pkcs7err.h \
include/openssl/http.h include/openssl/conf.h include/openssl/conferr.h \
include/openssl/conftypes.h include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/crl-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

47
openssl-3.4.2/fuzz/crl.c Normal file
View File

@@ -0,0 +1,47 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/x509.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
const unsigned char *p = buf;
unsigned char *der = NULL;
X509_CRL *crl = d2i_X509_CRL(NULL, &p, len);
if (crl != NULL) {
BIO *bio = BIO_new(BIO_s_null());
X509_CRL_print(bio, crl);
BIO_free(bio);
i2d_X509_CRL(crl, &der);
OPENSSL_free(der);
X509_CRL_free(crl);
}
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/ct-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fuzz/ct-test-bin-ct.o: fuzz/ct.c include/openssl/ct.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/x509.h include/openssl/symhacks.h \
include/openssl/buffer.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/ec.h \
include/openssl/ecerr.h include/openssl/rsa.h include/openssl/rsaerr.h \
include/openssl/dsa.h include/openssl/dh.h include/openssl/dherr.h \
include/openssl/dsaerr.h include/openssl/sha.h include/openssl/x509err.h \
include/openssl/x509_vfy.h include/openssl/lhash.h \
include/openssl/pkcs7.h include/openssl/pkcs7err.h \
include/openssl/http.h include/openssl/conf.h include/openssl/conferr.h \
include/openssl/conftypes.h include/openssl/cterr.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/ct-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

51
openssl-3.4.2/fuzz/ct.c Normal file
View File

@@ -0,0 +1,51 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Fuzz the SCT parser.
*/
#include <stdio.h>
#include <openssl/ct.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
CRYPTO_free_ex_index(0, -1);
ERR_clear_error();
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
const uint8_t **pp = &buf;
unsigned char *der = NULL;
STACK_OF(SCT) *scts = d2i_SCT_LIST(NULL, pp, len);
if (scts != NULL) {
BIO *bio = BIO_new(BIO_s_null());
SCT_LIST_print(scts, bio, 4, "\n", NULL);
BIO_free(bio);
if (i2d_SCT_LIST(scts, &der)) {
/* Silence unused result warning */
}
OPENSSL_free(der);
SCT_LIST_free(scts);
}
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/decoder-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fuzz/decoder-test-bin-decoder.o: fuzz/decoder.c include/openssl/decoder.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/macros.h include/openssl/opensslv.h \
include/openssl/decodererr.h include/openssl/symhacks.h \
include/openssl/e_os2.h include/openssl/cryptoerr_legacy.h \
include/openssl/types.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/core.h include/openssl/err.h \
include/openssl/bio.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bioerr.h \
include/openssl/lhash.h include/openssl/rand.h include/openssl/randerr.h \
include/openssl/evp.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/bnerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/decoder-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/decoder-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,96 @@
/*
* Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/decoder.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include "fuzzer.h"
static ASN1_PCTX *pctx;
int FuzzerInitialize(int *argc, char ***argv)
{
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS
| OPENSSL_INIT_ADD_ALL_CIPHERS
| OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
pctx = ASN1_PCTX_new();
ASN1_PCTX_set_flags(pctx, ASN1_PCTX_FLAGS_SHOW_ABSENT
| ASN1_PCTX_FLAGS_SHOW_SEQUENCE
| ASN1_PCTX_FLAGS_SHOW_SSOF
| ASN1_PCTX_FLAGS_SHOW_TYPE
| ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME);
ASN1_PCTX_set_str_flags(pctx, ASN1_STRFLGS_UTF8_CONVERT
| ASN1_STRFLGS_SHOW_TYPE
| ASN1_STRFLGS_DUMP_ALL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
OSSL_DECODER_CTX *dctx;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
BIO *bio;
bio = BIO_new(BIO_s_null());
dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, NULL, NULL, NULL, 0, NULL,
NULL);
if (dctx == NULL) {
return 0;
}
if (OSSL_DECODER_from_data(dctx, &buf, &len)) {
EVP_PKEY *pkey2;
EVP_PKEY_print_public(bio, pkey, 1, pctx);
EVP_PKEY_print_private(bio, pkey, 1, pctx);
EVP_PKEY_print_params(bio, pkey, 1, pctx);
pkey2 = EVP_PKEY_dup(pkey);
OPENSSL_assert(pkey2 != NULL);
EVP_PKEY_eq(pkey, pkey2);
EVP_PKEY_free(pkey2);
ctx = EVP_PKEY_CTX_new(pkey, NULL);
/*
* Param check will take too long time on large DH parameters.
* Skip it.
*/
if ((!EVP_PKEY_is_a(pkey, "DH") && !EVP_PKEY_is_a(pkey, "DHX"))
|| EVP_PKEY_get_bits(pkey) <= 2048)
EVP_PKEY_param_check(ctx);
EVP_PKEY_public_check(ctx);
/* Private and pairwise checks are unbounded, skip for large keys. */
if (EVP_PKEY_get_bits(pkey) <= 4096) {
EVP_PKEY_private_check(ctx);
EVP_PKEY_pairwise_check(ctx);
}
OPENSSL_assert(ctx != NULL);
EVP_PKEY_CTX_free(ctx);
EVP_PKEY_free(pkey);
}
OSSL_DECODER_CTX_free(dctx);
BIO_free(bio);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
ASN1_PCTX_free(pctx);
FuzzerClearRand();
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#include <openssl/opensslconf.h>
#include "fuzzer.h"
#ifndef OPENSSL_NO_FUZZ_LIBFUZZER
int LLVMFuzzerInitialize(int *argc, char ***argv);
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len);
int LLVMFuzzerInitialize(int *argc, char ***argv)
{
return FuzzerInitialize(argc, argv);
}
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
return FuzzerTestOneInput(buf, len);
}
#elif !defined(OPENSSL_NO_FUZZ_AFL)
#define BUF_SIZE 65536
int main(int argc, char** argv)
{
FuzzerInitialize(&argc, &argv);
while (__AFL_LOOP(10000)) {
uint8_t *buf = malloc(BUF_SIZE);
size_t size = read(0, buf, BUF_SIZE);
FuzzerTestOneInput(buf, size);
free(buf);
}
FuzzerCleanup();
return 0;
}
#else
#error "Unsupported fuzzer"
#endif

Binary file not shown.

View File

@@ -0,0 +1,32 @@
fuzz/dtlsclient-test-bin-dtlsclient.o: fuzz/dtlsclient.c \
include/openssl/rand.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/types.h \
include/openssl/e_os2.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/randerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/evp.h include/openssl/core.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/ssl.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/comperr.h include/openssl/x509.h \
include/openssl/buffer.h include/openssl/buffererr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/pem.h include/openssl/pemerr.h include/openssl/hmac.h \
include/openssl/async.h include/openssl/asyncerr.h include/openssl/ct.h \
include/openssl/cterr.h include/openssl/sslerr.h \
include/openssl/sslerr_legacy.h include/openssl/prov_ssl.h \
include/openssl/ssl2.h include/openssl/ssl3.h include/openssl/tls1.h \
include/openssl/dtls1.h include/openssl/srtp.h include/openssl/quic.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/dtlsclient-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/dtlsclient-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,108 @@
/*
* Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <time.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
#include <openssl/dh.h>
#include <openssl/err.h>
#include "fuzzer.h"
/* unused, to avoid warning. */
static int idx;
#define FUZZTIME 1485898104
#define TIME_IMPL(t) { if (t != NULL) *t = FUZZTIME; return FUZZTIME; }
/*
* This might not work in all cases (and definitely not on Windows
* because of the way linkers are) and callees can still get the
* current time instead of the fixed time. This will just result
* in things not being fully reproducible and have a slightly
* different coverage.
*/
#if !defined(_WIN32)
time_t time(time_t *t) TIME_IMPL(t)
#endif
int FuzzerInitialize(int *argc, char ***argv)
{
STACK_OF(SSL_COMP) *comp_methods;
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
comp_methods = SSL_COMP_get_compression_methods();
if (comp_methods != NULL)
sk_SSL_COMP_sort(comp_methods);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
SSL *client = NULL;
BIO *in;
BIO *out;
SSL_CTX *ctx;
if (len == 0)
return 0;
/* This only fuzzes the initial flow from the client so far. */
ctx = SSL_CTX_new(DTLS_client_method());
if (ctx == NULL)
goto end;
client = SSL_new(ctx);
if (client == NULL)
goto end;
OPENSSL_assert(SSL_set_min_proto_version(client, 0) == 1);
OPENSSL_assert(SSL_set_cipher_list(client, "ALL:eNULL:@SECLEVEL=0") == 1);
SSL_set_tlsext_host_name(client, "localhost");
in = BIO_new(BIO_s_mem());
if (in == NULL)
goto end;
out = BIO_new(BIO_s_mem());
if (out == NULL) {
BIO_free(in);
goto end;
}
SSL_set_bio(client, in, out);
SSL_set_connect_state(client);
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
if (SSL_do_handshake(client) == 1) {
/* Keep reading application data until error or EOF. */
uint8_t tmp[1024];
for (;;) {
if (SSL_read(client, tmp, sizeof(tmp)) <= 0) {
break;
}
}
}
end:
SSL_free(client);
ERR_clear_error();
SSL_CTX_free(ctx);
return 0;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

Binary file not shown.

View File

@@ -0,0 +1,32 @@
fuzz/dtlsserver-test-bin-dtlsserver.o: fuzz/dtlsserver.c \
include/openssl/rand.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/types.h \
include/openssl/e_os2.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/randerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/evp.h include/openssl/core.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/ssl.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/comperr.h include/openssl/x509.h \
include/openssl/buffer.h include/openssl/buffererr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/pem.h include/openssl/pemerr.h include/openssl/hmac.h \
include/openssl/async.h include/openssl/asyncerr.h include/openssl/ct.h \
include/openssl/cterr.h include/openssl/sslerr.h \
include/openssl/sslerr_legacy.h include/openssl/prov_ssl.h \
include/openssl/ssl2.h include/openssl/ssl3.h include/openssl/tls1.h \
include/openssl/dtls1.h include/openssl/srtp.h include/openssl/quic.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,16 @@
fuzz/dtlsserver-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/dtlsserver-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,726 @@
/*
* Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/* Shamelessly copied from BoringSSL and converted to C. */
/* Test first part of SSL server handshake. */
/* We need to use some deprecated APIs */
#define OPENSSL_SUPPRESS_DEPRECATED
#include <time.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
#include <openssl/dh.h>
#include <openssl/err.h>
#include "fuzzer.h"
/*
-----BEGIN CERTIFICATE-----
MIIDozCCAougAwIBAgIUSKwQD1qRtS+lridawmaYK6cej2kwDQYJKoZIhvcNAQEL
BQAwYTELMAkGA1UEBhMCbm8xCzAJBgNVBAgMAm5vMQswCQYDVQQHDAJubzELMAkG
A1UECgwCbm8xCzAJBgNVBAsMAm5vMQswCQYDVQQDDAJubzERMA8GCSqGSIb3DQEJ
ARYCbm8wHhcNMjQwMjI4MTkzNzEwWhcNMjUwMjI3MTkzNzEwWjBhMQswCQYDVQQG
EwJubzELMAkGA1UECAwCbm8xCzAJBgNVBAcMAm5vMQswCQYDVQQKDAJubzELMAkG
A1UECwwCbm8xCzAJBgNVBAMMAm5vMREwDwYJKoZIhvcNAQkBFgJubzCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBALWZB9Mtas0V9Sya+UhEabwzs3Eol+/M
hwUFWIFrr8tVyYvg8Xs/KnC2VaEpnEltBNLaOADZGUuXzz5Ebccb2i18ghvMDX5o
OwAAidL3tv6lh8/Vuj8tpLA53SDR5VTQcxitipsccjacHDftTqDA7+94STT8QSHt
Wu5FmXPKvJLmPuKQJMbOJSGDJLvdT/0dyM9aU3xKw64iv7S3laERWyW4/OemMQXs
i+kbanpVNJVmqTtS+q/FyYvvr1NpX0Oc/A5H2HYQ6f6P3nvJ22IOXoIcNjI1FmKb
X3NJHetHXtyZKXcfpizljsNvbffsL6twxjjCR3JdUqP1xECeuoLBMzkCAwEAAaNT
MFEwHQYDVR0OBBYEFKZ2b9IJ3YWCYyMkROjtjF7CxsfaMB8GA1UdIwQYMBaAFKZ2
b9IJ3YWCYyMkROjtjF7CxsfaMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
BQADggEBAGJoHDTsAiuRtACTGiGz/oyNZfH/OUJaijUMaLbHd/JG2L6gtpACYY2b
AoLkIcCl38nsLYMLZ32Bbc5jnP/Qy3d2HKsTJ5It4qxDgtbtpU8e5MhEeJoeMHOC
fizbcWc7W7m2SLfpeQJWMgu2Da0HYEDS/xzLn7pxQgZpOrMQ7Ihi1jwXfKFqIIal
g6SijRGXh7onEAxEmKLkpVQRq633BYPV6odxtXDhxyJKyGjSJsQoKv9oCF2kAdAi
CvvatqRWRwgIeln1Sw9Ee6cTYZCG2U+/Uf+Ls7fjN8trb/Shmxo8do/npBnz8j+1
a2vbz3gpOsl87U0c01JCl9SZXDSO09w=
-----END CERTIFICATE-----
*/
static const uint8_t RSACertificatePEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49,
0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x44,
0x6f, 0x7a, 0x43, 0x43, 0x41, 0x6f, 0x75, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x55,
0x53, 0x4b, 0x77, 0x51, 0x44, 0x31, 0x71, 0x52, 0x74, 0x53, 0x2b, 0x6c, 0x72, 0x69, 0x64, 0x61,
0x77, 0x6d, 0x61, 0x59, 0x4b, 0x36, 0x63, 0x65, 0x6a, 0x32, 0x6b, 0x77, 0x44, 0x51, 0x59, 0x4a,
0x4b, 0x6f, 0x5a, 0x49, 0x68, 0x76, 0x63, 0x4e, 0x41, 0x51, 0x45, 0x4c, 0x0a, 0x42, 0x51, 0x41,
0x77, 0x59, 0x54, 0x45, 0x4c, 0x4d, 0x41, 0x6b, 0x47, 0x41, 0x31, 0x55, 0x45, 0x42, 0x68, 0x4d,
0x43, 0x62, 0x6d, 0x38, 0x78, 0x43, 0x7a, 0x41, 0x4a, 0x42, 0x67, 0x4e, 0x56, 0x42, 0x41, 0x67,
0x4d, 0x41, 0x6d, 0x35, 0x76, 0x4d, 0x51, 0x73, 0x77, 0x43, 0x51, 0x59, 0x44, 0x56, 0x51, 0x51,
0x48, 0x44, 0x41, 0x4a, 0x75, 0x62, 0x7a, 0x45, 0x4c, 0x4d, 0x41, 0x6b, 0x47, 0x0a, 0x41, 0x31,
0x55, 0x45, 0x43, 0x67, 0x77, 0x43, 0x62, 0x6d, 0x38, 0x78, 0x43, 0x7a, 0x41, 0x4a, 0x42, 0x67,
0x4e, 0x56, 0x42, 0x41, 0x73, 0x4d, 0x41, 0x6d, 0x35, 0x76, 0x4d, 0x51, 0x73, 0x77, 0x43, 0x51,
0x59, 0x44, 0x56, 0x51, 0x51, 0x44, 0x44, 0x41, 0x4a, 0x75, 0x62, 0x7a, 0x45, 0x52, 0x4d, 0x41,
0x38, 0x47, 0x43, 0x53, 0x71, 0x47, 0x53, 0x49, 0x62, 0x33, 0x44, 0x51, 0x45, 0x4a, 0x0a, 0x41,
0x52, 0x59, 0x43, 0x62, 0x6d, 0x38, 0x77, 0x48, 0x68, 0x63, 0x4e, 0x4d, 0x6a, 0x51, 0x77, 0x4d,
0x6a, 0x49, 0x34, 0x4d, 0x54, 0x6b, 0x7a, 0x4e, 0x7a, 0x45, 0x77, 0x57, 0x68, 0x63, 0x4e, 0x4d,
0x6a, 0x55, 0x77, 0x4d, 0x6a, 0x49, 0x33, 0x4d, 0x54, 0x6b, 0x7a, 0x4e, 0x7a, 0x45, 0x77, 0x57,
0x6a, 0x42, 0x68, 0x4d, 0x51, 0x73, 0x77, 0x43, 0x51, 0x59, 0x44, 0x56, 0x51, 0x51, 0x47, 0x0a,
0x45, 0x77, 0x4a, 0x75, 0x62, 0x7a, 0x45, 0x4c, 0x4d, 0x41, 0x6b, 0x47, 0x41, 0x31, 0x55, 0x45,
0x43, 0x41, 0x77, 0x43, 0x62, 0x6d, 0x38, 0x78, 0x43, 0x7a, 0x41, 0x4a, 0x42, 0x67, 0x4e, 0x56,
0x42, 0x41, 0x63, 0x4d, 0x41, 0x6d, 0x35, 0x76, 0x4d, 0x51, 0x73, 0x77, 0x43, 0x51, 0x59, 0x44,
0x56, 0x51, 0x51, 0x4b, 0x44, 0x41, 0x4a, 0x75, 0x62, 0x7a, 0x45, 0x4c, 0x4d, 0x41, 0x6b, 0x47,
0x0a, 0x41, 0x31, 0x55, 0x45, 0x43, 0x77, 0x77, 0x43, 0x62, 0x6d, 0x38, 0x78, 0x43, 0x7a, 0x41,
0x4a, 0x42, 0x67, 0x4e, 0x56, 0x42, 0x41, 0x4d, 0x4d, 0x41, 0x6d, 0x35, 0x76, 0x4d, 0x52, 0x45,
0x77, 0x44, 0x77, 0x59, 0x4a, 0x4b, 0x6f, 0x5a, 0x49, 0x68, 0x76, 0x63, 0x4e, 0x41, 0x51, 0x6b,
0x42, 0x46, 0x67, 0x4a, 0x75, 0x62, 0x7a, 0x43, 0x43, 0x41, 0x53, 0x49, 0x77, 0x44, 0x51, 0x59,
0x4a, 0x0a, 0x4b, 0x6f, 0x5a, 0x49, 0x68, 0x76, 0x63, 0x4e, 0x41, 0x51, 0x45, 0x42, 0x42, 0x51,
0x41, 0x44, 0x67, 0x67, 0x45, 0x50, 0x41, 0x44, 0x43, 0x43, 0x41, 0x51, 0x6f, 0x43, 0x67, 0x67,
0x45, 0x42, 0x41, 0x4c, 0x57, 0x5a, 0x42, 0x39, 0x4d, 0x74, 0x61, 0x73, 0x30, 0x56, 0x39, 0x53,
0x79, 0x61, 0x2b, 0x55, 0x68, 0x45, 0x61, 0x62, 0x77, 0x7a, 0x73, 0x33, 0x45, 0x6f, 0x6c, 0x2b,
0x2f, 0x4d, 0x0a, 0x68, 0x77, 0x55, 0x46, 0x57, 0x49, 0x46, 0x72, 0x72, 0x38, 0x74, 0x56, 0x79,
0x59, 0x76, 0x67, 0x38, 0x58, 0x73, 0x2f, 0x4b, 0x6e, 0x43, 0x32, 0x56, 0x61, 0x45, 0x70, 0x6e,
0x45, 0x6c, 0x74, 0x42, 0x4e, 0x4c, 0x61, 0x4f, 0x41, 0x44, 0x5a, 0x47, 0x55, 0x75, 0x58, 0x7a,
0x7a, 0x35, 0x45, 0x62, 0x63, 0x63, 0x62, 0x32, 0x69, 0x31, 0x38, 0x67, 0x68, 0x76, 0x4d, 0x44,
0x58, 0x35, 0x6f, 0x0a, 0x4f, 0x77, 0x41, 0x41, 0x69, 0x64, 0x4c, 0x33, 0x74, 0x76, 0x36, 0x6c,
0x68, 0x38, 0x2f, 0x56, 0x75, 0x6a, 0x38, 0x74, 0x70, 0x4c, 0x41, 0x35, 0x33, 0x53, 0x44, 0x52,
0x35, 0x56, 0x54, 0x51, 0x63, 0x78, 0x69, 0x74, 0x69, 0x70, 0x73, 0x63, 0x63, 0x6a, 0x61, 0x63,
0x48, 0x44, 0x66, 0x74, 0x54, 0x71, 0x44, 0x41, 0x37, 0x2b, 0x39, 0x34, 0x53, 0x54, 0x54, 0x38,
0x51, 0x53, 0x48, 0x74, 0x0a, 0x57, 0x75, 0x35, 0x46, 0x6d, 0x58, 0x50, 0x4b, 0x76, 0x4a, 0x4c,
0x6d, 0x50, 0x75, 0x4b, 0x51, 0x4a, 0x4d, 0x62, 0x4f, 0x4a, 0x53, 0x47, 0x44, 0x4a, 0x4c, 0x76,
0x64, 0x54, 0x2f, 0x30, 0x64, 0x79, 0x4d, 0x39, 0x61, 0x55, 0x33, 0x78, 0x4b, 0x77, 0x36, 0x34,
0x69, 0x76, 0x37, 0x53, 0x33, 0x6c, 0x61, 0x45, 0x52, 0x57, 0x79, 0x57, 0x34, 0x2f, 0x4f, 0x65,
0x6d, 0x4d, 0x51, 0x58, 0x73, 0x0a, 0x69, 0x2b, 0x6b, 0x62, 0x61, 0x6e, 0x70, 0x56, 0x4e, 0x4a,
0x56, 0x6d, 0x71, 0x54, 0x74, 0x53, 0x2b, 0x71, 0x2f, 0x46, 0x79, 0x59, 0x76, 0x76, 0x72, 0x31,
0x4e, 0x70, 0x58, 0x30, 0x4f, 0x63, 0x2f, 0x41, 0x35, 0x48, 0x32, 0x48, 0x59, 0x51, 0x36, 0x66,
0x36, 0x50, 0x33, 0x6e, 0x76, 0x4a, 0x32, 0x32, 0x49, 0x4f, 0x58, 0x6f, 0x49, 0x63, 0x4e, 0x6a,
0x49, 0x31, 0x46, 0x6d, 0x4b, 0x62, 0x0a, 0x58, 0x33, 0x4e, 0x4a, 0x48, 0x65, 0x74, 0x48, 0x58,
0x74, 0x79, 0x5a, 0x4b, 0x58, 0x63, 0x66, 0x70, 0x69, 0x7a, 0x6c, 0x6a, 0x73, 0x4e, 0x76, 0x62,
0x66, 0x66, 0x73, 0x4c, 0x36, 0x74, 0x77, 0x78, 0x6a, 0x6a, 0x43, 0x52, 0x33, 0x4a, 0x64, 0x55,
0x71, 0x50, 0x31, 0x78, 0x45, 0x43, 0x65, 0x75, 0x6f, 0x4c, 0x42, 0x4d, 0x7a, 0x6b, 0x43, 0x41,
0x77, 0x45, 0x41, 0x41, 0x61, 0x4e, 0x54, 0x0a, 0x4d, 0x46, 0x45, 0x77, 0x48, 0x51, 0x59, 0x44,
0x56, 0x52, 0x30, 0x4f, 0x42, 0x42, 0x59, 0x45, 0x46, 0x4b, 0x5a, 0x32, 0x62, 0x39, 0x49, 0x4a,
0x33, 0x59, 0x57, 0x43, 0x59, 0x79, 0x4d, 0x6b, 0x52, 0x4f, 0x6a, 0x74, 0x6a, 0x46, 0x37, 0x43,
0x78, 0x73, 0x66, 0x61, 0x4d, 0x42, 0x38, 0x47, 0x41, 0x31, 0x55, 0x64, 0x49, 0x77, 0x51, 0x59,
0x4d, 0x42, 0x61, 0x41, 0x46, 0x4b, 0x5a, 0x32, 0x0a, 0x62, 0x39, 0x49, 0x4a, 0x33, 0x59, 0x57,
0x43, 0x59, 0x79, 0x4d, 0x6b, 0x52, 0x4f, 0x6a, 0x74, 0x6a, 0x46, 0x37, 0x43, 0x78, 0x73, 0x66,
0x61, 0x4d, 0x41, 0x38, 0x47, 0x41, 0x31, 0x55, 0x64, 0x45, 0x77, 0x45, 0x42, 0x2f, 0x77, 0x51,
0x46, 0x4d, 0x41, 0x4d, 0x42, 0x41, 0x66, 0x38, 0x77, 0x44, 0x51, 0x59, 0x4a, 0x4b, 0x6f, 0x5a,
0x49, 0x68, 0x76, 0x63, 0x4e, 0x41, 0x51, 0x45, 0x4c, 0x0a, 0x42, 0x51, 0x41, 0x44, 0x67, 0x67,
0x45, 0x42, 0x41, 0x47, 0x4a, 0x6f, 0x48, 0x44, 0x54, 0x73, 0x41, 0x69, 0x75, 0x52, 0x74, 0x41,
0x43, 0x54, 0x47, 0x69, 0x47, 0x7a, 0x2f, 0x6f, 0x79, 0x4e, 0x5a, 0x66, 0x48, 0x2f, 0x4f, 0x55,
0x4a, 0x61, 0x69, 0x6a, 0x55, 0x4d, 0x61, 0x4c, 0x62, 0x48, 0x64, 0x2f, 0x4a, 0x47, 0x32, 0x4c,
0x36, 0x67, 0x74, 0x70, 0x41, 0x43, 0x59, 0x59, 0x32, 0x62, 0x0a, 0x41, 0x6f, 0x4c, 0x6b, 0x49,
0x63, 0x43, 0x6c, 0x33, 0x38, 0x6e, 0x73, 0x4c, 0x59, 0x4d, 0x4c, 0x5a, 0x33, 0x32, 0x42, 0x62,
0x63, 0x35, 0x6a, 0x6e, 0x50, 0x2f, 0x51, 0x79, 0x33, 0x64, 0x32, 0x48, 0x4b, 0x73, 0x54, 0x4a,
0x35, 0x49, 0x74, 0x34, 0x71, 0x78, 0x44, 0x67, 0x74, 0x62, 0x74, 0x70, 0x55, 0x38, 0x65, 0x35,
0x4d, 0x68, 0x45, 0x65, 0x4a, 0x6f, 0x65, 0x4d, 0x48, 0x4f, 0x43, 0x0a, 0x66, 0x69, 0x7a, 0x62,
0x63, 0x57, 0x63, 0x37, 0x57, 0x37, 0x6d, 0x32, 0x53, 0x4c, 0x66, 0x70, 0x65, 0x51, 0x4a, 0x57,
0x4d, 0x67, 0x75, 0x32, 0x44, 0x61, 0x30, 0x48, 0x59, 0x45, 0x44, 0x53, 0x2f, 0x78, 0x7a, 0x4c,
0x6e, 0x37, 0x70, 0x78, 0x51, 0x67, 0x5a, 0x70, 0x4f, 0x72, 0x4d, 0x51, 0x37, 0x49, 0x68, 0x69,
0x31, 0x6a, 0x77, 0x58, 0x66, 0x4b, 0x46, 0x71, 0x49, 0x49, 0x61, 0x6c, 0x0a, 0x67, 0x36, 0x53,
0x69, 0x6a, 0x52, 0x47, 0x58, 0x68, 0x37, 0x6f, 0x6e, 0x45, 0x41, 0x78, 0x45, 0x6d, 0x4b, 0x4c,
0x6b, 0x70, 0x56, 0x51, 0x52, 0x71, 0x36, 0x33, 0x33, 0x42, 0x59, 0x50, 0x56, 0x36, 0x6f, 0x64,
0x78, 0x74, 0x58, 0x44, 0x68, 0x78, 0x79, 0x4a, 0x4b, 0x79, 0x47, 0x6a, 0x53, 0x4a, 0x73, 0x51,
0x6f, 0x4b, 0x76, 0x39, 0x6f, 0x43, 0x46, 0x32, 0x6b, 0x41, 0x64, 0x41, 0x69, 0x0a, 0x43, 0x76,
0x76, 0x61, 0x74, 0x71, 0x52, 0x57, 0x52, 0x77, 0x67, 0x49, 0x65, 0x6c, 0x6e, 0x31, 0x53, 0x77,
0x39, 0x45, 0x65, 0x36, 0x63, 0x54, 0x59, 0x5a, 0x43, 0x47, 0x32, 0x55, 0x2b, 0x2f, 0x55, 0x66,
0x2b, 0x4c, 0x73, 0x37, 0x66, 0x6a, 0x4e, 0x38, 0x74, 0x72, 0x62, 0x2f, 0x53, 0x68, 0x6d, 0x78,
0x6f, 0x38, 0x64, 0x6f, 0x2f, 0x6e, 0x70, 0x42, 0x6e, 0x7a, 0x38, 0x6a, 0x2b, 0x31, 0x0a, 0x61,
0x32, 0x76, 0x62, 0x7a, 0x33, 0x67, 0x70, 0x4f, 0x73, 0x6c, 0x38, 0x37, 0x55, 0x30, 0x63, 0x30,
0x31, 0x4a, 0x43, 0x6c, 0x39, 0x53, 0x5a, 0x58, 0x44, 0x53, 0x4f, 0x30, 0x39, 0x77, 0x3d, 0x0a,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49,
0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a,
};
#ifndef OPENSSL_NO_DEPRECATED_3_0
/*
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC1mQfTLWrNFfUs
mvlIRGm8M7NxKJfvzIcFBViBa6/LVcmL4PF7PypwtlWhKZxJbQTS2jgA2RlLl88+
RG3HG9otfIIbzA1+aDsAAInS97b+pYfP1bo/LaSwOd0g0eVU0HMYrYqbHHI2nBw3
7U6gwO/veEk0/EEh7VruRZlzyryS5j7ikCTGziUhgyS73U/9HcjPWlN8SsOuIr+0
t5WhEVsluPznpjEF7IvpG2p6VTSVZqk7UvqvxcmL769TaV9DnPwOR9h2EOn+j957
ydtiDl6CHDYyNRZim19zSR3rR17cmSl3H6Ys5Y7Db2337C+rcMY4wkdyXVKj9cRA
nrqCwTM5AgMBAAECggEAFOD+XFJZeDDxGmrLBHsRKRlMpVMEfQan83TU4zRtZtR7
MsDvIrt1drYQDFKLbInDRzbdv4M2fFF8+2zErmLOZ/JrxyRj3MfBGNP3BLGEcay4
e7XYDxGBYN2WRgK7+k9pHEo/qGvR2eOC/w8ivirQq1jKGfRyzKLMlJ6d8Qk7OyxZ
n0u3v2EJ9CWoNDgUH4exCil/Oe4h5WA59xT5NAkx4RUojsJiExWZpzT/VX1d21mN
WMb5EO8eyi6FyZlAcb9MID0kMF6Q3hUv+jTw+X9yig+3B9bg2Z0I+IKHl9InShkC
ndYn4ad0zd/ggMVkloomh4uaSqZxUi3ywtszZkRbzQKBgQD7Pvx1ErKm5lZDAS2b
b4rltzqJRUEKyEqjqzPzgasOa0jWEq/fxuGc/bixg/EBaQ8yyTGYdIYyr7DKYYjC
0AGVnBCh0+TFUDB1kfwkbef2b8yufQ/vJwcOJ+5kBXQZx8+L8U9iWKANXxkEeCX2
iWPZPz52pTTYlf90PLzEW6QyDwKBgQC5CKyfUwx3Ba2iXtfIreyPqDobbybyTEYk
ayA2oElSdejgVkWwJ+q77gwrnF5Pe9zbpUBoc7VJjrRhUojI7LOySyto3WYYoczX
LprzPnj2yEVeV2lrTS6lKNpdraO8QZcSD7mUUmiNRZnoPK16Mm9qjkk29HnY7Msq
pkiOg4huNwKBgQCkh2HBtOXjH/GbXVklcc0Ok4e0vvJSAknGlmWl7+M5xQ3kikY8
D7xNF2XscY/QsaDvTAu7X4tGBAGM9oQdtyNietn1b5JfmByz0U7B+Gsv2ZS7K1DU
9sTLA2E8hMm73DpQ1Ux8BbeCKiVy5M9PfDcz3BOmlJdfwhKQZvniyHRlBwKBgQCH
/sAhOcDnmdzMgjjG3k4IJ/TNRRyy6SyEh9fdTmGVoePPPplpp2z3Qzbetsb6VGc3
aHW2T5Tmw2QAQ9EVHCPW3zjAkjj/0avkW/S24yu09e1GMajhnJC0Axq7z2uQagTG
2ZfkU81UR9uevTojnf4Vqw5UvcrwjNmmNyEM3c/gcQKBgHa2dT5svzM1jReiO3Vt
dAUDztGKUE3clPV35L2xmJeJDXPOqCL3qoZ9A6hHmDw6gmg82gQDQeJbL/+jKkon
e6atH/Dfr+M4nPft9Lt4fOAWOQ3tDsDuCkOMjSTn8cLMZLGcwT2H1H2vBocM+UTd
hljAVnB9v6NMfcRERTx10SUc
-----END PRIVATE KEY-----
*/
static const uint8_t RSAPrivateKeyPEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41,
0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x45,
0x76, 0x67, 0x49, 0x42, 0x41, 0x44, 0x41, 0x4e, 0x42, 0x67, 0x6b, 0x71, 0x68, 0x6b, 0x69, 0x47,
0x39, 0x77, 0x30, 0x42, 0x41, 0x51, 0x45, 0x46, 0x41, 0x41, 0x53, 0x43, 0x42, 0x4b, 0x67, 0x77,
0x67, 0x67, 0x53, 0x6b, 0x41, 0x67, 0x45, 0x41, 0x41, 0x6f, 0x49, 0x42, 0x41, 0x51, 0x43, 0x31,
0x6d, 0x51, 0x66, 0x54, 0x4c, 0x57, 0x72, 0x4e, 0x46, 0x66, 0x55, 0x73, 0x0a, 0x6d, 0x76, 0x6c,
0x49, 0x52, 0x47, 0x6d, 0x38, 0x4d, 0x37, 0x4e, 0x78, 0x4b, 0x4a, 0x66, 0x76, 0x7a, 0x49, 0x63,
0x46, 0x42, 0x56, 0x69, 0x42, 0x61, 0x36, 0x2f, 0x4c, 0x56, 0x63, 0x6d, 0x4c, 0x34, 0x50, 0x46,
0x37, 0x50, 0x79, 0x70, 0x77, 0x74, 0x6c, 0x57, 0x68, 0x4b, 0x5a, 0x78, 0x4a, 0x62, 0x51, 0x54,
0x53, 0x32, 0x6a, 0x67, 0x41, 0x32, 0x52, 0x6c, 0x4c, 0x6c, 0x38, 0x38, 0x2b, 0x0a, 0x52, 0x47,
0x33, 0x48, 0x47, 0x39, 0x6f, 0x74, 0x66, 0x49, 0x49, 0x62, 0x7a, 0x41, 0x31, 0x2b, 0x61, 0x44,
0x73, 0x41, 0x41, 0x49, 0x6e, 0x53, 0x39, 0x37, 0x62, 0x2b, 0x70, 0x59, 0x66, 0x50, 0x31, 0x62,
0x6f, 0x2f, 0x4c, 0x61, 0x53, 0x77, 0x4f, 0x64, 0x30, 0x67, 0x30, 0x65, 0x56, 0x55, 0x30, 0x48,
0x4d, 0x59, 0x72, 0x59, 0x71, 0x62, 0x48, 0x48, 0x49, 0x32, 0x6e, 0x42, 0x77, 0x33, 0x0a, 0x37,
0x55, 0x36, 0x67, 0x77, 0x4f, 0x2f, 0x76, 0x65, 0x45, 0x6b, 0x30, 0x2f, 0x45, 0x45, 0x68, 0x37,
0x56, 0x72, 0x75, 0x52, 0x5a, 0x6c, 0x7a, 0x79, 0x72, 0x79, 0x53, 0x35, 0x6a, 0x37, 0x69, 0x6b,
0x43, 0x54, 0x47, 0x7a, 0x69, 0x55, 0x68, 0x67, 0x79, 0x53, 0x37, 0x33, 0x55, 0x2f, 0x39, 0x48,
0x63, 0x6a, 0x50, 0x57, 0x6c, 0x4e, 0x38, 0x53, 0x73, 0x4f, 0x75, 0x49, 0x72, 0x2b, 0x30, 0x0a,
0x74, 0x35, 0x57, 0x68, 0x45, 0x56, 0x73, 0x6c, 0x75, 0x50, 0x7a, 0x6e, 0x70, 0x6a, 0x45, 0x46,
0x37, 0x49, 0x76, 0x70, 0x47, 0x32, 0x70, 0x36, 0x56, 0x54, 0x53, 0x56, 0x5a, 0x71, 0x6b, 0x37,
0x55, 0x76, 0x71, 0x76, 0x78, 0x63, 0x6d, 0x4c, 0x37, 0x36, 0x39, 0x54, 0x61, 0x56, 0x39, 0x44,
0x6e, 0x50, 0x77, 0x4f, 0x52, 0x39, 0x68, 0x32, 0x45, 0x4f, 0x6e, 0x2b, 0x6a, 0x39, 0x35, 0x37,
0x0a, 0x79, 0x64, 0x74, 0x69, 0x44, 0x6c, 0x36, 0x43, 0x48, 0x44, 0x59, 0x79, 0x4e, 0x52, 0x5a,
0x69, 0x6d, 0x31, 0x39, 0x7a, 0x53, 0x52, 0x33, 0x72, 0x52, 0x31, 0x37, 0x63, 0x6d, 0x53, 0x6c,
0x33, 0x48, 0x36, 0x59, 0x73, 0x35, 0x59, 0x37, 0x44, 0x62, 0x32, 0x33, 0x33, 0x37, 0x43, 0x2b,
0x72, 0x63, 0x4d, 0x59, 0x34, 0x77, 0x6b, 0x64, 0x79, 0x58, 0x56, 0x4b, 0x6a, 0x39, 0x63, 0x52,
0x41, 0x0a, 0x6e, 0x72, 0x71, 0x43, 0x77, 0x54, 0x4d, 0x35, 0x41, 0x67, 0x4d, 0x42, 0x41, 0x41,
0x45, 0x43, 0x67, 0x67, 0x45, 0x41, 0x46, 0x4f, 0x44, 0x2b, 0x58, 0x46, 0x4a, 0x5a, 0x65, 0x44,
0x44, 0x78, 0x47, 0x6d, 0x72, 0x4c, 0x42, 0x48, 0x73, 0x52, 0x4b, 0x52, 0x6c, 0x4d, 0x70, 0x56,
0x4d, 0x45, 0x66, 0x51, 0x61, 0x6e, 0x38, 0x33, 0x54, 0x55, 0x34, 0x7a, 0x52, 0x74, 0x5a, 0x74,
0x52, 0x37, 0x0a, 0x4d, 0x73, 0x44, 0x76, 0x49, 0x72, 0x74, 0x31, 0x64, 0x72, 0x59, 0x51, 0x44,
0x46, 0x4b, 0x4c, 0x62, 0x49, 0x6e, 0x44, 0x52, 0x7a, 0x62, 0x64, 0x76, 0x34, 0x4d, 0x32, 0x66,
0x46, 0x46, 0x38, 0x2b, 0x32, 0x7a, 0x45, 0x72, 0x6d, 0x4c, 0x4f, 0x5a, 0x2f, 0x4a, 0x72, 0x78,
0x79, 0x52, 0x6a, 0x33, 0x4d, 0x66, 0x42, 0x47, 0x4e, 0x50, 0x33, 0x42, 0x4c, 0x47, 0x45, 0x63,
0x61, 0x79, 0x34, 0x0a, 0x65, 0x37, 0x58, 0x59, 0x44, 0x78, 0x47, 0x42, 0x59, 0x4e, 0x32, 0x57,
0x52, 0x67, 0x4b, 0x37, 0x2b, 0x6b, 0x39, 0x70, 0x48, 0x45, 0x6f, 0x2f, 0x71, 0x47, 0x76, 0x52,
0x32, 0x65, 0x4f, 0x43, 0x2f, 0x77, 0x38, 0x69, 0x76, 0x69, 0x72, 0x51, 0x71, 0x31, 0x6a, 0x4b,
0x47, 0x66, 0x52, 0x79, 0x7a, 0x4b, 0x4c, 0x4d, 0x6c, 0x4a, 0x36, 0x64, 0x38, 0x51, 0x6b, 0x37,
0x4f, 0x79, 0x78, 0x5a, 0x0a, 0x6e, 0x30, 0x75, 0x33, 0x76, 0x32, 0x45, 0x4a, 0x39, 0x43, 0x57,
0x6f, 0x4e, 0x44, 0x67, 0x55, 0x48, 0x34, 0x65, 0x78, 0x43, 0x69, 0x6c, 0x2f, 0x4f, 0x65, 0x34,
0x68, 0x35, 0x57, 0x41, 0x35, 0x39, 0x78, 0x54, 0x35, 0x4e, 0x41, 0x6b, 0x78, 0x34, 0x52, 0x55,
0x6f, 0x6a, 0x73, 0x4a, 0x69, 0x45, 0x78, 0x57, 0x5a, 0x70, 0x7a, 0x54, 0x2f, 0x56, 0x58, 0x31,
0x64, 0x32, 0x31, 0x6d, 0x4e, 0x0a, 0x57, 0x4d, 0x62, 0x35, 0x45, 0x4f, 0x38, 0x65, 0x79, 0x69,
0x36, 0x46, 0x79, 0x5a, 0x6c, 0x41, 0x63, 0x62, 0x39, 0x4d, 0x49, 0x44, 0x30, 0x6b, 0x4d, 0x46,
0x36, 0x51, 0x33, 0x68, 0x55, 0x76, 0x2b, 0x6a, 0x54, 0x77, 0x2b, 0x58, 0x39, 0x79, 0x69, 0x67,
0x2b, 0x33, 0x42, 0x39, 0x62, 0x67, 0x32, 0x5a, 0x30, 0x49, 0x2b, 0x49, 0x4b, 0x48, 0x6c, 0x39,
0x49, 0x6e, 0x53, 0x68, 0x6b, 0x43, 0x0a, 0x6e, 0x64, 0x59, 0x6e, 0x34, 0x61, 0x64, 0x30, 0x7a,
0x64, 0x2f, 0x67, 0x67, 0x4d, 0x56, 0x6b, 0x6c, 0x6f, 0x6f, 0x6d, 0x68, 0x34, 0x75, 0x61, 0x53,
0x71, 0x5a, 0x78, 0x55, 0x69, 0x33, 0x79, 0x77, 0x74, 0x73, 0x7a, 0x5a, 0x6b, 0x52, 0x62, 0x7a,
0x51, 0x4b, 0x42, 0x67, 0x51, 0x44, 0x37, 0x50, 0x76, 0x78, 0x31, 0x45, 0x72, 0x4b, 0x6d, 0x35,
0x6c, 0x5a, 0x44, 0x41, 0x53, 0x32, 0x62, 0x0a, 0x62, 0x34, 0x72, 0x6c, 0x74, 0x7a, 0x71, 0x4a,
0x52, 0x55, 0x45, 0x4b, 0x79, 0x45, 0x71, 0x6a, 0x71, 0x7a, 0x50, 0x7a, 0x67, 0x61, 0x73, 0x4f,
0x61, 0x30, 0x6a, 0x57, 0x45, 0x71, 0x2f, 0x66, 0x78, 0x75, 0x47, 0x63, 0x2f, 0x62, 0x69, 0x78,
0x67, 0x2f, 0x45, 0x42, 0x61, 0x51, 0x38, 0x79, 0x79, 0x54, 0x47, 0x59, 0x64, 0x49, 0x59, 0x79,
0x72, 0x37, 0x44, 0x4b, 0x59, 0x59, 0x6a, 0x43, 0x0a, 0x30, 0x41, 0x47, 0x56, 0x6e, 0x42, 0x43,
0x68, 0x30, 0x2b, 0x54, 0x46, 0x55, 0x44, 0x42, 0x31, 0x6b, 0x66, 0x77, 0x6b, 0x62, 0x65, 0x66,
0x32, 0x62, 0x38, 0x79, 0x75, 0x66, 0x51, 0x2f, 0x76, 0x4a, 0x77, 0x63, 0x4f, 0x4a, 0x2b, 0x35,
0x6b, 0x42, 0x58, 0x51, 0x5a, 0x78, 0x38, 0x2b, 0x4c, 0x38, 0x55, 0x39, 0x69, 0x57, 0x4b, 0x41,
0x4e, 0x58, 0x78, 0x6b, 0x45, 0x65, 0x43, 0x58, 0x32, 0x0a, 0x69, 0x57, 0x50, 0x5a, 0x50, 0x7a,
0x35, 0x32, 0x70, 0x54, 0x54, 0x59, 0x6c, 0x66, 0x39, 0x30, 0x50, 0x4c, 0x7a, 0x45, 0x57, 0x36,
0x51, 0x79, 0x44, 0x77, 0x4b, 0x42, 0x67, 0x51, 0x43, 0x35, 0x43, 0x4b, 0x79, 0x66, 0x55, 0x77,
0x78, 0x33, 0x42, 0x61, 0x32, 0x69, 0x58, 0x74, 0x66, 0x49, 0x72, 0x65, 0x79, 0x50, 0x71, 0x44,
0x6f, 0x62, 0x62, 0x79, 0x62, 0x79, 0x54, 0x45, 0x59, 0x6b, 0x0a, 0x61, 0x79, 0x41, 0x32, 0x6f,
0x45, 0x6c, 0x53, 0x64, 0x65, 0x6a, 0x67, 0x56, 0x6b, 0x57, 0x77, 0x4a, 0x2b, 0x71, 0x37, 0x37,
0x67, 0x77, 0x72, 0x6e, 0x46, 0x35, 0x50, 0x65, 0x39, 0x7a, 0x62, 0x70, 0x55, 0x42, 0x6f, 0x63,
0x37, 0x56, 0x4a, 0x6a, 0x72, 0x52, 0x68, 0x55, 0x6f, 0x6a, 0x49, 0x37, 0x4c, 0x4f, 0x79, 0x53,
0x79, 0x74, 0x6f, 0x33, 0x57, 0x59, 0x59, 0x6f, 0x63, 0x7a, 0x58, 0x0a, 0x4c, 0x70, 0x72, 0x7a,
0x50, 0x6e, 0x6a, 0x32, 0x79, 0x45, 0x56, 0x65, 0x56, 0x32, 0x6c, 0x72, 0x54, 0x53, 0x36, 0x6c,
0x4b, 0x4e, 0x70, 0x64, 0x72, 0x61, 0x4f, 0x38, 0x51, 0x5a, 0x63, 0x53, 0x44, 0x37, 0x6d, 0x55,
0x55, 0x6d, 0x69, 0x4e, 0x52, 0x5a, 0x6e, 0x6f, 0x50, 0x4b, 0x31, 0x36, 0x4d, 0x6d, 0x39, 0x71,
0x6a, 0x6b, 0x6b, 0x32, 0x39, 0x48, 0x6e, 0x59, 0x37, 0x4d, 0x73, 0x71, 0x0a, 0x70, 0x6b, 0x69,
0x4f, 0x67, 0x34, 0x68, 0x75, 0x4e, 0x77, 0x4b, 0x42, 0x67, 0x51, 0x43, 0x6b, 0x68, 0x32, 0x48,
0x42, 0x74, 0x4f, 0x58, 0x6a, 0x48, 0x2f, 0x47, 0x62, 0x58, 0x56, 0x6b, 0x6c, 0x63, 0x63, 0x30,
0x4f, 0x6b, 0x34, 0x65, 0x30, 0x76, 0x76, 0x4a, 0x53, 0x41, 0x6b, 0x6e, 0x47, 0x6c, 0x6d, 0x57,
0x6c, 0x37, 0x2b, 0x4d, 0x35, 0x78, 0x51, 0x33, 0x6b, 0x69, 0x6b, 0x59, 0x38, 0x0a, 0x44, 0x37,
0x78, 0x4e, 0x46, 0x32, 0x58, 0x73, 0x63, 0x59, 0x2f, 0x51, 0x73, 0x61, 0x44, 0x76, 0x54, 0x41,
0x75, 0x37, 0x58, 0x34, 0x74, 0x47, 0x42, 0x41, 0x47, 0x4d, 0x39, 0x6f, 0x51, 0x64, 0x74, 0x79,
0x4e, 0x69, 0x65, 0x74, 0x6e, 0x31, 0x62, 0x35, 0x4a, 0x66, 0x6d, 0x42, 0x79, 0x7a, 0x30, 0x55,
0x37, 0x42, 0x2b, 0x47, 0x73, 0x76, 0x32, 0x5a, 0x53, 0x37, 0x4b, 0x31, 0x44, 0x55, 0x0a, 0x39,
0x73, 0x54, 0x4c, 0x41, 0x32, 0x45, 0x38, 0x68, 0x4d, 0x6d, 0x37, 0x33, 0x44, 0x70, 0x51, 0x31,
0x55, 0x78, 0x38, 0x42, 0x62, 0x65, 0x43, 0x4b, 0x69, 0x56, 0x79, 0x35, 0x4d, 0x39, 0x50, 0x66,
0x44, 0x63, 0x7a, 0x33, 0x42, 0x4f, 0x6d, 0x6c, 0x4a, 0x64, 0x66, 0x77, 0x68, 0x4b, 0x51, 0x5a,
0x76, 0x6e, 0x69, 0x79, 0x48, 0x52, 0x6c, 0x42, 0x77, 0x4b, 0x42, 0x67, 0x51, 0x43, 0x48, 0x0a,
0x2f, 0x73, 0x41, 0x68, 0x4f, 0x63, 0x44, 0x6e, 0x6d, 0x64, 0x7a, 0x4d, 0x67, 0x6a, 0x6a, 0x47,
0x33, 0x6b, 0x34, 0x49, 0x4a, 0x2f, 0x54, 0x4e, 0x52, 0x52, 0x79, 0x79, 0x36, 0x53, 0x79, 0x45,
0x68, 0x39, 0x66, 0x64, 0x54, 0x6d, 0x47, 0x56, 0x6f, 0x65, 0x50, 0x50, 0x50, 0x70, 0x6c, 0x70,
0x70, 0x32, 0x7a, 0x33, 0x51, 0x7a, 0x62, 0x65, 0x74, 0x73, 0x62, 0x36, 0x56, 0x47, 0x63, 0x33,
0x0a, 0x61, 0x48, 0x57, 0x32, 0x54, 0x35, 0x54, 0x6d, 0x77, 0x32, 0x51, 0x41, 0x51, 0x39, 0x45,
0x56, 0x48, 0x43, 0x50, 0x57, 0x33, 0x7a, 0x6a, 0x41, 0x6b, 0x6a, 0x6a, 0x2f, 0x30, 0x61, 0x76,
0x6b, 0x57, 0x2f, 0x53, 0x32, 0x34, 0x79, 0x75, 0x30, 0x39, 0x65, 0x31, 0x47, 0x4d, 0x61, 0x6a,
0x68, 0x6e, 0x4a, 0x43, 0x30, 0x41, 0x78, 0x71, 0x37, 0x7a, 0x32, 0x75, 0x51, 0x61, 0x67, 0x54,
0x47, 0x0a, 0x32, 0x5a, 0x66, 0x6b, 0x55, 0x38, 0x31, 0x55, 0x52, 0x39, 0x75, 0x65, 0x76, 0x54,
0x6f, 0x6a, 0x6e, 0x66, 0x34, 0x56, 0x71, 0x77, 0x35, 0x55, 0x76, 0x63, 0x72, 0x77, 0x6a, 0x4e,
0x6d, 0x6d, 0x4e, 0x79, 0x45, 0x4d, 0x33, 0x63, 0x2f, 0x67, 0x63, 0x51, 0x4b, 0x42, 0x67, 0x48,
0x61, 0x32, 0x64, 0x54, 0x35, 0x73, 0x76, 0x7a, 0x4d, 0x31, 0x6a, 0x52, 0x65, 0x69, 0x4f, 0x33,
0x56, 0x74, 0x0a, 0x64, 0x41, 0x55, 0x44, 0x7a, 0x74, 0x47, 0x4b, 0x55, 0x45, 0x33, 0x63, 0x6c,
0x50, 0x56, 0x33, 0x35, 0x4c, 0x32, 0x78, 0x6d, 0x4a, 0x65, 0x4a, 0x44, 0x58, 0x50, 0x4f, 0x71,
0x43, 0x4c, 0x33, 0x71, 0x6f, 0x5a, 0x39, 0x41, 0x36, 0x68, 0x48, 0x6d, 0x44, 0x77, 0x36, 0x67,
0x6d, 0x67, 0x38, 0x32, 0x67, 0x51, 0x44, 0x51, 0x65, 0x4a, 0x62, 0x4c, 0x2f, 0x2b, 0x6a, 0x4b,
0x6b, 0x6f, 0x6e, 0x0a, 0x65, 0x36, 0x61, 0x74, 0x48, 0x2f, 0x44, 0x66, 0x72, 0x2b, 0x4d, 0x34,
0x6e, 0x50, 0x66, 0x74, 0x39, 0x4c, 0x74, 0x34, 0x66, 0x4f, 0x41, 0x57, 0x4f, 0x51, 0x33, 0x74,
0x44, 0x73, 0x44, 0x75, 0x43, 0x6b, 0x4f, 0x4d, 0x6a, 0x53, 0x54, 0x6e, 0x38, 0x63, 0x4c, 0x4d,
0x5a, 0x4c, 0x47, 0x63, 0x77, 0x54, 0x32, 0x48, 0x31, 0x48, 0x32, 0x76, 0x42, 0x6f, 0x63, 0x4d,
0x2b, 0x55, 0x54, 0x64, 0x0a, 0x68, 0x6c, 0x6a, 0x41, 0x56, 0x6e, 0x42, 0x39, 0x76, 0x36, 0x4e,
0x4d, 0x66, 0x63, 0x52, 0x45, 0x52, 0x54, 0x78, 0x31, 0x30, 0x53, 0x55, 0x63, 0x0a, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a,
};
#endif
#ifndef OPENSSL_NO_EC
# ifndef OPENSSL_NO_DEPRECATED_3_0
/*
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIJLyl7hJjpQL/RhP1x2zS79xdiPJQB683gWeqcqHPeZkoAoGCCqGSM49
AwEHoUQDQgAEdsjygVYjjaKBF4CNECVllNf017p5/MxNSWDoTHy9I2GeDwEDDazI
D/xy8JiYjtPKVE/Zqwbmivp2UwtH28a7NQ==
-----END EC PRIVATE KEY-----
*/
static const char ECDSAPrivateKeyPEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x45,
0x43, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45,
0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x48, 0x63, 0x43, 0x41,
0x51, 0x45, 0x45, 0x49, 0x4a, 0x4c, 0x79, 0x6c, 0x37, 0x68, 0x4a, 0x6a,
0x70, 0x51, 0x4c, 0x2f, 0x52, 0x68, 0x50, 0x31, 0x78, 0x32, 0x7a, 0x53,
0x37, 0x39, 0x78, 0x64, 0x69, 0x50, 0x4a, 0x51, 0x42, 0x36, 0x38, 0x33,
0x67, 0x57, 0x65, 0x71, 0x63, 0x71, 0x48, 0x50, 0x65, 0x5a, 0x6b, 0x6f,
0x41, 0x6f, 0x47, 0x43, 0x43, 0x71, 0x47, 0x53, 0x4d, 0x34, 0x39, 0x0a,
0x41, 0x77, 0x45, 0x48, 0x6f, 0x55, 0x51, 0x44, 0x51, 0x67, 0x41, 0x45,
0x64, 0x73, 0x6a, 0x79, 0x67, 0x56, 0x59, 0x6a, 0x6a, 0x61, 0x4b, 0x42,
0x46, 0x34, 0x43, 0x4e, 0x45, 0x43, 0x56, 0x6c, 0x6c, 0x4e, 0x66, 0x30,
0x31, 0x37, 0x70, 0x35, 0x2f, 0x4d, 0x78, 0x4e, 0x53, 0x57, 0x44, 0x6f,
0x54, 0x48, 0x79, 0x39, 0x49, 0x32, 0x47, 0x65, 0x44, 0x77, 0x45, 0x44,
0x44, 0x61, 0x7a, 0x49, 0x0a, 0x44, 0x2f, 0x78, 0x79, 0x38, 0x4a, 0x69,
0x59, 0x6a, 0x74, 0x50, 0x4b, 0x56, 0x45, 0x2f, 0x5a, 0x71, 0x77, 0x62,
0x6d, 0x69, 0x76, 0x70, 0x32, 0x55, 0x77, 0x74, 0x48, 0x32, 0x38, 0x61,
0x37, 0x4e, 0x51, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45,
0x4e, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54,
0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
};
# endif
/*
-----BEGIN CERTIFICATE-----
MIIBXzCCAQagAwIBAgIJAK6/Yvf/ain6MAoGCCqGSM49BAMCMBIxEDAOBgNVBAoM
B0FjbWUgQ28wHhcNMTYxMjI1MTEzOTI3WhcNMjYxMjI1MTEzOTI3WjASMRAwDgYD
VQQKDAdBY21lIENvMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdsjygVYjjaKB
F4CNECVllNf017p5/MxNSWDoTHy9I2GeDwEDDazID/xy8JiYjtPKVE/Zqwbmivp2
UwtH28a7NaNFMEMwCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwEwYDVR0lBAwwCgYI
KwYBBQUHAwEwFAYDVR0RBA0wC4IJbG9jYWxob3N0MAoGCCqGSM49BAMCA0cAMEQC
IEzr3t/jejVE9oSnBp8c3P2p+lDLVRrB8zxLyjZvirUXAiAyQPaE9MNcL8/nRpuu
99I1enCSmWIAJ57IwuJ/n1d45Q==
-----END CERTIFICATE-----
*/
static const char ECDSACertPEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x42, 0x58, 0x7a, 0x43, 0x43,
0x41, 0x51, 0x61, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x4a,
0x41, 0x4b, 0x36, 0x2f, 0x59, 0x76, 0x66, 0x2f, 0x61, 0x69, 0x6e, 0x36,
0x4d, 0x41, 0x6f, 0x47, 0x43, 0x43, 0x71, 0x47, 0x53, 0x4d, 0x34, 0x39,
0x42, 0x41, 0x4d, 0x43, 0x4d, 0x42, 0x49, 0x78, 0x45, 0x44, 0x41, 0x4f,
0x42, 0x67, 0x4e, 0x56, 0x42, 0x41, 0x6f, 0x4d, 0x0a, 0x42, 0x30, 0x46,
0x6a, 0x62, 0x57, 0x55, 0x67, 0x51, 0x32, 0x38, 0x77, 0x48, 0x68, 0x63,
0x4e, 0x4d, 0x54, 0x59, 0x78, 0x4d, 0x6a, 0x49, 0x31, 0x4d, 0x54, 0x45,
0x7a, 0x4f, 0x54, 0x49, 0x33, 0x57, 0x68, 0x63, 0x4e, 0x4d, 0x6a, 0x59,
0x78, 0x4d, 0x6a, 0x49, 0x31, 0x4d, 0x54, 0x45, 0x7a, 0x4f, 0x54, 0x49,
0x33, 0x57, 0x6a, 0x41, 0x53, 0x4d, 0x52, 0x41, 0x77, 0x44, 0x67, 0x59,
0x44, 0x0a, 0x56, 0x51, 0x51, 0x4b, 0x44, 0x41, 0x64, 0x42, 0x59, 0x32,
0x31, 0x6c, 0x49, 0x45, 0x4e, 0x76, 0x4d, 0x46, 0x6b, 0x77, 0x45, 0x77,
0x59, 0x48, 0x4b, 0x6f, 0x5a, 0x49, 0x7a, 0x6a, 0x30, 0x43, 0x41, 0x51,
0x59, 0x49, 0x4b, 0x6f, 0x5a, 0x49, 0x7a, 0x6a, 0x30, 0x44, 0x41, 0x51,
0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x64, 0x73, 0x6a, 0x79, 0x67, 0x56,
0x59, 0x6a, 0x6a, 0x61, 0x4b, 0x42, 0x0a, 0x46, 0x34, 0x43, 0x4e, 0x45,
0x43, 0x56, 0x6c, 0x6c, 0x4e, 0x66, 0x30, 0x31, 0x37, 0x70, 0x35, 0x2f,
0x4d, 0x78, 0x4e, 0x53, 0x57, 0x44, 0x6f, 0x54, 0x48, 0x79, 0x39, 0x49,
0x32, 0x47, 0x65, 0x44, 0x77, 0x45, 0x44, 0x44, 0x61, 0x7a, 0x49, 0x44,
0x2f, 0x78, 0x79, 0x38, 0x4a, 0x69, 0x59, 0x6a, 0x74, 0x50, 0x4b, 0x56,
0x45, 0x2f, 0x5a, 0x71, 0x77, 0x62, 0x6d, 0x69, 0x76, 0x70, 0x32, 0x0a,
0x55, 0x77, 0x74, 0x48, 0x32, 0x38, 0x61, 0x37, 0x4e, 0x61, 0x4e, 0x46,
0x4d, 0x45, 0x4d, 0x77, 0x43, 0x51, 0x59, 0x44, 0x56, 0x52, 0x30, 0x54,
0x42, 0x41, 0x49, 0x77, 0x41, 0x44, 0x41, 0x4c, 0x42, 0x67, 0x4e, 0x56,
0x48, 0x51, 0x38, 0x45, 0x42, 0x41, 0x4d, 0x43, 0x42, 0x61, 0x41, 0x77,
0x45, 0x77, 0x59, 0x44, 0x56, 0x52, 0x30, 0x6c, 0x42, 0x41, 0x77, 0x77,
0x43, 0x67, 0x59, 0x49, 0x0a, 0x4b, 0x77, 0x59, 0x42, 0x42, 0x51, 0x55,
0x48, 0x41, 0x77, 0x45, 0x77, 0x46, 0x41, 0x59, 0x44, 0x56, 0x52, 0x30,
0x52, 0x42, 0x41, 0x30, 0x77, 0x43, 0x34, 0x49, 0x4a, 0x62, 0x47, 0x39,
0x6a, 0x59, 0x57, 0x78, 0x6f, 0x62, 0x33, 0x4e, 0x30, 0x4d, 0x41, 0x6f,
0x47, 0x43, 0x43, 0x71, 0x47, 0x53, 0x4d, 0x34, 0x39, 0x42, 0x41, 0x4d,
0x43, 0x41, 0x30, 0x63, 0x41, 0x4d, 0x45, 0x51, 0x43, 0x0a, 0x49, 0x45,
0x7a, 0x72, 0x33, 0x74, 0x2f, 0x6a, 0x65, 0x6a, 0x56, 0x45, 0x39, 0x6f,
0x53, 0x6e, 0x42, 0x70, 0x38, 0x63, 0x33, 0x50, 0x32, 0x70, 0x2b, 0x6c,
0x44, 0x4c, 0x56, 0x52, 0x72, 0x42, 0x38, 0x7a, 0x78, 0x4c, 0x79, 0x6a,
0x5a, 0x76, 0x69, 0x72, 0x55, 0x58, 0x41, 0x69, 0x41, 0x79, 0x51, 0x50,
0x61, 0x45, 0x39, 0x4d, 0x4e, 0x63, 0x4c, 0x38, 0x2f, 0x6e, 0x52, 0x70,
0x75, 0x75, 0x0a, 0x39, 0x39, 0x49, 0x31, 0x65, 0x6e, 0x43, 0x53, 0x6d,
0x57, 0x49, 0x41, 0x4a, 0x35, 0x37, 0x49, 0x77, 0x75, 0x4a, 0x2f, 0x6e,
0x31, 0x64, 0x34, 0x35, 0x51, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49,
0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
};
#endif
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
/*
-----BEGIN DSA PRIVATE KEY-----
MIIBuwIBAAKBgQDdkFKzNABLOha7Eqj7004+p5fhtR6bxpujToMmSZTYi8igVVXP
Wzf03ULKS5UKjA6WpR6EiZAhm+PdxusZ5xfAuRZLdKy0bgxn1f348Rwh+EQNaEM8
0TGcnw5ijwKmSw5yyHPDWdiHzoqEBlhAf8Nl22YTXax/clsc/pu/RRLAdwIVAIEg
QqWRf/1EIZZcgM65Qpd65YuxAoGBAKBauV/RuloFHoSy5iWXESDywiS380tN5974
GukGwoYdZo5uSIH6ahpeNSef0MbHGAzr7ZVEnhCQfRAwH1gRvSHoq/Rbmcvtd3r+
QtQHOwvQHgLAynhI4i73c794czHaR+439bmcaSwDnQduRM85Mho/jiiZzAVPxBmG
POIMWNXXAoGAI6Ep5IE7yn3JzkXO9B6tC3bbDM+ZzuuInwZLbtZ8lim7Dsqabg4k
2YbE4R95Bnfwnjsyl80mq/DbQN5lAHBvjDrkC6ItojBGKI3+iIrqGUEJdxvl4ulj
F0PmSD7zvIG8BfocKOel+EHH0YryExiW6krV1KW2ZRmJrqSFw6KCjV0CFFQFbPfU
xy5PmKytJmXR8BmppkIO
-----END DSA PRIVATE KEY-----
*/
static const char DSAPrivateKeyPEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x44,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x42,
0x75, 0x77, 0x49, 0x42, 0x41, 0x41, 0x4b, 0x42, 0x67, 0x51, 0x44, 0x64,
0x6b, 0x46, 0x4b, 0x7a, 0x4e, 0x41, 0x42, 0x4c, 0x4f, 0x68, 0x61, 0x37,
0x45, 0x71, 0x6a, 0x37, 0x30, 0x30, 0x34, 0x2b, 0x70, 0x35, 0x66, 0x68,
0x74, 0x52, 0x36, 0x62, 0x78, 0x70, 0x75, 0x6a, 0x54, 0x6f, 0x4d, 0x6d,
0x53, 0x5a, 0x54, 0x59, 0x69, 0x38, 0x69, 0x67, 0x56, 0x56, 0x58, 0x50,
0x0a, 0x57, 0x7a, 0x66, 0x30, 0x33, 0x55, 0x4c, 0x4b, 0x53, 0x35, 0x55,
0x4b, 0x6a, 0x41, 0x36, 0x57, 0x70, 0x52, 0x36, 0x45, 0x69, 0x5a, 0x41,
0x68, 0x6d, 0x2b, 0x50, 0x64, 0x78, 0x75, 0x73, 0x5a, 0x35, 0x78, 0x66,
0x41, 0x75, 0x52, 0x5a, 0x4c, 0x64, 0x4b, 0x79, 0x30, 0x62, 0x67, 0x78,
0x6e, 0x31, 0x66, 0x33, 0x34, 0x38, 0x52, 0x77, 0x68, 0x2b, 0x45, 0x51,
0x4e, 0x61, 0x45, 0x4d, 0x38, 0x0a, 0x30, 0x54, 0x47, 0x63, 0x6e, 0x77,
0x35, 0x69, 0x6a, 0x77, 0x4b, 0x6d, 0x53, 0x77, 0x35, 0x79, 0x79, 0x48,
0x50, 0x44, 0x57, 0x64, 0x69, 0x48, 0x7a, 0x6f, 0x71, 0x45, 0x42, 0x6c,
0x68, 0x41, 0x66, 0x38, 0x4e, 0x6c, 0x32, 0x32, 0x59, 0x54, 0x58, 0x61,
0x78, 0x2f, 0x63, 0x6c, 0x73, 0x63, 0x2f, 0x70, 0x75, 0x2f, 0x52, 0x52,
0x4c, 0x41, 0x64, 0x77, 0x49, 0x56, 0x41, 0x49, 0x45, 0x67, 0x0a, 0x51,
0x71, 0x57, 0x52, 0x66, 0x2f, 0x31, 0x45, 0x49, 0x5a, 0x5a, 0x63, 0x67,
0x4d, 0x36, 0x35, 0x51, 0x70, 0x64, 0x36, 0x35, 0x59, 0x75, 0x78, 0x41,
0x6f, 0x47, 0x42, 0x41, 0x4b, 0x42, 0x61, 0x75, 0x56, 0x2f, 0x52, 0x75,
0x6c, 0x6f, 0x46, 0x48, 0x6f, 0x53, 0x79, 0x35, 0x69, 0x57, 0x58, 0x45,
0x53, 0x44, 0x79, 0x77, 0x69, 0x53, 0x33, 0x38, 0x30, 0x74, 0x4e, 0x35,
0x39, 0x37, 0x34, 0x0a, 0x47, 0x75, 0x6b, 0x47, 0x77, 0x6f, 0x59, 0x64,
0x5a, 0x6f, 0x35, 0x75, 0x53, 0x49, 0x48, 0x36, 0x61, 0x68, 0x70, 0x65,
0x4e, 0x53, 0x65, 0x66, 0x30, 0x4d, 0x62, 0x48, 0x47, 0x41, 0x7a, 0x72,
0x37, 0x5a, 0x56, 0x45, 0x6e, 0x68, 0x43, 0x51, 0x66, 0x52, 0x41, 0x77,
0x48, 0x31, 0x67, 0x52, 0x76, 0x53, 0x48, 0x6f, 0x71, 0x2f, 0x52, 0x62,
0x6d, 0x63, 0x76, 0x74, 0x64, 0x33, 0x72, 0x2b, 0x0a, 0x51, 0x74, 0x51,
0x48, 0x4f, 0x77, 0x76, 0x51, 0x48, 0x67, 0x4c, 0x41, 0x79, 0x6e, 0x68,
0x49, 0x34, 0x69, 0x37, 0x33, 0x63, 0x37, 0x39, 0x34, 0x63, 0x7a, 0x48,
0x61, 0x52, 0x2b, 0x34, 0x33, 0x39, 0x62, 0x6d, 0x63, 0x61, 0x53, 0x77,
0x44, 0x6e, 0x51, 0x64, 0x75, 0x52, 0x4d, 0x38, 0x35, 0x4d, 0x68, 0x6f,
0x2f, 0x6a, 0x69, 0x69, 0x5a, 0x7a, 0x41, 0x56, 0x50, 0x78, 0x42, 0x6d,
0x47, 0x0a, 0x50, 0x4f, 0x49, 0x4d, 0x57, 0x4e, 0x58, 0x58, 0x41, 0x6f,
0x47, 0x41, 0x49, 0x36, 0x45, 0x70, 0x35, 0x49, 0x45, 0x37, 0x79, 0x6e,
0x33, 0x4a, 0x7a, 0x6b, 0x58, 0x4f, 0x39, 0x42, 0x36, 0x74, 0x43, 0x33,
0x62, 0x62, 0x44, 0x4d, 0x2b, 0x5a, 0x7a, 0x75, 0x75, 0x49, 0x6e, 0x77,
0x5a, 0x4c, 0x62, 0x74, 0x5a, 0x38, 0x6c, 0x69, 0x6d, 0x37, 0x44, 0x73,
0x71, 0x61, 0x62, 0x67, 0x34, 0x6b, 0x0a, 0x32, 0x59, 0x62, 0x45, 0x34,
0x52, 0x39, 0x35, 0x42, 0x6e, 0x66, 0x77, 0x6e, 0x6a, 0x73, 0x79, 0x6c,
0x38, 0x30, 0x6d, 0x71, 0x2f, 0x44, 0x62, 0x51, 0x4e, 0x35, 0x6c, 0x41,
0x48, 0x42, 0x76, 0x6a, 0x44, 0x72, 0x6b, 0x43, 0x36, 0x49, 0x74, 0x6f,
0x6a, 0x42, 0x47, 0x4b, 0x49, 0x33, 0x2b, 0x69, 0x49, 0x72, 0x71, 0x47,
0x55, 0x45, 0x4a, 0x64, 0x78, 0x76, 0x6c, 0x34, 0x75, 0x6c, 0x6a, 0x0a,
0x46, 0x30, 0x50, 0x6d, 0x53, 0x44, 0x37, 0x7a, 0x76, 0x49, 0x47, 0x38,
0x42, 0x66, 0x6f, 0x63, 0x4b, 0x4f, 0x65, 0x6c, 0x2b, 0x45, 0x48, 0x48,
0x30, 0x59, 0x72, 0x79, 0x45, 0x78, 0x69, 0x57, 0x36, 0x6b, 0x72, 0x56,
0x31, 0x4b, 0x57, 0x32, 0x5a, 0x52, 0x6d, 0x4a, 0x72, 0x71, 0x53, 0x46,
0x77, 0x36, 0x4b, 0x43, 0x6a, 0x56, 0x30, 0x43, 0x46, 0x46, 0x51, 0x46,
0x62, 0x50, 0x66, 0x55, 0x0a, 0x78, 0x79, 0x35, 0x50, 0x6d, 0x4b, 0x79,
0x74, 0x4a, 0x6d, 0x58, 0x52, 0x38, 0x42, 0x6d, 0x70, 0x70, 0x6b, 0x49,
0x4f, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x44,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
};
/*
-----BEGIN CERTIFICATE-----
MIICqTCCAmegAwIBAgIJAILDGUk37fWGMAsGCWCGSAFlAwQDAjASMRAwDgYDVQQK
DAdBY21lIENvMB4XDTE2MTIyNTEzMjUzNloXDTI2MTIyNTEzMjUzNlowEjEQMA4G
A1UECgwHQWNtZSBDbzCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQDdkFKzNABLOha7
Eqj7004+p5fhtR6bxpujToMmSZTYi8igVVXPWzf03ULKS5UKjA6WpR6EiZAhm+Pd
xusZ5xfAuRZLdKy0bgxn1f348Rwh+EQNaEM80TGcnw5ijwKmSw5yyHPDWdiHzoqE
BlhAf8Nl22YTXax/clsc/pu/RRLAdwIVAIEgQqWRf/1EIZZcgM65Qpd65YuxAoGB
AKBauV/RuloFHoSy5iWXESDywiS380tN5974GukGwoYdZo5uSIH6ahpeNSef0MbH
GAzr7ZVEnhCQfRAwH1gRvSHoq/Rbmcvtd3r+QtQHOwvQHgLAynhI4i73c794czHa
R+439bmcaSwDnQduRM85Mho/jiiZzAVPxBmGPOIMWNXXA4GEAAKBgCOhKeSBO8p9
yc5FzvQerQt22wzPmc7riJ8GS27WfJYpuw7Kmm4OJNmGxOEfeQZ38J47MpfNJqvw
20DeZQBwb4w65AuiLaIwRiiN/oiK6hlBCXcb5eLpYxdD5kg+87yBvAX6HCjnpfhB
x9GK8hMYlupK1dSltmUZia6khcOigo1do0UwQzAJBgNVHRMEAjAAMAsGA1UdDwQE
AwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAUBgNVHREEDTALgglsb2NhbGhvc3Qw
CwYJYIZIAWUDBAMCAy8AMCwCFClxInXTRWNJEWdi5ilNr/fbM1bKAhQy4B7wtmfd
I+zV6g3w9qBkNqStpA==
-----END CERTIFICATE-----
*/
static const char DSACertPEM[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x71, 0x54, 0x43, 0x43,
0x41, 0x6d, 0x65, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x4a,
0x41, 0x49, 0x4c, 0x44, 0x47, 0x55, 0x6b, 0x33, 0x37, 0x66, 0x57, 0x47,
0x4d, 0x41, 0x73, 0x47, 0x43, 0x57, 0x43, 0x47, 0x53, 0x41, 0x46, 0x6c,
0x41, 0x77, 0x51, 0x44, 0x41, 0x6a, 0x41, 0x53, 0x4d, 0x52, 0x41, 0x77,
0x44, 0x67, 0x59, 0x44, 0x56, 0x51, 0x51, 0x4b, 0x0a, 0x44, 0x41, 0x64,
0x42, 0x59, 0x32, 0x31, 0x6c, 0x49, 0x45, 0x4e, 0x76, 0x4d, 0x42, 0x34,
0x58, 0x44, 0x54, 0x45, 0x32, 0x4d, 0x54, 0x49, 0x79, 0x4e, 0x54, 0x45,
0x7a, 0x4d, 0x6a, 0x55, 0x7a, 0x4e, 0x6c, 0x6f, 0x58, 0x44, 0x54, 0x49,
0x32, 0x4d, 0x54, 0x49, 0x79, 0x4e, 0x54, 0x45, 0x7a, 0x4d, 0x6a, 0x55,
0x7a, 0x4e, 0x6c, 0x6f, 0x77, 0x45, 0x6a, 0x45, 0x51, 0x4d, 0x41, 0x34,
0x47, 0x0a, 0x41, 0x31, 0x55, 0x45, 0x43, 0x67, 0x77, 0x48, 0x51, 0x57,
0x4e, 0x74, 0x5a, 0x53, 0x42, 0x44, 0x62, 0x7a, 0x43, 0x43, 0x41, 0x62,
0x63, 0x77, 0x67, 0x67, 0x45, 0x73, 0x42, 0x67, 0x63, 0x71, 0x68, 0x6b,
0x6a, 0x4f, 0x4f, 0x41, 0x51, 0x42, 0x4d, 0x49, 0x49, 0x42, 0x48, 0x77,
0x4b, 0x42, 0x67, 0x51, 0x44, 0x64, 0x6b, 0x46, 0x4b, 0x7a, 0x4e, 0x41,
0x42, 0x4c, 0x4f, 0x68, 0x61, 0x37, 0x0a, 0x45, 0x71, 0x6a, 0x37, 0x30,
0x30, 0x34, 0x2b, 0x70, 0x35, 0x66, 0x68, 0x74, 0x52, 0x36, 0x62, 0x78,
0x70, 0x75, 0x6a, 0x54, 0x6f, 0x4d, 0x6d, 0x53, 0x5a, 0x54, 0x59, 0x69,
0x38, 0x69, 0x67, 0x56, 0x56, 0x58, 0x50, 0x57, 0x7a, 0x66, 0x30, 0x33,
0x55, 0x4c, 0x4b, 0x53, 0x35, 0x55, 0x4b, 0x6a, 0x41, 0x36, 0x57, 0x70,
0x52, 0x36, 0x45, 0x69, 0x5a, 0x41, 0x68, 0x6d, 0x2b, 0x50, 0x64, 0x0a,
0x78, 0x75, 0x73, 0x5a, 0x35, 0x78, 0x66, 0x41, 0x75, 0x52, 0x5a, 0x4c,
0x64, 0x4b, 0x79, 0x30, 0x62, 0x67, 0x78, 0x6e, 0x31, 0x66, 0x33, 0x34,
0x38, 0x52, 0x77, 0x68, 0x2b, 0x45, 0x51, 0x4e, 0x61, 0x45, 0x4d, 0x38,
0x30, 0x54, 0x47, 0x63, 0x6e, 0x77, 0x35, 0x69, 0x6a, 0x77, 0x4b, 0x6d,
0x53, 0x77, 0x35, 0x79, 0x79, 0x48, 0x50, 0x44, 0x57, 0x64, 0x69, 0x48,
0x7a, 0x6f, 0x71, 0x45, 0x0a, 0x42, 0x6c, 0x68, 0x41, 0x66, 0x38, 0x4e,
0x6c, 0x32, 0x32, 0x59, 0x54, 0x58, 0x61, 0x78, 0x2f, 0x63, 0x6c, 0x73,
0x63, 0x2f, 0x70, 0x75, 0x2f, 0x52, 0x52, 0x4c, 0x41, 0x64, 0x77, 0x49,
0x56, 0x41, 0x49, 0x45, 0x67, 0x51, 0x71, 0x57, 0x52, 0x66, 0x2f, 0x31,
0x45, 0x49, 0x5a, 0x5a, 0x63, 0x67, 0x4d, 0x36, 0x35, 0x51, 0x70, 0x64,
0x36, 0x35, 0x59, 0x75, 0x78, 0x41, 0x6f, 0x47, 0x42, 0x0a, 0x41, 0x4b,
0x42, 0x61, 0x75, 0x56, 0x2f, 0x52, 0x75, 0x6c, 0x6f, 0x46, 0x48, 0x6f,
0x53, 0x79, 0x35, 0x69, 0x57, 0x58, 0x45, 0x53, 0x44, 0x79, 0x77, 0x69,
0x53, 0x33, 0x38, 0x30, 0x74, 0x4e, 0x35, 0x39, 0x37, 0x34, 0x47, 0x75,
0x6b, 0x47, 0x77, 0x6f, 0x59, 0x64, 0x5a, 0x6f, 0x35, 0x75, 0x53, 0x49,
0x48, 0x36, 0x61, 0x68, 0x70, 0x65, 0x4e, 0x53, 0x65, 0x66, 0x30, 0x4d,
0x62, 0x48, 0x0a, 0x47, 0x41, 0x7a, 0x72, 0x37, 0x5a, 0x56, 0x45, 0x6e,
0x68, 0x43, 0x51, 0x66, 0x52, 0x41, 0x77, 0x48, 0x31, 0x67, 0x52, 0x76,
0x53, 0x48, 0x6f, 0x71, 0x2f, 0x52, 0x62, 0x6d, 0x63, 0x76, 0x74, 0x64,
0x33, 0x72, 0x2b, 0x51, 0x74, 0x51, 0x48, 0x4f, 0x77, 0x76, 0x51, 0x48,
0x67, 0x4c, 0x41, 0x79, 0x6e, 0x68, 0x49, 0x34, 0x69, 0x37, 0x33, 0x63,
0x37, 0x39, 0x34, 0x63, 0x7a, 0x48, 0x61, 0x0a, 0x52, 0x2b, 0x34, 0x33,
0x39, 0x62, 0x6d, 0x63, 0x61, 0x53, 0x77, 0x44, 0x6e, 0x51, 0x64, 0x75,
0x52, 0x4d, 0x38, 0x35, 0x4d, 0x68, 0x6f, 0x2f, 0x6a, 0x69, 0x69, 0x5a,
0x7a, 0x41, 0x56, 0x50, 0x78, 0x42, 0x6d, 0x47, 0x50, 0x4f, 0x49, 0x4d,
0x57, 0x4e, 0x58, 0x58, 0x41, 0x34, 0x47, 0x45, 0x41, 0x41, 0x4b, 0x42,
0x67, 0x43, 0x4f, 0x68, 0x4b, 0x65, 0x53, 0x42, 0x4f, 0x38, 0x70, 0x39,
0x0a, 0x79, 0x63, 0x35, 0x46, 0x7a, 0x76, 0x51, 0x65, 0x72, 0x51, 0x74,
0x32, 0x32, 0x77, 0x7a, 0x50, 0x6d, 0x63, 0x37, 0x72, 0x69, 0x4a, 0x38,
0x47, 0x53, 0x32, 0x37, 0x57, 0x66, 0x4a, 0x59, 0x70, 0x75, 0x77, 0x37,
0x4b, 0x6d, 0x6d, 0x34, 0x4f, 0x4a, 0x4e, 0x6d, 0x47, 0x78, 0x4f, 0x45,
0x66, 0x65, 0x51, 0x5a, 0x33, 0x38, 0x4a, 0x34, 0x37, 0x4d, 0x70, 0x66,
0x4e, 0x4a, 0x71, 0x76, 0x77, 0x0a, 0x32, 0x30, 0x44, 0x65, 0x5a, 0x51,
0x42, 0x77, 0x62, 0x34, 0x77, 0x36, 0x35, 0x41, 0x75, 0x69, 0x4c, 0x61,
0x49, 0x77, 0x52, 0x69, 0x69, 0x4e, 0x2f, 0x6f, 0x69, 0x4b, 0x36, 0x68,
0x6c, 0x42, 0x43, 0x58, 0x63, 0x62, 0x35, 0x65, 0x4c, 0x70, 0x59, 0x78,
0x64, 0x44, 0x35, 0x6b, 0x67, 0x2b, 0x38, 0x37, 0x79, 0x42, 0x76, 0x41,
0x58, 0x36, 0x48, 0x43, 0x6a, 0x6e, 0x70, 0x66, 0x68, 0x42, 0x0a, 0x78,
0x39, 0x47, 0x4b, 0x38, 0x68, 0x4d, 0x59, 0x6c, 0x75, 0x70, 0x4b, 0x31,
0x64, 0x53, 0x6c, 0x74, 0x6d, 0x55, 0x5a, 0x69, 0x61, 0x36, 0x6b, 0x68,
0x63, 0x4f, 0x69, 0x67, 0x6f, 0x31, 0x64, 0x6f, 0x30, 0x55, 0x77, 0x51,
0x7a, 0x41, 0x4a, 0x42, 0x67, 0x4e, 0x56, 0x48, 0x52, 0x4d, 0x45, 0x41,
0x6a, 0x41, 0x41, 0x4d, 0x41, 0x73, 0x47, 0x41, 0x31, 0x55, 0x64, 0x44,
0x77, 0x51, 0x45, 0x0a, 0x41, 0x77, 0x49, 0x46, 0x6f, 0x44, 0x41, 0x54,
0x42, 0x67, 0x4e, 0x56, 0x48, 0x53, 0x55, 0x45, 0x44, 0x44, 0x41, 0x4b,
0x42, 0x67, 0x67, 0x72, 0x42, 0x67, 0x45, 0x46, 0x42, 0x51, 0x63, 0x44,
0x41, 0x54, 0x41, 0x55, 0x42, 0x67, 0x4e, 0x56, 0x48, 0x52, 0x45, 0x45,
0x44, 0x54, 0x41, 0x4c, 0x67, 0x67, 0x6c, 0x73, 0x62, 0x32, 0x4e, 0x68,
0x62, 0x47, 0x68, 0x76, 0x63, 0x33, 0x51, 0x77, 0x0a, 0x43, 0x77, 0x59,
0x4a, 0x59, 0x49, 0x5a, 0x49, 0x41, 0x57, 0x55, 0x44, 0x42, 0x41, 0x4d,
0x43, 0x41, 0x79, 0x38, 0x41, 0x4d, 0x43, 0x77, 0x43, 0x46, 0x43, 0x6c,
0x78, 0x49, 0x6e, 0x58, 0x54, 0x52, 0x57, 0x4e, 0x4a, 0x45, 0x57, 0x64,
0x69, 0x35, 0x69, 0x6c, 0x4e, 0x72, 0x2f, 0x66, 0x62, 0x4d, 0x31, 0x62,
0x4b, 0x41, 0x68, 0x51, 0x79, 0x34, 0x42, 0x37, 0x77, 0x74, 0x6d, 0x66,
0x64, 0x0a, 0x49, 0x2b, 0x7a, 0x56, 0x36, 0x67, 0x33, 0x77, 0x39, 0x71,
0x42, 0x6b, 0x4e, 0x71, 0x53, 0x74, 0x70, 0x41, 0x3d, 0x3d, 0x0a, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54,
0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x0a
};
#endif
/* unused, to avoid warning. */
static int idx;
#define FUZZTIME 1485898104
#define TIME_IMPL(t) { if (t != NULL) *t = FUZZTIME; return FUZZTIME; }
/*
* This might not work in all cases (and definitely not on Windows
* because of the way linkers are) and callees can still get the
* current time instead of the fixed time. This will just result
* in things not being fully reproducible and have a slightly
* different coverage.
*/
#if !defined(_WIN32)
time_t time(time_t *t) TIME_IMPL(t)
#endif
int FuzzerInitialize(int *argc, char ***argv)
{
STACK_OF(SSL_COMP) *comp_methods;
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
comp_methods = SSL_COMP_get_compression_methods();
if (comp_methods != NULL)
sk_SSL_COMP_sort(comp_methods);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
SSL *server;
BIO *in;
BIO *out;
#if !defined(OPENSSL_NO_EC) \
|| (!defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0))
BIO *bio_buf;
#endif
SSL_CTX *ctx;
int ret;
#ifndef OPENSSL_NO_DEPRECATED_3_0
RSA *privkey;
#endif
#if !defined(OPENSSL_NO_DEPRECATED_3_0)
EVP_PKEY *pkey;
#endif
X509 *cert;
#ifndef OPENSSL_NO_DEPRECATED_3_0
# ifndef OPENSSL_NO_EC
EC_KEY *ecdsakey = NULL;
# endif
#endif
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
DSA *dsakey = NULL;
#endif
if (len < 2)
return 0;
/* This only fuzzes the initial flow from the client so far. */
ctx = SSL_CTX_new(DTLS_server_method());
ret = SSL_CTX_set_min_proto_version(ctx, 0);
OPENSSL_assert(ret == 1);
ret = SSL_CTX_set_cipher_list(ctx, "ALL:eNULL:@SECLEVEL=0");
OPENSSL_assert(ret == 1);
#ifndef OPENSSL_NO_DEPRECATED_3_0
/* RSA */
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, RSAPrivateKeyPEM, sizeof(RSAPrivateKeyPEM)) == sizeof(RSAPrivateKeyPEM));
privkey = PEM_read_bio_RSAPrivateKey(bio_buf, NULL, NULL, NULL);
ERR_print_errors_fp(stderr);
OPENSSL_assert(privkey != NULL);
BIO_free(bio_buf);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_RSA(pkey, privkey);
ret = SSL_CTX_use_PrivateKey(ctx, pkey);
OPENSSL_assert(ret == 1);
EVP_PKEY_free(pkey);
#endif
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, RSACertificatePEM, sizeof(RSACertificatePEM)) == sizeof(RSACertificatePEM));
cert = PEM_read_bio_X509(bio_buf, NULL, NULL, NULL);
BIO_free(bio_buf);
OPENSSL_assert(cert != NULL);
ret = SSL_CTX_use_certificate(ctx, cert);
OPENSSL_assert(ret == 1);
X509_free(cert);
#ifndef OPENSSL_NO_EC
# ifndef OPENSSL_NO_DEPRECATED_3_0
/* ECDSA */
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, ECDSAPrivateKeyPEM, sizeof(ECDSAPrivateKeyPEM)) == sizeof(ECDSAPrivateKeyPEM));
ecdsakey = PEM_read_bio_ECPrivateKey(bio_buf, NULL, NULL, NULL);
ERR_print_errors_fp(stderr);
OPENSSL_assert(ecdsakey != NULL);
BIO_free(bio_buf);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_EC_KEY(pkey, ecdsakey);
ret = SSL_CTX_use_PrivateKey(ctx, pkey);
OPENSSL_assert(ret == 1);
EVP_PKEY_free(pkey);
# endif
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, ECDSACertPEM, sizeof(ECDSACertPEM)) == sizeof(ECDSACertPEM));
cert = PEM_read_bio_X509(bio_buf, NULL, NULL, NULL);
OPENSSL_assert(cert != NULL);
BIO_free(bio_buf);
ret = SSL_CTX_use_certificate(ctx, cert);
OPENSSL_assert(ret == 1);
X509_free(cert);
#endif
#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_DEPRECATED_3_0)
/* DSA */
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, DSAPrivateKeyPEM, sizeof(DSAPrivateKeyPEM)) == sizeof(DSAPrivateKeyPEM));
dsakey = PEM_read_bio_DSAPrivateKey(bio_buf, NULL, NULL, NULL);
ERR_print_errors_fp(stderr);
OPENSSL_assert(dsakey != NULL);
BIO_free(bio_buf);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_DSA(pkey, dsakey);
ret = SSL_CTX_use_PrivateKey(ctx, pkey);
OPENSSL_assert(ret == 1);
EVP_PKEY_free(pkey);
bio_buf = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(bio_buf, DSACertPEM, sizeof(DSACertPEM)) == sizeof(DSACertPEM));
cert = PEM_read_bio_X509(bio_buf, NULL, NULL, NULL);
OPENSSL_assert(cert != NULL);
BIO_free(bio_buf);
ret = SSL_CTX_use_certificate(ctx, cert);
OPENSSL_assert(ret == 1);
X509_free(cert);
#endif
server = SSL_new(ctx);
in = BIO_new(BIO_s_mem());
out = BIO_new(BIO_s_mem());
SSL_set_bio(server, in, out);
SSL_set_accept_state(server);
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
if (SSL_do_handshake(server) == 1) {
/* Keep reading application data until error or EOF. */
uint8_t tmp[1024];
for (;;) {
if (SSL_read(server, tmp, sizeof(tmp)) <= 0) {
break;
}
}
}
SSL_free(server);
ERR_clear_error();
SSL_CTX_free(ctx);
return 0;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

View File

@@ -0,0 +1,12 @@
FUNCS_TO_AVOID
OPENSSL_init_crypto
ossl_property
CRYPTO_THREAD_run_once
OPENSSL_die
default_context_do_init
FILES_TO_AVOID
mem.c
mem_sec.c
err.c
buffer.c
packet.c

View File

@@ -0,0 +1,168 @@
/*
* Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/core_names.h>
#include <openssl/rand.h>
#include <openssl/provider.h>
#include "fuzzer.h"
static OSSL_FUNC_rand_newctx_fn fuzz_rand_newctx;
static OSSL_FUNC_rand_freectx_fn fuzz_rand_freectx;
static OSSL_FUNC_rand_instantiate_fn fuzz_rand_instantiate;
static OSSL_FUNC_rand_uninstantiate_fn fuzz_rand_uninstantiate;
static OSSL_FUNC_rand_generate_fn fuzz_rand_generate;
static OSSL_FUNC_rand_gettable_ctx_params_fn fuzz_rand_gettable_ctx_params;
static OSSL_FUNC_rand_get_ctx_params_fn fuzz_rand_get_ctx_params;
static OSSL_FUNC_rand_enable_locking_fn fuzz_rand_enable_locking;
static void *fuzz_rand_newctx(
void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch)
{
int *st = OPENSSL_malloc(sizeof(*st));
if (st != NULL)
*st = EVP_RAND_STATE_UNINITIALISED;
return st;
}
static void fuzz_rand_freectx(ossl_unused void *vrng)
{
OPENSSL_free(vrng);
}
static int fuzz_rand_instantiate(ossl_unused void *vrng,
ossl_unused unsigned int strength,
ossl_unused int prediction_resistance,
ossl_unused const unsigned char *pstr,
ossl_unused size_t pstr_len,
ossl_unused const OSSL_PARAM params[])
{
*(int *)vrng = EVP_RAND_STATE_READY;
return 1;
}
static int fuzz_rand_uninstantiate(ossl_unused void *vrng)
{
*(int *)vrng = EVP_RAND_STATE_UNINITIALISED;
return 1;
}
static int fuzz_rand_generate(ossl_unused void *vdrbg,
unsigned char *out, size_t outlen,
ossl_unused unsigned int strength,
ossl_unused int prediction_resistance,
ossl_unused const unsigned char *adin,
ossl_unused size_t adinlen)
{
unsigned char val = 1;
size_t i;
for (i = 0; i < outlen; i++)
out[i] = val++;
return 1;
}
static int fuzz_rand_enable_locking(ossl_unused void *vrng)
{
return 1;
}
static int fuzz_rand_get_ctx_params(void *vrng, OSSL_PARAM params[])
{
OSSL_PARAM *p;
p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STATE);
if (p != NULL && !OSSL_PARAM_set_int(p, *(int *)vrng))
return 0;
p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_STRENGTH);
if (p != NULL && !OSSL_PARAM_set_int(p, 500))
return 0;
p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_MAX_REQUEST);
if (p != NULL && !OSSL_PARAM_set_size_t(p, INT_MAX))
return 0;
return 1;
}
static const OSSL_PARAM *fuzz_rand_gettable_ctx_params(ossl_unused void *vrng,
ossl_unused void *provctx)
{
static const OSSL_PARAM known_gettable_ctx_params[] = {
OSSL_PARAM_int(OSSL_RAND_PARAM_STATE, NULL),
OSSL_PARAM_uint(OSSL_RAND_PARAM_STRENGTH, NULL),
OSSL_PARAM_size_t(OSSL_RAND_PARAM_MAX_REQUEST, NULL),
OSSL_PARAM_END
};
return known_gettable_ctx_params;
}
static const OSSL_DISPATCH fuzz_rand_functions[] = {
{ OSSL_FUNC_RAND_NEWCTX, (void (*)(void))fuzz_rand_newctx },
{ OSSL_FUNC_RAND_FREECTX, (void (*)(void))fuzz_rand_freectx },
{ OSSL_FUNC_RAND_INSTANTIATE, (void (*)(void))fuzz_rand_instantiate },
{ OSSL_FUNC_RAND_UNINSTANTIATE, (void (*)(void))fuzz_rand_uninstantiate },
{ OSSL_FUNC_RAND_GENERATE, (void (*)(void))fuzz_rand_generate },
{ OSSL_FUNC_RAND_ENABLE_LOCKING, (void (*)(void))fuzz_rand_enable_locking },
{ OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS,
(void(*)(void))fuzz_rand_gettable_ctx_params },
{ OSSL_FUNC_RAND_GET_CTX_PARAMS, (void(*)(void))fuzz_rand_get_ctx_params },
OSSL_DISPATCH_END
};
static const OSSL_ALGORITHM fuzz_rand_rand[] = {
{ "fuzz", "provider=fuzz-rand", fuzz_rand_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM *fuzz_rand_query(void *provctx,
int operation_id,
int *no_cache)
{
*no_cache = 0;
switch (operation_id) {
case OSSL_OP_RAND:
return fuzz_rand_rand;
}
return NULL;
}
/* Functions we provide to the core */
static const OSSL_DISPATCH fuzz_rand_method[] = {
{ OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))OSSL_LIB_CTX_free },
{ OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))fuzz_rand_query },
OSSL_DISPATCH_END
};
static int fuzz_rand_provider_init(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH *in,
const OSSL_DISPATCH **out, void **provctx)
{
*provctx = OSSL_LIB_CTX_new();
if (*provctx == NULL)
return 0;
*out = fuzz_rand_method;
return 1;
}
static OSSL_PROVIDER *r_prov;
void FuzzerSetRand(void)
{
if (!OSSL_PROVIDER_add_builtin(NULL, "fuzz-rand", fuzz_rand_provider_init)
|| !RAND_set_DRBG_type(NULL, "fuzz", NULL, NULL, NULL)
|| (r_prov = OSSL_PROVIDER_try_load(NULL, "fuzz-rand", 1)) == NULL)
exit(1);
}
void FuzzerClearRand(void)
{
OSSL_PROVIDER_unload(r_prov);
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <stddef.h> /* for size_t */
#include <openssl/e_os2.h> /* for uint8_t */
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
int FuzzerInitialize(int *argc, char ***argv);
void FuzzerCleanup(void);
void FuzzerSetRand(void);
void FuzzerClearRand(void);

BIN
openssl-3.4.2/fuzz/hashtable-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fuzz/hashtable-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,13 @@
fuzz/hashtable-test-bin-hashtable.o: fuzz/hashtable.c \
include/openssl/err.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/types.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/bio.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/bioerr.h include/openssl/lhash.h \
include/internal/common.h include/internal/e_os.h \
include/internal/numbers.h include/internal/nelem.h \
include/internal/hashtable.h include/internal/rcu.h \
include/crypto/context.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/hashtable-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,393 @@
/*
* Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
/*
* Test hashtable operation.
*/
#include <limits.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include <internal/common.h>
#include <internal/hashtable.h>
#include "fuzzer.h"
/*
* Make the key space very small here to make lookups
* easy to predict for the purposes of validation
* A two byte key gives us 65536 possible entries
* so we can allocate a flat table to compare to
*/
HT_START_KEY_DEFN(fuzzer_key)
HT_DEF_KEY_FIELD(fuzzkey, uint16_t)
HT_END_KEY_DEFN(FUZZER_KEY)
#define FZ_FLAG_ALLOCATED (1 << 0)
typedef struct fuzzer_value_st {
uint64_t flags;
uint64_t value;
} FUZZER_VALUE;
IMPLEMENT_HT_VALUE_TYPE_FNS(FUZZER_VALUE, fz, static)
static size_t skipped_values = 0;
static size_t inserts = 0;
static size_t replacements = 0;
static size_t deletes = 0;
static size_t flushes = 0;
static size_t lookups = 0;
static size_t foreaches = 0;
static size_t filters = 0;
static int valfound;
static FUZZER_VALUE *prediction_table = NULL;
static HT *fuzzer_table = NULL;
/*
* Operational values
*/
#define OP_INSERT 0
#define OP_DELETE 1
#define OP_LOOKUP 2
#define OP_FLUSH 3
#define OP_FOREACH 4
#define OP_FILTER 5
#define OP_END 6
#define OP_MASK 0x3f
#define INSERT_REPLACE_MASK 0x40
#define OPERATION(x) (((x) & OP_MASK) % OP_END)
#define IS_REPLACE(x) ((x) & INSERT_REPLACE_MASK)
static int table_iterator(HT_VALUE *v, void *arg)
{
uint16_t keyval = (*(uint16_t *)arg);
FUZZER_VALUE *f = ossl_ht_fz_FUZZER_VALUE_from_value(v);
if (f != NULL && f == &prediction_table[keyval]) {
valfound = 1;
return 0;
}
return 1;
}
static int filter_iterator(HT_VALUE *v, void *arg)
{
uint16_t keyval = (*(uint16_t *)arg);
FUZZER_VALUE *f = ossl_ht_fz_FUZZER_VALUE_from_value(v);
if (f != NULL && f == &prediction_table[keyval])
return 1;
return 0;
}
static void fuzz_free_cb(HT_VALUE *v)
{
FUZZER_VALUE *f = ossl_ht_fz_FUZZER_VALUE_from_value(v);
if (f != NULL)
f->flags &= ~FZ_FLAG_ALLOCATED;
}
int FuzzerInitialize(int *argc, char ***argv)
{
HT_CONFIG fuzz_conf = {NULL, fuzz_free_cb, NULL, 0, 1};
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
prediction_table = OPENSSL_zalloc(sizeof(FUZZER_VALUE) * 65537);
if (prediction_table == NULL)
return -1;
fuzzer_table = ossl_ht_new(&fuzz_conf);
if (fuzzer_table == NULL) {
OPENSSL_free(prediction_table);
return -1;
}
return 0;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
uint8_t op_flags;
uint16_t keyval;
int rc;
int rc_prediction = 1;
size_t i;
FUZZER_VALUE *valptr, *lval;
FUZZER_KEY key;
HT_VALUE *v = NULL;
HT_VALUE tv;
HT_VALUE_LIST *htvlist;
/*
* We need at least 11 bytes to be able to do anything here
* 1 byte to detect the operation to perform, 2 bytes
* for the lookup key, and 8 bytes of value
*/
if (len < 11) {
skipped_values++;
return -1;
}
/*
* parse out our operation flags and key
*/
op_flags = buf[0];
memcpy(&keyval, &buf[1], sizeof(uint16_t));
/*
* Initialize our key
*/
HT_INIT_KEY(&key);
/*
* Now do our operation
*/
switch(OPERATION(op_flags)) {
case OP_INSERT:
valptr = &prediction_table[keyval];
/* reset our key */
HT_KEY_RESET(&key);
/* set the proper key value */
HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
/* lock the table */
ossl_ht_write_lock(fuzzer_table);
/*
* If the value to insert is already allocated
* then we expect a conflict in the insert
* i.e. we predict a return code of 0 instead
* of 1. On replacement, we expect it to succeed
* always
*/
if (valptr->flags & FZ_FLAG_ALLOCATED) {
if (!IS_REPLACE(op_flags))
rc_prediction = 0;
}
memcpy(&valptr->value, &buf[3], sizeof(uint64_t));
/*
* do the insert/replace
*/
if (IS_REPLACE(op_flags))
rc = ossl_ht_fz_FUZZER_VALUE_insert(fuzzer_table, TO_HT_KEY(&key),
valptr, &lval);
else
rc = ossl_ht_fz_FUZZER_VALUE_insert(fuzzer_table, TO_HT_KEY(&key),
valptr, NULL);
if (rc == -1)
/* failed to grow the hash table due to too many collisions */
break;
/*
* mark the entry as being allocated
*/
valptr->flags |= FZ_FLAG_ALLOCATED;
/*
* unlock the table
*/
ossl_ht_write_unlock(fuzzer_table);
/*
* Now check to make sure we did the right thing
*/
OPENSSL_assert(rc == rc_prediction);
/*
* successful insertion if there wasn't a conflict
*/
if (rc_prediction == 1)
IS_REPLACE(op_flags) ? replacements++ : inserts++;
break;
case OP_DELETE:
valptr = &prediction_table[keyval];
/* reset our key */
HT_KEY_RESET(&key);
/* set the proper key value */
HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
/* lock the table */
ossl_ht_write_lock(fuzzer_table);
/*
* If the value to delete is not already allocated
* then we expect a miss in the delete
* i.e. we predict a return code of 0 instead
* of 1
*/
if (!(valptr->flags & FZ_FLAG_ALLOCATED))
rc_prediction = 0;
/*
* do the delete
*/
rc = ossl_ht_delete(fuzzer_table, TO_HT_KEY(&key));
/*
* unlock the table
*/
ossl_ht_write_unlock(fuzzer_table);
/*
* Now check to make sure we did the right thing
*/
OPENSSL_assert(rc == rc_prediction);
/*
* once the unlock is done, the table rcu will have synced
* meaning the free function has run, so we can confirm now
* that the valptr is no longer allocated
*/
OPENSSL_assert(!(valptr->flags & FZ_FLAG_ALLOCATED));
/*
* successful deletion if there wasn't a conflict
*/
if (rc_prediction == 1)
deletes++;
break;
case OP_LOOKUP:
valptr = &prediction_table[keyval];
lval = NULL;
/* reset our key */
HT_KEY_RESET(&key);
/* set the proper key value */
HT_SET_KEY_FIELD(&key, fuzzkey, keyval);
/* lock the table for reading */
ossl_ht_read_lock(fuzzer_table);
/*
* If the value to find is not already allocated
* then we expect a miss in the lookup
* i.e. we predict a return code of NULL instead
* of a pointer
*/
if (!(valptr->flags & FZ_FLAG_ALLOCATED))
valptr = NULL;
/*
* do the lookup
*/
lval = ossl_ht_fz_FUZZER_VALUE_get(fuzzer_table, TO_HT_KEY(&key), &v);
/*
* unlock the table
*/
ossl_ht_read_unlock(fuzzer_table);
/*
* Now check to make sure we did the right thing
*/
OPENSSL_assert(lval == valptr);
/*
* if we expect a positive lookup, make sure that
* we can use the _type and to_value functions
*/
if (valptr != NULL) {
OPENSSL_assert(ossl_ht_fz_FUZZER_VALUE_type(v) == 1);
v = ossl_ht_fz_FUZZER_VALUE_to_value(lval, &tv);
OPENSSL_assert(v->value == lval);
}
/*
* successful lookup if we didn't expect a miss
*/
if (valptr != NULL)
lookups++;
break;
case OP_FLUSH:
/*
* only flush the table rarely
*/
if ((flushes % 100000) != 1) {
skipped_values++;
flushes++;
return 0;
}
/*
* lock the table
*/
ossl_ht_write_lock(fuzzer_table);
ossl_ht_flush(fuzzer_table);
ossl_ht_write_unlock(fuzzer_table);
/*
* now check to make sure everything is free
*/
for (i = 0; i < USHRT_MAX; i++)
OPENSSL_assert((prediction_table[i].flags & FZ_FLAG_ALLOCATED) == 0);
/* good flush */
flushes++;
break;
case OP_FOREACH:
valfound = 0;
valptr = &prediction_table[keyval];
rc_prediction = 0;
if (valptr->flags & FZ_FLAG_ALLOCATED)
rc_prediction = 1;
ossl_ht_foreach_until(fuzzer_table, table_iterator, &keyval);
OPENSSL_assert(valfound == rc_prediction);
foreaches++;
break;
case OP_FILTER:
valptr = &prediction_table[keyval];
rc_prediction = 0;
if (valptr->flags & FZ_FLAG_ALLOCATED)
rc_prediction = 1;
htvlist = ossl_ht_filter(fuzzer_table, 1, filter_iterator, &keyval);
OPENSSL_assert(htvlist->list_len == (size_t)rc_prediction);
ossl_ht_value_list_free(htvlist);
filters++;
break;
default:
return -1;
}
return 0;
}
void FuzzerCleanup(void)
{
ossl_ht_free(fuzzer_table);
OPENSSL_free(prediction_table);
OPENSSL_cleanup();
}

52
openssl-3.4.2/fuzz/helper.py Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python3
#
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
"""Fuzzing helper, creates and uses corpus/crash directories.
fuzzer.py <fuzzer> <extra fuzzer arguments>
"""
import os
import subprocess
import sys
FUZZER = sys.argv[1]
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
CORPORA_DIR = os.path.abspath(os.path.join(THIS_DIR, "corpora"))
FUZZER_DIR = os.path.abspath(os.path.join(CORPORA_DIR, FUZZER))
if not os.path.isdir(FUZZER_DIR):
os.mkdir(FUZZER_DIR)
corpora = []
def _create(d):
dd = os.path.abspath(os.path.join(CORPORA_DIR, d))
if not os.path.isdir(dd):
os.mkdir(dd)
corpora.append(dd)
def _add(d):
dd = os.path.abspath(os.path.join(CORPORA_DIR, d))
if os.path.isdir(dd):
corpora.append(dd)
def main():
_create(FUZZER)
_create(FUZZER + "-crash")
_add(FUZZER + "-seed")
cmd = ([os.path.abspath(os.path.join(THIS_DIR, FUZZER))] + sys.argv[2:]
+ ["-artifact_prefix=" + corpora[1] + "/"] + corpora)
print(" ".join(cmd))
subprocess.call(cmd)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,42 @@
#! /usr/bin/env perl
# Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
use FindBin;
use lib "$FindBin::Bin/../util/perl";
use OpenSSL::copyright;
my $obj_dat_h = $ARGV[0];
my $YEAR = OpenSSL::copyright::latest(($0, $obj_dat_h));
print <<"EOF";
# WARNING: do not edit!
# Generated by fuzz/mkfuzzoids.pl
#
# Copyright 2020-$YEAR The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
EOF
open IN, '<', $obj_dat_h
|| die "Couldn't open $obj_dat_h : $!\n";
while(<IN>) {
s|\R$||; # Better chomp
next unless m|^\s+((0x[0-9A-F][0-9A-F],)*)\s+/\*\s\[\s*\d+\]\s(OBJ_\w+)\s\*/$|;
my $OID = $1;
my $OBJname = $3;
$OID =~ s|0x|\\x|g;
$OID =~ s|,||g;
print "$OBJname=\"$OID\"\n";
}
close IN;

1183
openssl-3.4.2/fuzz/oids.txt Normal file

File diff suppressed because it is too large Load Diff

BIN
openssl-3.4.2/fuzz/pem-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
fuzz/pem-test-bin-pem.o: fuzz/pem.c include/openssl/pem.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/e_os2.h include/openssl/bio.h include/openssl/crypto.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h include/openssl/bioerr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/ec.h include/openssl/ecerr.h \
include/openssl/rsa.h include/openssl/rsaerr.h include/openssl/dsa.h \
include/openssl/dh.h include/openssl/dherr.h include/openssl/dsaerr.h \
include/openssl/sha.h include/openssl/x509err.h \
include/openssl/x509_vfy.h include/openssl/lhash.h \
include/openssl/pkcs7.h include/openssl/pkcs7err.h \
include/openssl/http.h include/openssl/conf.h include/openssl/conferr.h \
include/openssl/conftypes.h include/openssl/pemerr.h \
include/openssl/err.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/pem-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

59
openssl-3.4.2/fuzz/pem.c Normal file
View File

@@ -0,0 +1,59 @@
/*
* Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/pem.h>
#include <openssl/err.h>
#include "fuzzer.h"
int FuzzerInitialize(int *argc, char ***argv)
{
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
BIO *in;
char *name = NULL, *header = NULL;
unsigned char *data = NULL;
long outlen;
if (len <= 1)
return 0;
in = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(in, buf + 1, len - 1) == len - 1);
if (PEM_read_bio_ex(in, &name, &header, &data, &outlen, buf[0]) == 1) {
/* Try to read all the data we get to see if allocated properly. */
BIO_write(in, name, strlen(name));
BIO_write(in, header, strlen(header));
BIO_write(in, data, outlen);
}
if (buf[0] & PEM_FLAG_SECURE) {
OPENSSL_secure_free(name);
OPENSSL_secure_free(header);
OPENSSL_secure_free(data);
} else {
OPENSSL_free(name);
OPENSSL_free(header);
OPENSSL_free(data);
}
BIO_free(in);
ERR_clear_error();
return 0;
}
void FuzzerCleanup(void)
{
}

BIN
openssl-3.4.2/fuzz/provider-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,14 @@
fuzz/provider-test-bin-provider.o: fuzz/provider.c \
include/openssl/types.h include/openssl/e_os2.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/core_names.h include/openssl/kdf.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/provider-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,658 @@
/*
* Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <string.h>
#include <openssl/types.h>
#include <openssl/crypto.h>
#include <openssl/core_names.h>
#include <openssl/kdf.h>
#include <openssl/evp.h>
#include <openssl/provider.h>
#include "fuzzer.h"
#define DEFINE_ALGORITHMS(name, evp) DEFINE_STACK_OF(evp) \
static int cmp_##evp(const evp *const *a, const evp *const *b); \
static void collect_##evp(evp *obj, void *stack); \
static void init_##name(OSSL_LIB_CTX *libctx); \
static void cleanup_##name(void); \
static STACK_OF(evp) *name##_collection; \
static int cmp_##evp(const evp *const *a, const evp *const *b) \
{ \
return strcmp(OSSL_PROVIDER_get0_name(evp##_get0_provider(*a)), \
OSSL_PROVIDER_get0_name(evp##_get0_provider(*b))); \
} \
static void collect_##evp(evp *obj, void *stack) \
{ \
STACK_OF(evp) *obj_stack = stack; \
\
if (sk_##evp##_push(obj_stack, obj) > 0) \
evp##_up_ref(obj); \
} \
static void init_##name(OSSL_LIB_CTX *libctx) \
{ \
name##_collection = sk_##evp##_new(cmp_##evp); \
evp##_do_all_provided(libctx, collect_##evp, name##_collection); \
} \
static void cleanup_##name(void) \
{ \
sk_##evp##_pop_free(name##_collection, evp##_free); \
}
DEFINE_ALGORITHMS(digests, EVP_MD)
DEFINE_ALGORITHMS(kdf, EVP_KDF)
DEFINE_ALGORITHMS(cipher, EVP_CIPHER)
DEFINE_ALGORITHMS(kem, EVP_KEM)
DEFINE_ALGORITHMS(keyexch, EVP_KEYEXCH)
DEFINE_ALGORITHMS(rand, EVP_RAND)
DEFINE_ALGORITHMS(mac, EVP_MAC)
DEFINE_ALGORITHMS(keymgmt, EVP_KEYMGMT)
DEFINE_ALGORITHMS(signature, EVP_SIGNATURE)
DEFINE_ALGORITHMS(asym_ciphers, EVP_ASYM_CIPHER)
static OSSL_LIB_CTX *libctx = NULL;
int FuzzerInitialize(int *argc, char ***argv)
{
libctx = OSSL_LIB_CTX_new();
if (libctx == NULL)
return 0;
init_digests(libctx);
init_kdf(libctx);
init_cipher(libctx);
init_kem(libctx);
init_keyexch(libctx);
init_rand(libctx);
init_mac(libctx);
init_keymgmt(libctx);
init_signature(libctx);
init_asym_ciphers(libctx);
return 1;
}
void FuzzerCleanup(void)
{
cleanup_digests();
cleanup_kdf();
cleanup_cipher();
cleanup_kem();
cleanup_keyexch();
cleanup_rand();
cleanup_mac();
cleanup_keymgmt();
cleanup_signature();
cleanup_asym_ciphers();
OSSL_LIB_CTX_free(libctx);
}
static int read_uint(const uint8_t **buf, size_t *len, uint64_t **res)
{
int r = 1;
if (*len < sizeof(uint64_t)) {
r = 0;
goto end;
}
*res = OPENSSL_malloc(sizeof(uint64_t));
**res = (uint64_t) **buf;
*buf += sizeof(uint64_t);
*len -= sizeof(uint64_t);
end:
return r;
}
static int read_int(const uint8_t **buf, size_t *len, int64_t **res)
{
int r = 1;
if (*len < sizeof(int64_t)) {
r = 0;
goto end;
}
*res = OPENSSL_malloc(sizeof(int64_t));
**res = (int64_t) **buf;
*buf += sizeof(int64_t);
*len -= sizeof(int64_t);
end:
return r;
}
static int read_double(const uint8_t **buf, size_t *len, double **res)
{
int r = 1;
if (*len < sizeof(double)) {
r = 0;
goto end;
}
*res = OPENSSL_malloc(sizeof(double));
**res = (double) **buf;
*buf += sizeof(double);
*len -= sizeof(double);
end:
return r;
}
static int read_utf8_string(const uint8_t **buf, size_t *len, char **res)
{
size_t found_len;
int r;
found_len = OPENSSL_strnlen((const char *) *buf, *len);
if (found_len == *len) {
r = -1;
goto end;
}
found_len++; /* skip over the \0 byte */
r = (int) found_len;
*res = (char *) *buf;
*len -= found_len;
*buf = *buf + found_len; /* continue after the \0 byte */
end:
return r;
}
static int read_utf8_ptr(const uint8_t **buf, size_t *len, char **res)
{
if (*len > 0 && **buf == 0xFF) {
/* represent NULL somehow */
*res = NULL;
*buf += 1;
*len -= 1;
return 0;
}
return read_utf8_string(buf, len, res);
}
static int read_octet_string(const uint8_t **buf, size_t *len, char **res)
{
int r;
size_t i;
const uint8_t *ptr = *buf;
int found = 0;
for (i = 0; i < *len; ++i) {
if (*ptr == 0xFF &&
(i + 1 < *len && *(ptr + 1) == 0xFF)) {
ptr++;
found = 1;
break;
}
ptr++;
}
if (!found) {
r = -1;
goto end;
}
*res = (char *) *buf;
r = ptr - *buf;
*len -= r;
*buf = ptr;
end:
return r;
}
static int read_octet_ptr(const uint8_t **buf, size_t *len, char **res)
{
/* TODO: This representation could need an improvement potentially. */
if (*len > 1 && **buf == 0xFF && *(*buf + 1) == 0xFF) {
/* represent NULL somehow */
*res = NULL;
*buf += 2;
*len -= 2;
return 0;
}
return read_octet_string(buf, len, res);
}
static char *DFLT_STR = "";
static char *DFLT_UTF8_PTR = NULL;
static char *DFLT_OCTET_STRING = "";
static char *DFLT_OCTET_PTR = NULL;
static int64_t ITERS = 1;
static uint64_t UITERS = 1;
static int64_t BLOCKSIZE = 8;
static uint64_t UBLOCKSIZE = 8;
static void free_params(OSSL_PARAM *param)
{
for (; param != NULL && param->key != NULL; param++) {
switch (param->data_type) {
case OSSL_PARAM_INTEGER:
case OSSL_PARAM_UNSIGNED_INTEGER:
case OSSL_PARAM_REAL:
if (param->data != NULL) {
OPENSSL_free(param->data);
}
break;
}
}
}
static OSSL_PARAM *fuzz_params(OSSL_PARAM *param, const uint8_t **buf, size_t *len)
{
OSSL_PARAM *p;
OSSL_PARAM *fuzzed_parameters;
int p_num = 0;
for (p = param; p != NULL && p->key != NULL; p++)
p_num++;
fuzzed_parameters = OPENSSL_zalloc(sizeof(OSSL_PARAM) *(p_num + 1));
p = fuzzed_parameters;
for (; param != NULL && param->key != NULL; param++) {
int64_t *use_param = NULL;
int64_t *p_value_int = NULL;
uint64_t *p_value_uint = NULL;
double *p_value_double = NULL;
char *p_value_utf8_str = DFLT_STR;
char *p_value_octet_str = DFLT_OCTET_STRING;
char *p_value_utf8_ptr = DFLT_UTF8_PTR;
char *p_value_octet_ptr = DFLT_OCTET_PTR;
int data_len = 0;
if (!read_int(buf, len, &use_param)) {
use_param = OPENSSL_malloc(sizeof(uint64_t));
*use_param = 0;
}
switch (param->data_type) {
case OSSL_PARAM_INTEGER:
if (strcmp(param->key, OSSL_KDF_PARAM_ITER) == 0) {
p_value_int = OPENSSL_malloc(sizeof(ITERS));
*p_value_int = ITERS;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_N) == 0) {
p_value_int = OPENSSL_malloc(sizeof(ITERS));
*p_value_int = ITERS;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_R) == 0) {
p_value_int = OPENSSL_malloc(sizeof(BLOCKSIZE));
*p_value_int = BLOCKSIZE;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_P) == 0) {
p_value_int = OPENSSL_malloc(sizeof(BLOCKSIZE));
*p_value_int = BLOCKSIZE;
} else if (!*use_param || !read_int(buf, len, &p_value_int)) {
p_value_int = OPENSSL_malloc(sizeof(int64_t));
*p_value_int = 0;
}
*p = *param;
p->data = p_value_int;
p++;
break;
case OSSL_PARAM_UNSIGNED_INTEGER:
if (strcmp(param->key, OSSL_KDF_PARAM_ITER) == 0) {
p_value_uint = OPENSSL_malloc(sizeof(UITERS));
*p_value_uint = UITERS;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_N) == 0) {
p_value_uint = OPENSSL_malloc(sizeof(UITERS));
*p_value_uint = UITERS;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_R) == 0) {
p_value_uint = OPENSSL_malloc(sizeof(UBLOCKSIZE));
*p_value_uint = UBLOCKSIZE;
} else if (strcmp(param->key, OSSL_KDF_PARAM_SCRYPT_P) == 0) {
p_value_uint = OPENSSL_malloc(sizeof(UBLOCKSIZE));
*p_value_uint = UBLOCKSIZE;
} else if (!*use_param || !read_uint(buf, len, &p_value_uint)) {
p_value_uint = OPENSSL_malloc(sizeof(uint64_t));
*p_value_uint = 0;
}
*p = *param;
p->data = p_value_uint;
p++;
break;
case OSSL_PARAM_REAL:
if (!*use_param || !read_double(buf, len, &p_value_double)) {
p_value_double = OPENSSL_malloc(sizeof(double));
*p_value_double = 0;
}
*p = *param;
p->data = p_value_double;
p++;
break;
case OSSL_PARAM_UTF8_STRING:
if (*use_param && (data_len = read_utf8_string(buf, len, &p_value_utf8_str)) < 0)
data_len = 0;
*p = *param;
p->data = p_value_utf8_str;
p->data_size = data_len;
p++;
break;
case OSSL_PARAM_OCTET_STRING:
if (*use_param && (data_len = read_octet_string(buf, len, &p_value_octet_str)) < 0)
data_len = 0;
*p = *param;
p->data = p_value_octet_str;
p->data_size = data_len;
p++;
break;
case OSSL_PARAM_UTF8_PTR:
if (*use_param && (data_len = read_utf8_ptr(buf, len, &p_value_utf8_ptr)) < 0)
data_len = 0;
*p = *param;
p->data = p_value_utf8_ptr;
p->data_size = data_len;
p++;
break;
case OSSL_PARAM_OCTET_PTR:
if (*use_param && (data_len = read_octet_ptr(buf, len, &p_value_octet_ptr)) < 0)
data_len = 0;
*p = *param;
p->data = p_value_octet_ptr;
p->data_size = data_len;
p++;
break;
default:
break;
}
OPENSSL_free(use_param);
}
return fuzzed_parameters;
}
static int do_evp_cipher(const EVP_CIPHER *evp_cipher, const OSSL_PARAM param[])
{
unsigned char outbuf[1024];
int outlen, tmplen;
unsigned char key[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
unsigned char iv[] = {1, 2, 3, 4, 5, 6, 7, 8};
const char intext[] = "text";
EVP_CIPHER_CTX *ctx;
ctx = EVP_CIPHER_CTX_new();
if (!EVP_CIPHER_CTX_set_params(ctx, param)) {
EVP_CIPHER_CTX_free(ctx);
return 0;
}
if (!EVP_EncryptInit_ex2(ctx, evp_cipher, key, iv, NULL)) {
/* Error */
EVP_CIPHER_CTX_free(ctx);
return 0;
}
if (!EVP_EncryptUpdate(ctx, outbuf, &outlen, (const unsigned char *) intext, strlen(intext))) {
/* Error */
EVP_CIPHER_CTX_free(ctx);
return 0;
}
/*
* Buffer passed to EVP_EncryptFinal() must be after data just
* encrypted to avoid overwriting it.
*/
if (!EVP_EncryptFinal_ex(ctx, outbuf + outlen, &tmplen)) {
/* Error */
EVP_CIPHER_CTX_free(ctx);
return 0;
}
outlen += tmplen;
EVP_CIPHER_CTX_free(ctx);
return 1;
}
static int do_evp_kdf(EVP_KDF *evp_kdf, const OSSL_PARAM params[])
{
int r = 1;
EVP_KDF_CTX *kctx = NULL;
unsigned char derived[32];
kctx = EVP_KDF_CTX_new(evp_kdf);
if (kctx == NULL) {
r = 0;
goto end;
}
if (EVP_KDF_CTX_set_params(kctx, params) <= 0) {
r = 0;
goto end;
}
if (EVP_KDF_derive(kctx, derived, sizeof(derived), NULL) <= 0) {
r = 0;
goto end;
}
end:
EVP_KDF_CTX_free(kctx);
return r;
}
static int do_evp_mac(EVP_MAC *evp_mac, const OSSL_PARAM params[])
{
int r = 1;
const char *key = "mac_key";
char text[] = "Some Crypto Text";
EVP_MAC_CTX *ctx = NULL;
unsigned char buf[4096];
size_t final_l;
if ((ctx = EVP_MAC_CTX_new(evp_mac)) == NULL
|| !EVP_MAC_init(ctx, (const unsigned char *) key, strlen(key),
params)) {
r = 0;
goto end;
}
if (EVP_MAC_CTX_set_params(ctx, params) <= 0) {
r = 0;
goto end;
}
if (!EVP_MAC_update(ctx, (unsigned char *) text, sizeof(text))) {
r = 0;
goto end;
}
if (!EVP_MAC_final(ctx, buf, &final_l, sizeof(buf))) {
r = 0;
goto end;
}
end:
EVP_MAC_CTX_free(ctx);
return r;
}
static int do_evp_rand(EVP_RAND *evp_rand, const OSSL_PARAM params[])
{
int r = 1;
EVP_RAND_CTX *ctx = NULL;
unsigned char buf[4096];
if (!(ctx = EVP_RAND_CTX_new(evp_rand, NULL))) {
r = 0;
goto end;
}
if (EVP_RAND_CTX_set_params(ctx, params) <= 0) {
r = 0;
goto end;
}
if (!EVP_RAND_generate(ctx, buf, sizeof(buf), 0, 0, NULL, 0)) {
r = 0;
goto end;
}
if (!EVP_RAND_reseed(ctx, 0, 0, 0, NULL, 0)) {
r = 0;
goto end;
}
end:
EVP_RAND_CTX_free(ctx);
return r;
}
static int do_evp_sig(EVP_SIGNATURE *evp_sig, const OSSL_PARAM params[])
{
return 0;
}
static int do_evp_asym_cipher(EVP_ASYM_CIPHER *evp_asym_cipher, const OSSL_PARAM params[])
{
return 0;
}
static int do_evp_kem(EVP_KEM *evp_kem, const OSSL_PARAM params[])
{
return 0;
}
static int do_evp_key_exch(EVP_KEYEXCH *evp_kdf, const OSSL_PARAM params[])
{
return 0;
}
static int do_evp_md(EVP_MD *evp_md, const OSSL_PARAM params[])
{
int r = 1;
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len;
EVP_MD_CTX *mdctx = NULL;
if (!(mdctx = EVP_MD_CTX_new())) {
r = 0;
goto end;
}
if (!EVP_MD_CTX_set_params(mdctx, params)) {
r = 0;
goto end;
}
if (!EVP_DigestInit_ex2(mdctx, evp_md, NULL)) {
r = 0;
goto end;
}
if (!EVP_DigestUpdate(mdctx, "Test", strlen("Test"))) {
r = 0;
goto end;
}
if (!EVP_DigestFinal_ex(mdctx, md_value, &md_len)) {
r = 0;
goto end;
}
end:
EVP_MD_CTX_free(mdctx);
return r;
}
#define EVP_FUZZ(source, evp, f) \
do { \
evp *alg = sk_##evp##_value(source, *algorithm % sk_##evp##_num(source)); \
OSSL_PARAM *fuzzed_params; \
\
if (alg == NULL) \
break; \
fuzzed_params = fuzz_params((OSSL_PARAM*) evp##_settable_ctx_params(alg), &buf, &len); \
if (fuzzed_params != NULL) \
f(alg, fuzzed_params); \
free_params(fuzzed_params); \
OSSL_PARAM_free(fuzzed_params); \
} while (0);
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int r = 1;
uint64_t *operation = NULL;
int64_t *algorithm = NULL;
if (!read_uint(&buf, &len, &operation)) {
r = 0;
goto end;
}
if (!read_int(&buf, &len, &algorithm)) {
r = 0;
goto end;
}
switch (*operation % 10) {
case 0:
EVP_FUZZ(digests_collection, EVP_MD, do_evp_md);
break;
case 1:
EVP_FUZZ(cipher_collection, EVP_CIPHER, do_evp_cipher);
break;
case 2:
EVP_FUZZ(kdf_collection, EVP_KDF, do_evp_kdf);
break;
case 3:
EVP_FUZZ(mac_collection, EVP_MAC, do_evp_mac);
break;
case 4:
EVP_FUZZ(kem_collection, EVP_KEM, do_evp_kem);
break;
case 5:
EVP_FUZZ(rand_collection, EVP_RAND, do_evp_rand);
break;
case 6:
EVP_FUZZ(asym_ciphers_collection, EVP_ASYM_CIPHER, do_evp_asym_cipher);
break;
case 7:
EVP_FUZZ(signature_collection, EVP_SIGNATURE, do_evp_sig);
break;
case 8:
EVP_FUZZ(keyexch_collection, EVP_KEYEXCH, do_evp_key_exch);
break;
case 9:
/*
Implement and call:
static int do_evp_keymgmt(EVP_KEYMGMT *evp_kdf, const OSSL_PARAM params[])
{
return 0;
}
*/
/* not yet implemented */
break;
default:
r = 0;
goto end;
}
end:
OPENSSL_free(operation);
OPENSSL_free(algorithm);
return r;
}

BIN
openssl-3.4.2/fuzz/punycode-test Executable file

Binary file not shown.

View File

@@ -0,0 +1,9 @@
fuzz/punycode-test-bin-punycode.o: fuzz/punycode.c \
include/crypto/punycode.h include/internal/nelem.h \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h

View File

@@ -0,0 +1,8 @@
fuzz/punycode-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include "crypto/punycode.h"
#include "internal/nelem.h"
#include <openssl/crypto.h>
#include "fuzzer.h"
#include <stdio.h>
#include <string.h>
int FuzzerInitialize(int *argc, char ***argv)
{
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
char *b;
unsigned int out[16], outlen = OSSL_NELEM(out);
char outc[16];
b = OPENSSL_malloc(len + 1);
if (b != NULL) {
ossl_punycode_decode((const char *)buf, len, out, &outlen);
memcpy(b, buf, len);
b[len] = '\0';
ossl_a2ulabel(b, outc, sizeof(outc));
OPENSSL_free(b);
}
return 0;
}
void FuzzerCleanup(void)
{
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fuzz/quic-client-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,47 @@
fuzz/quic-client-test-bin-quic-client.o: fuzz/quic-client.c \
include/openssl/ssl.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/crypto.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/types.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/comperr.h include/openssl/bio.h include/openssl/bioerr.h \
include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/pem.h include/openssl/pemerr.h include/openssl/hmac.h \
include/openssl/async.h include/openssl/asyncerr.h include/openssl/ct.h \
include/openssl/cterr.h include/openssl/sslerr.h \
include/openssl/sslerr_legacy.h include/openssl/prov_ssl.h \
include/openssl/ssl2.h include/openssl/ssl3.h include/openssl/tls1.h \
include/openssl/dtls1.h include/openssl/srtp.h include/openssl/quic.h \
include/openssl/err.h fuzz/fuzzer.h include/internal/sockets.h \
include/internal/time.h include/internal/e_os.h \
include/internal/numbers.h include/internal/safe_math.h \
include/internal/quic_ssl.h include/internal/quic_record_rx.h \
include/internal/quic_wire_pkt.h include/internal/packet_quic.h \
include/internal/packet.h include/internal/quic_vlint.h \
include/internal/quic_types.h include/internal/ssl.h \
include/internal/quic_predef.h include/internal/quic_record_util.h \
include/internal/quic_demux.h include/internal/bio_addr.h \
include/internal/list.h include/internal/quic_ackm.h \
include/internal/quic_statm.h include/internal/quic_cc.h \
include/internal/quic_wire.h include/internal/quic_channel.h \
include/internal/quic_record_tx.h include/internal/qlog.h \
include/internal/qlog_events.h include/internal/thread.h \
include/internal/thread_arch.h include/internal/cryptlib.h \
include/internal/common.h include/internal/nelem.h \
include/crypto/context.h

View File

@@ -0,0 +1,8 @@
fuzz/quic-client-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,269 @@
/*
* Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include "fuzzer.h"
#include "internal/sockets.h"
#include "internal/time.h"
#include "internal/quic_ssl.h"
/* unused, to avoid warning. */
static int idx;
static OSSL_TIME fake_now;
static OSSL_TIME fake_now_cb(void *arg)
{
return fake_now;
}
int FuzzerInitialize(int *argc, char ***argv)
{
STACK_OF(SSL_COMP) *comp_methods;
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
CRYPTO_free_ex_index(0, -1);
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
comp_methods = SSL_COMP_get_compression_methods();
if (comp_methods != NULL)
sk_SSL_COMP_sort(comp_methods);
return 1;
}
#define HANDSHAKING 0
#define READING 1
#define WRITING 2
#define ACCEPTING_STREAM 3
#define CREATING_STREAM 4
#define SWAPPING_STREAM 5
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
SSL *client = NULL, *stream = NULL;
SSL *allstreams[] = {NULL, NULL, NULL, NULL};
size_t i, thisstream = 0, numstreams = 1;
BIO *in;
BIO *out;
SSL_CTX *ctx;
BIO_ADDR *peer_addr = NULL;
struct in_addr ina = {0};
struct timeval tv;
int state = HANDSHAKING;
uint8_t tmp[1024];
int writelen = 0;
if (len == 0)
return 0;
/* This only fuzzes the initial flow from the client so far. */
ctx = SSL_CTX_new(OSSL_QUIC_client_method());
if (ctx == NULL)
goto end;
client = SSL_new(ctx);
if (client == NULL)
goto end;
fake_now = ossl_ms2time(1);
if (!ossl_quic_conn_set_override_now_cb(client, fake_now_cb, NULL))
goto end;
peer_addr = BIO_ADDR_new();
if (peer_addr == NULL)
goto end;
ina.s_addr = htonl(0x7f000001UL);
if (!BIO_ADDR_rawmake(peer_addr, AF_INET, &ina, sizeof(ina), htons(4433)))
goto end;
SSL_set_tlsext_host_name(client, "localhost");
in = BIO_new(BIO_s_dgram_mem());
if (in == NULL)
goto end;
out = BIO_new(BIO_s_dgram_mem());
if (out == NULL) {
BIO_free(in);
goto end;
}
if (!BIO_dgram_set_caps(out, BIO_DGRAM_CAP_HANDLES_DST_ADDR)) {
BIO_free(in);
BIO_free(out);
goto end;
}
SSL_set_bio(client, in, out);
if (SSL_set_alpn_protos(client, (const unsigned char *)"\x08ossltest", 9) != 0)
goto end;
if (SSL_set1_initial_peer_addr(client, peer_addr) != 1)
goto end;
SSL_set_connect_state(client);
if (!SSL_set_incoming_stream_policy(client,
SSL_INCOMING_STREAM_POLICY_ACCEPT,
0))
goto end;
allstreams[0] = stream = client;
for (;;) {
size_t size;
uint64_t nxtpktms = 0;
OSSL_TIME nxtpkt = ossl_time_zero(), nxttimeout;
int isinf, ret = 0;
if (len >= 2) {
if (len >= 5 && buf[0] == 0xff && buf[1] == 0xff) {
switch (buf[2]) {
case 0x00:
if (state == READING)
state = ACCEPTING_STREAM;
break;
case 0x01:
if (state == READING)
state = CREATING_STREAM;
break;
case 0x02:
if (state == READING)
state = SWAPPING_STREAM;
break;
default:
/*ignore*/
break;
}
len -= 3;
buf += 3;
}
nxtpktms = buf[0] + (buf[1] << 8);
nxtpkt = ossl_time_add(fake_now, ossl_ms2time(nxtpktms));
len -= 2;
buf += 2;
}
for (;;) {
switch (state) {
case HANDSHAKING:
ret = SSL_do_handshake(stream);
if (ret == 1)
state = READING;
break;
case READING:
ret = SSL_read(stream, tmp, sizeof(tmp));
if (ret > 0) {
state = WRITING;
writelen = ret;
assert(writelen <= (int)sizeof(tmp));
}
break;
case WRITING:
ret = SSL_write(stream, tmp, writelen);
if (ret > 0)
state = READING;
break;
case ACCEPTING_STREAM:
state = READING;
ret = 1;
if (numstreams == OSSL_NELEM(allstreams)
|| SSL_get_accept_stream_queue_len(client) == 0)
break;
thisstream = numstreams;
stream = allstreams[numstreams++]
= SSL_accept_stream(client, 0);
if (stream == NULL)
goto end;
break;
case CREATING_STREAM:
state = READING;
ret = 1;
if (numstreams == OSSL_NELEM(allstreams))
break;
stream = SSL_new_stream(client, 0);
if (stream == NULL) {
/* Ignore, and go back to the previous stream */
stream = allstreams[thisstream];
break;
}
thisstream = numstreams;
allstreams[numstreams++] = stream;
break;
case SWAPPING_STREAM:
state = READING;
ret = 1;
if (numstreams == 1)
break;
if (++thisstream == numstreams)
thisstream = 0;
stream = allstreams[thisstream];
break;
}
assert(stream != NULL);
assert(thisstream < numstreams);
if (ret <= 0) {
switch (SSL_get_error(stream, ret)) {
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
break;
default:
goto end;
}
}
if (!SSL_get_event_timeout(client, &tv, &isinf))
goto end;
if (isinf) {
fake_now = nxtpkt;
break;
} else {
nxttimeout = ossl_time_add(fake_now,
ossl_time_from_timeval(tv));
if (len > 3 && ossl_time_compare(nxttimeout, nxtpkt) >= 0) {
fake_now = nxtpkt;
break;
}
fake_now = nxttimeout;
}
}
if (len <= 3)
break;
size = buf[0] + (buf[1] << 8);
if (size > len - 2)
break;
if (size > 0)
BIO_write(in, buf+2, size);
len -= size + 2;
buf += size + 2;
}
end:
for (i = 0; i < numstreams; i++)
SSL_free(allstreams[i]);
ERR_clear_error();
SSL_CTX_free(ctx);
BIO_ADDR_free(peer_addr);
return 0;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fuzz/quic-lcidm-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

View File

@@ -0,0 +1,37 @@
fuzz/quic-lcidm-test-bin-quic-lcidm.o: fuzz/quic-lcidm.c \
include/openssl/ssl.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/e_ostime.h include/openssl/comp.h \
include/openssl/crypto.h include/openssl/safestack.h \
include/openssl/stack.h include/openssl/types.h \
include/openssl/cryptoerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
include/openssl/comperr.h include/openssl/bio.h include/openssl/bioerr.h \
include/openssl/x509.h include/openssl/buffer.h \
include/openssl/buffererr.h include/openssl/evp.h \
include/openssl/core_dispatch.h include/openssl/indicator.h \
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
include/openssl/evperr.h include/openssl/objects.h \
include/openssl/obj_mac.h include/openssl/asn1.h \
include/openssl/asn1err.h include/openssl/objectserr.h \
include/openssl/ec.h include/openssl/ecerr.h include/openssl/rsa.h \
include/openssl/rsaerr.h include/openssl/dsa.h include/openssl/dh.h \
include/openssl/dherr.h include/openssl/dsaerr.h include/openssl/sha.h \
include/openssl/x509err.h include/openssl/x509_vfy.h \
include/openssl/lhash.h include/openssl/pkcs7.h \
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/conf.h \
include/openssl/conferr.h include/openssl/conftypes.h \
include/openssl/pem.h include/openssl/pemerr.h include/openssl/hmac.h \
include/openssl/async.h include/openssl/asyncerr.h include/openssl/ct.h \
include/openssl/cterr.h include/openssl/sslerr.h \
include/openssl/sslerr_legacy.h include/openssl/prov_ssl.h \
include/openssl/ssl2.h include/openssl/ssl3.h include/openssl/tls1.h \
include/openssl/dtls1.h include/openssl/srtp.h include/openssl/quic.h \
include/openssl/err.h fuzz/fuzzer.h include/internal/quic_lcidm.h \
include/internal/e_os.h include/internal/numbers.h \
include/internal/time.h include/internal/safe_math.h \
include/internal/quic_types.h include/internal/ssl.h \
include/internal/quic_wire.h include/internal/packet_quic.h \
include/internal/packet.h include/internal/quic_vlint.h \
include/internal/quic_predef.h

View File

@@ -0,0 +1,8 @@
fuzz/quic-lcidm-test-bin-test-corpus.o: fuzz/test-corpus.c \
include/openssl/crypto.h include/openssl/macros.h \
include/openssl/opensslconf.h include/openssl/configuration.h \
include/openssl/opensslv.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/types.h include/openssl/cryptoerr.h \
include/openssl/symhacks.h include/openssl/cryptoerr_legacy.h \
include/openssl/core.h fuzz/fuzzer.h include/internal/o_dir.h

View File

@@ -0,0 +1,186 @@
/*
* Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include "fuzzer.h"
#include "internal/quic_lcidm.h"
#include "internal/packet.h"
int FuzzerInitialize(int *argc, char ***argv)
{
FuzzerSetRand();
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
ERR_clear_error();
return 1;
}
/*
* Fuzzer input "protocol":
* Big endian
* u8(LCID length)
* Zero or more of:
* ENROL_ODCID u0(0x00) u64(opaque) u8(cidl):cid
* RETIRE_ODCID u8(0x01) u64(opaque)
* GENERATE_INITIAL u8(0x02) u64(opaque)
* GENERATE u8(0x03) u64(opaque)
* RETIRE u8(0x04) u64(opaque) u64(retire_prior_to)
* CULL u8(0x05) u64(opaque)
* LOOKUP u8(0x06) u8(cidl):cid
*/
enum {
CMD_ENROL_ODCID,
CMD_RETIRE_ODCID,
CMD_GENERATE_INITIAL,
CMD_GENERATE,
CMD_RETIRE,
CMD_CULL,
CMD_LOOKUP
};
#define MAX_CMDS 10000
static int get_cid(PACKET *pkt, QUIC_CONN_ID *cid)
{
unsigned int cidl;
if (!PACKET_get_1(pkt, &cidl)
|| cidl > QUIC_MAX_CONN_ID_LEN
|| !PACKET_copy_bytes(pkt, cid->id, cidl))
return 0;
cid->id_len = (unsigned char)cidl;
return 1;
}
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
{
int rc = 0;
QUIC_LCIDM *lcidm = NULL;
PACKET pkt;
uint64_t arg_opaque, arg_retire_prior_to, seq_num_out;
unsigned int cmd, lcidl;
QUIC_CONN_ID arg_cid, cid_out;
OSSL_QUIC_FRAME_NEW_CONN_ID ncid_frame;
int did_retire;
void *opaque_out;
size_t limit = 0;
if (!PACKET_buf_init(&pkt, buf, len))
goto err;
if (!PACKET_get_1(&pkt, &lcidl)
|| lcidl > QUIC_MAX_CONN_ID_LEN) {
rc = -1;
goto err;
}
if ((lcidm = ossl_quic_lcidm_new(NULL, lcidl)) == NULL) {
rc = -1;
goto err;
}
while (PACKET_remaining(&pkt) > 0) {
if (!PACKET_get_1(&pkt, &cmd))
goto err;
if (++limit > MAX_CMDS)
goto err;
switch (cmd) {
case CMD_ENROL_ODCID:
if (!PACKET_get_net_8(&pkt, &arg_opaque)
|| !get_cid(&pkt, &arg_cid)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_enrol_odcid(lcidm, (void *)(uintptr_t)arg_opaque,
&arg_cid);
break;
case CMD_RETIRE_ODCID:
if (!PACKET_get_net_8(&pkt, &arg_opaque)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_retire_odcid(lcidm, (void *)(uintptr_t)arg_opaque);
break;
case CMD_GENERATE_INITIAL:
if (!PACKET_get_net_8(&pkt, &arg_opaque)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_generate_initial(lcidm, (void *)(uintptr_t)arg_opaque,
&cid_out);
break;
case CMD_GENERATE:
if (!PACKET_get_net_8(&pkt, &arg_opaque)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_generate(lcidm, (void *)(uintptr_t)arg_opaque,
&ncid_frame);
break;
case CMD_RETIRE:
if (!PACKET_get_net_8(&pkt, &arg_opaque)
|| !PACKET_get_net_8(&pkt, &arg_retire_prior_to)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_retire(lcidm, (void *)(uintptr_t)arg_opaque,
arg_retire_prior_to,
NULL, &cid_out,
&seq_num_out, &did_retire);
break;
case CMD_CULL:
if (!PACKET_get_net_8(&pkt, &arg_opaque)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_cull(lcidm, (void *)(uintptr_t)arg_opaque);
break;
case CMD_LOOKUP:
if (!get_cid(&pkt, &arg_cid)) {
rc = -1;
goto err;
}
ossl_quic_lcidm_lookup(lcidm, &arg_cid, &seq_num_out, &opaque_out);
break;
default:
rc = -1;
goto err;
}
}
err:
ossl_quic_lcidm_free(lcidm);
return rc;
}
void FuzzerCleanup(void)
{
FuzzerClearRand();
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fuzz/quic-rcidm-test-bin-fuzz_rand.o: fuzz/fuzz_rand.c \
include/openssl/core_names.h include/openssl/rand.h \
include/openssl/macros.h include/openssl/opensslconf.h \
include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/types.h include/openssl/e_os2.h \
include/openssl/safestack.h include/openssl/stack.h \
include/openssl/randerr.h include/openssl/symhacks.h \
include/openssl/cryptoerr_legacy.h include/openssl/evp.h \
include/openssl/core.h include/openssl/core_dispatch.h \
include/openssl/indicator.h include/openssl/params.h \
include/openssl/bn.h include/openssl/crypto.h \
include/openssl/cryptoerr.h include/openssl/bnerr.h \
include/openssl/bio.h include/openssl/bioerr.h include/openssl/evperr.h \
include/openssl/objects.h include/openssl/obj_mac.h \
include/openssl/asn1.h include/openssl/asn1err.h \
include/openssl/objectserr.h include/openssl/provider.h fuzz/fuzzer.h

Some files were not shown because too many files have changed in this diff Show More