mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Upgrade openssl from 1.1.0e to 1.1.1b, with source code. 4.0.78
This commit is contained in:
parent
8f1c992379
commit
96dbd7bced
1476 changed files with 616554 additions and 4 deletions
131
trunk/3rdparty/openssl-1.1-fit/fuzz/README.md
vendored
Normal file
131
trunk/3rdparty/openssl-1.1-fit/fuzz/README.md
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
# I Can Haz Fuzz?
|
||||
|
||||
LibFuzzer
|
||||
=========
|
||||
|
||||
Or, how to fuzz OpenSSL with [libfuzzer](http://llvm.org/docs/LibFuzzer.html).
|
||||
|
||||
Starting from a vanilla+OpenSSH server Ubuntu install.
|
||||
|
||||
Use Chrome's handy recent build of clang. Older versions may also work.
|
||||
|
||||
$ sudo apt-get install git
|
||||
$ mkdir git-work
|
||||
$ git clone https://chromium.googlesource.com/chromium/src/tools/clang
|
||||
$ clang/scripts/update.py
|
||||
|
||||
You may want to git pull and re-run the update from time to time.
|
||||
|
||||
Update your path:
|
||||
|
||||
$ PATH=~/third_party/llvm-build/Release+Asserts/bin/:$PATH
|
||||
|
||||
Get and build libFuzzer (there is a git mirror at
|
||||
https://github.com/llvm-mirror/llvm/tree/master/lib/Fuzzer if you prefer):
|
||||
|
||||
$ cd
|
||||
$ sudo apt-get install subversion
|
||||
$ mkdir svn-work
|
||||
$ cd svn-work
|
||||
$ svn co https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer Fuzzer
|
||||
$ cd Fuzzer
|
||||
$ clang++ -c -g -O2 -std=c++11 *.cpp
|
||||
$ ar r libFuzzer.a *.o
|
||||
$ ranlib libFuzzer.a
|
||||
|
||||
Configure for fuzzing:
|
||||
|
||||
$ CC=clang ./config enable-fuzz-libfuzzer \
|
||||
--with-fuzzer-include=../../svn-work/Fuzzer \
|
||||
--with-fuzzer-lib=../../svn-work/Fuzzer/libFuzzer.a \
|
||||
-DPEDANTIC enable-asan enable-ubsan no-shared \
|
||||
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
|
||||
-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp \
|
||||
enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment enable-tls1_3 \
|
||||
enable-weak-ssl-ciphers enable-rc5 enable-md2 \
|
||||
enable-ssl3 enable-ssl3-method enable-nextprotoneg \
|
||||
--debug
|
||||
$ sudo apt-get install make
|
||||
$ LDCMD=clang++ make -j
|
||||
$ fuzz/helper.py $FUZZER
|
||||
|
||||
Where $FUZZER is one of the executables in `fuzz/`.
|
||||
|
||||
If you get a crash, you should find a corresponding input file in
|
||||
`fuzz/corpora/$FUZZER-crash/`.
|
||||
|
||||
AFL
|
||||
===
|
||||
|
||||
Configure for fuzzing:
|
||||
|
||||
$ sudo apt-get install afl-clang
|
||||
$ CC=afl-clang-fast ./config enable-fuzz-afl no-shared -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
|
||||
|
||||
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 build 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
|
||||
|
||||
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.
|
352
trunk/3rdparty/openssl-1.1-fit/fuzz/asn1.c
vendored
Normal file
352
trunk/3rdparty/openssl-1.1-fit/fuzz/asn1.c
vendored
Normal file
|
@ -0,0 +1,352 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/dh.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/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include "fuzzer.h"
|
||||
|
||||
#include "rand.inc"
|
||||
|
||||
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),
|
||||
#ifndef OPENSSL_NO_EC
|
||||
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),
|
||||
#if OPENSSL_API_COMPAT < 0x10200000L
|
||||
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(RSAPrivateKey),
|
||||
ASN1_ITEM_ref(RSA_PSS_PARAMS),
|
||||
ASN1_ITEM_ref(RSAPublicKey),
|
||||
ASN1_ITEM_ref(SXNET),
|
||||
ASN1_ITEM_ref(SXNETID),
|
||||
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),
|
||||
#if OPENSSL_API_COMPAT < 0x10200000L
|
||||
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()); \
|
||||
\
|
||||
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()); \
|
||||
\
|
||||
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()); \
|
||||
\
|
||||
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)
|
||||
{
|
||||
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_get_state();
|
||||
CRYPTO_free_ex_index(0, -1);
|
||||
FuzzerSetRand();
|
||||
|
||||
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) {
|
||||
BIO *bio = BIO_new(BIO_s_null());
|
||||
|
||||
ASN1_item_print(bio, o, 4, i, pctx);
|
||||
BIO_free(bio);
|
||||
ASN1_item_i2d(o, &der, i);
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
DO_TEST(DH, d2i_DHparams, i2d_DHparams, DHparams_print);
|
||||
DO_TEST(DH, d2i_DHxparams, i2d_DHxparams, DHparams_print);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
DO_TEST_NO_PRINT(DSA_SIG, d2i_DSA_SIG, i2d_DSA_SIG);
|
||||
DO_TEST_PRINT_OFFSET(DSA, d2i_DSAPrivateKey, i2d_DSAPrivateKey, DSA_print);
|
||||
DO_TEST_PRINT_OFFSET(DSA, d2i_DSAPublicKey, i2d_DSAPublicKey, DSA_print);
|
||||
DO_TEST(DSA, d2i_DSAparams, i2d_DSAparams, DSAparams_print);
|
||||
#endif
|
||||
DO_TEST_PRINT_OFFSET(RSA, d2i_RSAPublicKey, i2d_RSAPublicKey, RSA_print);
|
||||
#ifndef OPENSSL_NO_EC
|
||||
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
|
||||
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);
|
||||
}
|
43
trunk/3rdparty/openssl-1.1-fit/fuzz/asn1parse.c
vendored
Normal file
43
trunk/3rdparty/openssl-1.1-fit/fuzz/asn1parse.c
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_file("/dev/null", "w");
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
|
||||
ERR_get_state();
|
||||
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);
|
||||
}
|
109
trunk/3rdparty/openssl-1.1-fit/fuzz/bignum.c
vendored
Normal file
109
trunk/3rdparty/openssl-1.1-fit/fuzz/bignum.c
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
|
||||
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;
|
||||
l1 = (buf[0] * len) / 255;
|
||||
++buf;
|
||||
l2 = (buf[0] * (len - l1)) / 255;
|
||||
++buf;
|
||||
l3 = len - l1 - l2;
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
131
trunk/3rdparty/openssl-1.1-fit/fuzz/bndiv.c
vendored
Normal file
131
trunk/3rdparty/openssl-1.1-fit/fuzz/bndiv.c
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
|
||||
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);
|
||||
}
|
121
trunk/3rdparty/openssl-1.1-fit/fuzz/build.info
vendored
Normal file
121
trunk/3rdparty/openssl-1.1-fit/fuzz/build.info
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
{- 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_NO_INST=asn1 asn1parse bignum bndiv client conf crl server x509
|
||||
|
||||
IF[{- !$disabled{"cms"} -}]
|
||||
PROGRAMS_NO_INST=cms
|
||||
ENDIF
|
||||
|
||||
IF[{- !$disabled{"ct"} -}]
|
||||
PROGRAMS_NO_INST=ct
|
||||
ENDIF
|
||||
|
||||
SOURCE[asn1]=asn1.c driver.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
|
||||
INCLUDE[client]=../include {- $ex_inc -}
|
||||
DEPEND[client]=../libcrypto ../libssl {- $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[server]=server.c driver.c
|
||||
INCLUDE[server]=../include {- $ex_inc -}
|
||||
DEPEND[server]=../libcrypto ../libssl {- $ex_lib -}
|
||||
|
||||
SOURCE[x509]=x509.c driver.c
|
||||
INCLUDE[x509]=../include {- $ex_inc -}
|
||||
DEPEND[x509]=../libcrypto {- $ex_lib -}
|
||||
ENDIF
|
||||
|
||||
IF[{- !$disabled{tests} -}]
|
||||
PROGRAMS_NO_INST=asn1-test asn1parse-test bignum-test bndiv-test client-test conf-test crl-test server-test x509-test
|
||||
|
||||
IF[{- !$disabled{"cms"} -}]
|
||||
PROGRAMS_NO_INST=cms-test
|
||||
ENDIF
|
||||
|
||||
IF[{- !$disabled{"ct"} -}]
|
||||
PROGRAMS_NO_INST=ct-test
|
||||
ENDIF
|
||||
|
||||
SOURCE[asn1-test]=asn1.c test-corpus.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
|
||||
INCLUDE[client-test]=../include
|
||||
DEPEND[client-test]=../libcrypto ../libssl
|
||||
|
||||
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[server-test]=server.c test-corpus.c
|
||||
INCLUDE[server-test]=../include
|
||||
DEPEND[server-test]=../libcrypto ../libssl
|
||||
|
||||
SOURCE[x509-test]=x509.c test-corpus.c
|
||||
INCLUDE[x509-test]=../include
|
||||
DEPEND[x509-test]=../libcrypto
|
||||
ENDIF
|
102
trunk/3rdparty/openssl-1.1-fit/fuzz/client.c
vendored
Normal file
102
trunk/3rdparty/openssl-1.1-fit/fuzz/client.c
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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"
|
||||
|
||||
#include "rand.inc"
|
||||
|
||||
/* 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;
|
||||
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
|
||||
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
|
||||
ERR_get_state();
|
||||
CRYPTO_free_ex_index(0, -1);
|
||||
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
|
||||
FuzzerSetRand();
|
||||
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;
|
||||
BIO *in;
|
||||
BIO *out;
|
||||
SSL_CTX *ctx;
|
||||
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* TODO: use the ossltest engine (optionally?) to disable crypto checks.
|
||||
*/
|
||||
|
||||
/* This only fuzzes the initial flow from the client so far. */
|
||||
ctx = SSL_CTX_new(SSLv23_method());
|
||||
|
||||
client = SSL_new(ctx);
|
||||
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());
|
||||
out = BIO_new(BIO_s_mem());
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
SSL_free(client);
|
||||
ERR_clear_error();
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FuzzerCleanup(void)
|
||||
{
|
||||
}
|
55
trunk/3rdparty/openssl-1.1-fit/fuzz/cms.c
vendored
Normal file
55
trunk/3rdparty/openssl-1.1-fit/fuzz/cms.c
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
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)
|
||||
{
|
||||
}
|
48
trunk/3rdparty/openssl-1.1-fit/fuzz/conf.c
vendored
Normal file
48
trunk/3rdparty/openssl-1.1-fit/fuzz/conf.c
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
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)
|
||||
{
|
||||
}
|
47
trunk/3rdparty/openssl-1.1-fit/fuzz/crl.c
vendored
Normal file
47
trunk/3rdparty/openssl-1.1-fit/fuzz/crl.c
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
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)
|
||||
{
|
||||
}
|
51
trunk/3rdparty/openssl-1.1-fit/fuzz/ct.c
vendored
Normal file
51
trunk/3rdparty/openssl-1.1-fit/fuzz/ct.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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_get_state();
|
||||
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)
|
||||
{
|
||||
}
|
55
trunk/3rdparty/openssl-1.1-fit/fuzz/driver.c
vendored
Normal file
55
trunk/3rdparty/openssl-1.1-fit/fuzz/driver.c
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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
|
14
trunk/3rdparty/openssl-1.1-fit/fuzz/fuzzer.h
vendored
Normal file
14
trunk/3rdparty/openssl-1.1-fit/fuzz/fuzzer.h
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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.
|
||||
*/
|
||||
|
||||
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
|
||||
int FuzzerInitialize(int *argc, char ***argv);
|
||||
void FuzzerCleanup(void);
|
||||
void FuzzerSetRand(void);
|
52
trunk/3rdparty/openssl-1.1-fit/fuzz/helper.py
vendored
Executable file
52
trunk/3rdparty/openssl-1.1-fit/fuzz/helper.py
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (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()
|
32
trunk/3rdparty/openssl-1.1-fit/fuzz/mkfuzzoids.pl
vendored
Executable file
32
trunk/3rdparty/openssl-1.1-fit/fuzz/mkfuzzoids.pl
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/env perl
|
||||
# Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the OpenSSL license (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
|
||||
|
||||
my $obj_dat_h = $ARGV[0];
|
||||
|
||||
# Output year depends on the date on the input file and the script.
|
||||
my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900;
|
||||
my $iYEAR = [localtime([stat($obj_dat_h)]->[9])]->[5] + 1900;
|
||||
$YEAR = $iYEAR if $iYEAR > $YEAR;
|
||||
|
||||
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;
|
1065
trunk/3rdparty/openssl-1.1-fit/fuzz/oids.txt
vendored
Normal file
1065
trunk/3rdparty/openssl-1.1-fit/fuzz/oids.txt
vendored
Normal file
File diff suppressed because it is too large
Load diff
40
trunk/3rdparty/openssl-1.1-fit/fuzz/rand.inc
vendored
Normal file
40
trunk/3rdparty/openssl-1.1-fit/fuzz/rand.inc
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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/rand.h>
|
||||
|
||||
static int fuzz_bytes(unsigned char *buf, int num)
|
||||
{
|
||||
unsigned char val = 1;
|
||||
|
||||
while (--num >= 0)
|
||||
*buf++ = val++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fuzz_status(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static RAND_METHOD fuzz_rand_method = {
|
||||
NULL,
|
||||
fuzz_bytes,
|
||||
NULL,
|
||||
NULL,
|
||||
fuzz_bytes,
|
||||
fuzz_status
|
||||
};
|
||||
|
||||
void FuzzerSetRand(void)
|
||||
{
|
||||
RAND_set_rand_method(&fuzz_rand_method);
|
||||
}
|
||||
|
||||
|
650
trunk/3rdparty/openssl-1.1-fit/fuzz/server.c
vendored
Normal file
650
trunk/3rdparty/openssl-1.1-fit/fuzz/server.c
vendored
Normal file
|
@ -0,0 +1,650 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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. */
|
||||
|
||||
#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"
|
||||
|
||||
#include "rand.inc"
|
||||
|
||||
static const uint8_t kCertificateDER[] = {
|
||||
0x30, 0x82, 0x02, 0xff, 0x30, 0x82, 0x01, 0xe7, 0xa0, 0x03, 0x02, 0x01,
|
||||
0x02, 0x02, 0x11, 0x00, 0xb1, 0x84, 0xee, 0x34, 0x99, 0x98, 0x76, 0xfb,
|
||||
0x6f, 0xb2, 0x15, 0xc8, 0x47, 0x79, 0x05, 0x9b, 0x30, 0x0d, 0x06, 0x09,
|
||||
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30,
|
||||
0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x07,
|
||||
0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, 0x30, 0x1e, 0x17, 0x0d, 0x31,
|
||||
0x35, 0x31, 0x31, 0x30, 0x37, 0x30, 0x30, 0x32, 0x34, 0x35, 0x36, 0x5a,
|
||||
0x17, 0x0d, 0x31, 0x36, 0x31, 0x31, 0x30, 0x36, 0x30, 0x30, 0x32, 0x34,
|
||||
0x35, 0x36, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55,
|
||||
0x04, 0x0a, 0x13, 0x07, 0x41, 0x63, 0x6d, 0x65, 0x20, 0x43, 0x6f, 0x30,
|
||||
0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30,
|
||||
0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xce, 0x47, 0xcb, 0x11,
|
||||
0xbb, 0xd2, 0x9d, 0x8e, 0x9e, 0xd2, 0x1e, 0x14, 0xaf, 0xc7, 0xea, 0xb6,
|
||||
0xc9, 0x38, 0x2a, 0x6f, 0xb3, 0x7e, 0xfb, 0xbc, 0xfc, 0x59, 0x42, 0xb9,
|
||||
0x56, 0xf0, 0x4c, 0x3f, 0xf7, 0x31, 0x84, 0xbe, 0xac, 0x03, 0x9e, 0x71,
|
||||
0x91, 0x85, 0xd8, 0x32, 0xbd, 0x00, 0xea, 0xac, 0x65, 0xf6, 0x03, 0xc8,
|
||||
0x0f, 0x8b, 0xfd, 0x6e, 0x58, 0x88, 0x04, 0x41, 0x92, 0x74, 0xa6, 0x57,
|
||||
0x2e, 0x8e, 0x88, 0xd5, 0x3d, 0xda, 0x14, 0x3e, 0x63, 0x88, 0x22, 0xe3,
|
||||
0x53, 0xe9, 0xba, 0x39, 0x09, 0xac, 0xfb, 0xd0, 0x4c, 0xf2, 0x3c, 0x20,
|
||||
0xd6, 0x97, 0xe6, 0xed, 0xf1, 0x62, 0x1e, 0xe5, 0xc9, 0x48, 0xa0, 0xca,
|
||||
0x2e, 0x3c, 0x14, 0x5a, 0x82, 0xd4, 0xed, 0xb1, 0xe3, 0x43, 0xc1, 0x2a,
|
||||
0x59, 0xa5, 0xb9, 0xc8, 0x48, 0xa7, 0x39, 0x23, 0x74, 0xa7, 0x37, 0xb0,
|
||||
0x6f, 0xc3, 0x64, 0x99, 0x6c, 0xa2, 0x82, 0xc8, 0xf6, 0xdb, 0x86, 0x40,
|
||||
0xce, 0xd1, 0x85, 0x9f, 0xce, 0x69, 0xf4, 0x15, 0x2a, 0x23, 0xca, 0xea,
|
||||
0xb7, 0x7b, 0xdf, 0xfb, 0x43, 0x5f, 0xff, 0x7a, 0x49, 0x49, 0x0e, 0xe7,
|
||||
0x02, 0x51, 0x45, 0x13, 0xe8, 0x90, 0x64, 0x21, 0x0c, 0x26, 0x2b, 0x5d,
|
||||
0xfc, 0xe4, 0xb5, 0x86, 0x89, 0x43, 0x22, 0x4c, 0xf3, 0x3b, 0xf3, 0x09,
|
||||
0xc4, 0xa4, 0x10, 0x80, 0xf2, 0x46, 0xe2, 0x46, 0x8f, 0x76, 0x50, 0xbf,
|
||||
0xaf, 0x2b, 0x90, 0x1b, 0x78, 0xc7, 0xcf, 0xc1, 0x77, 0xd0, 0xfb, 0xa9,
|
||||
0xfb, 0xc9, 0x66, 0x5a, 0xc5, 0x9b, 0x31, 0x41, 0x67, 0x01, 0xbe, 0x33,
|
||||
0x10, 0xba, 0x05, 0x58, 0xed, 0x76, 0x53, 0xde, 0x5d, 0xc1, 0xe8, 0xbb,
|
||||
0x9f, 0xf1, 0xcd, 0xfb, 0xdf, 0x64, 0x7f, 0xd7, 0x18, 0xab, 0x0f, 0x94,
|
||||
0x28, 0x95, 0x4a, 0xcc, 0x6a, 0xa9, 0x50, 0xc7, 0x05, 0x47, 0x10, 0x41,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0e, 0x06,
|
||||
0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x05,
|
||||
0xa0, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30, 0x0a,
|
||||
0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x0c,
|
||||
0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
|
||||
0x30, 0x19, 0x06, 0x03, 0x55, 0x1d, 0x11, 0x04, 0x12, 0x30, 0x10, 0x82,
|
||||
0x0e, 0x66, 0x75, 0x7a, 0x7a, 0x2e, 0x62, 0x6f, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x73, 0x73, 0x6c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x92,
|
||||
0xde, 0xef, 0x96, 0x06, 0x7b, 0xff, 0x71, 0x7d, 0x4e, 0xa0, 0x7d, 0xae,
|
||||
0xb8, 0x22, 0xb4, 0x2c, 0xf7, 0x96, 0x9c, 0x37, 0x1d, 0x8f, 0xe7, 0xd9,
|
||||
0x47, 0xff, 0x3f, 0xe9, 0x35, 0x95, 0x0e, 0xdd, 0xdc, 0x7f, 0xc8, 0x8a,
|
||||
0x1e, 0x36, 0x1d, 0x38, 0x47, 0xfc, 0x76, 0xd2, 0x1f, 0x98, 0xa1, 0x36,
|
||||
0xac, 0xc8, 0x70, 0x38, 0x0a, 0x3d, 0x51, 0x8d, 0x0f, 0x03, 0x1b, 0xef,
|
||||
0x62, 0xa1, 0xcb, 0x2b, 0x4a, 0x8c, 0x12, 0x2b, 0x54, 0x50, 0x9a, 0x6b,
|
||||
0xfe, 0xaf, 0xd9, 0xf6, 0xbf, 0x58, 0x11, 0x58, 0x5e, 0xe5, 0x86, 0x1e,
|
||||
0x3b, 0x6b, 0x30, 0x7e, 0x72, 0x89, 0xe8, 0x6b, 0x7b, 0xb7, 0xaf, 0xef,
|
||||
0x8b, 0xa9, 0x3e, 0xb0, 0xcd, 0x0b, 0xef, 0xb0, 0x0c, 0x96, 0x2b, 0xc5,
|
||||
0x3b, 0xd5, 0xf1, 0xc2, 0xae, 0x3a, 0x60, 0xd9, 0x0f, 0x75, 0x37, 0x55,
|
||||
0x4d, 0x62, 0xd2, 0xed, 0x96, 0xac, 0x30, 0x6b, 0xda, 0xa1, 0x48, 0x17,
|
||||
0x96, 0x23, 0x85, 0x9a, 0x57, 0x77, 0xe9, 0x22, 0xa2, 0x37, 0x03, 0xba,
|
||||
0x49, 0x77, 0x40, 0x3b, 0x76, 0x4b, 0xda, 0xc1, 0x04, 0x57, 0x55, 0x34,
|
||||
0x22, 0x83, 0x45, 0x29, 0xab, 0x2e, 0x11, 0xff, 0x0d, 0xab, 0x55, 0xb1,
|
||||
0xa7, 0x58, 0x59, 0x05, 0x25, 0xf9, 0x1e, 0x3d, 0xb7, 0xac, 0x04, 0x39,
|
||||
0x2c, 0xf9, 0xaf, 0xb8, 0x68, 0xfb, 0x8e, 0x35, 0x71, 0x32, 0xff, 0x70,
|
||||
0xe9, 0x46, 0x6d, 0x5c, 0x06, 0x90, 0x88, 0x23, 0x48, 0x0c, 0x50, 0xeb,
|
||||
0x0a, 0xa9, 0xae, 0xe8, 0xfc, 0xbe, 0xa5, 0x76, 0x94, 0xd7, 0x64, 0x22,
|
||||
0x38, 0x98, 0x17, 0xa4, 0x3a, 0xa7, 0x59, 0x9f, 0x1d, 0x3b, 0x75, 0x90,
|
||||
0x1a, 0x81, 0xef, 0x19, 0xfb, 0x2b, 0xb7, 0xa7, 0x64, 0x61, 0x22, 0xa4,
|
||||
0x6f, 0x7b, 0xfa, 0x58, 0xbb, 0x8c, 0x4e, 0x77, 0x67, 0xd0, 0x5d, 0x58,
|
||||
0x76, 0x8a, 0xbb,
|
||||
};
|
||||
|
||||
static const uint8_t kRSAPrivateKeyDER[] = {
|
||||
0x30, 0x82, 0x04, 0xa5, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
|
||||
0xce, 0x47, 0xcb, 0x11, 0xbb, 0xd2, 0x9d, 0x8e, 0x9e, 0xd2, 0x1e, 0x14,
|
||||
0xaf, 0xc7, 0xea, 0xb6, 0xc9, 0x38, 0x2a, 0x6f, 0xb3, 0x7e, 0xfb, 0xbc,
|
||||
0xfc, 0x59, 0x42, 0xb9, 0x56, 0xf0, 0x4c, 0x3f, 0xf7, 0x31, 0x84, 0xbe,
|
||||
0xac, 0x03, 0x9e, 0x71, 0x91, 0x85, 0xd8, 0x32, 0xbd, 0x00, 0xea, 0xac,
|
||||
0x65, 0xf6, 0x03, 0xc8, 0x0f, 0x8b, 0xfd, 0x6e, 0x58, 0x88, 0x04, 0x41,
|
||||
0x92, 0x74, 0xa6, 0x57, 0x2e, 0x8e, 0x88, 0xd5, 0x3d, 0xda, 0x14, 0x3e,
|
||||
0x63, 0x88, 0x22, 0xe3, 0x53, 0xe9, 0xba, 0x39, 0x09, 0xac, 0xfb, 0xd0,
|
||||
0x4c, 0xf2, 0x3c, 0x20, 0xd6, 0x97, 0xe6, 0xed, 0xf1, 0x62, 0x1e, 0xe5,
|
||||
0xc9, 0x48, 0xa0, 0xca, 0x2e, 0x3c, 0x14, 0x5a, 0x82, 0xd4, 0xed, 0xb1,
|
||||
0xe3, 0x43, 0xc1, 0x2a, 0x59, 0xa5, 0xb9, 0xc8, 0x48, 0xa7, 0x39, 0x23,
|
||||
0x74, 0xa7, 0x37, 0xb0, 0x6f, 0xc3, 0x64, 0x99, 0x6c, 0xa2, 0x82, 0xc8,
|
||||
0xf6, 0xdb, 0x86, 0x40, 0xce, 0xd1, 0x85, 0x9f, 0xce, 0x69, 0xf4, 0x15,
|
||||
0x2a, 0x23, 0xca, 0xea, 0xb7, 0x7b, 0xdf, 0xfb, 0x43, 0x5f, 0xff, 0x7a,
|
||||
0x49, 0x49, 0x0e, 0xe7, 0x02, 0x51, 0x45, 0x13, 0xe8, 0x90, 0x64, 0x21,
|
||||
0x0c, 0x26, 0x2b, 0x5d, 0xfc, 0xe4, 0xb5, 0x86, 0x89, 0x43, 0x22, 0x4c,
|
||||
0xf3, 0x3b, 0xf3, 0x09, 0xc4, 0xa4, 0x10, 0x80, 0xf2, 0x46, 0xe2, 0x46,
|
||||
0x8f, 0x76, 0x50, 0xbf, 0xaf, 0x2b, 0x90, 0x1b, 0x78, 0xc7, 0xcf, 0xc1,
|
||||
0x77, 0xd0, 0xfb, 0xa9, 0xfb, 0xc9, 0x66, 0x5a, 0xc5, 0x9b, 0x31, 0x41,
|
||||
0x67, 0x01, 0xbe, 0x33, 0x10, 0xba, 0x05, 0x58, 0xed, 0x76, 0x53, 0xde,
|
||||
0x5d, 0xc1, 0xe8, 0xbb, 0x9f, 0xf1, 0xcd, 0xfb, 0xdf, 0x64, 0x7f, 0xd7,
|
||||
0x18, 0xab, 0x0f, 0x94, 0x28, 0x95, 0x4a, 0xcc, 0x6a, 0xa9, 0x50, 0xc7,
|
||||
0x05, 0x47, 0x10, 0x41, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01,
|
||||
0x01, 0x00, 0xa8, 0x47, 0xb9, 0x4a, 0x06, 0x47, 0x93, 0x71, 0x3d, 0xef,
|
||||
0x7b, 0xca, 0xb4, 0x7c, 0x0a, 0xe6, 0x82, 0xd0, 0xe7, 0x0d, 0xa9, 0x08,
|
||||
0xf6, 0xa4, 0xfd, 0xd8, 0x73, 0xae, 0x6f, 0x56, 0x29, 0x5e, 0x25, 0x72,
|
||||
0xa8, 0x30, 0x44, 0x73, 0xcf, 0x56, 0x26, 0xb9, 0x61, 0xde, 0x42, 0x81,
|
||||
0xf4, 0xf0, 0x1f, 0x5d, 0xcb, 0x47, 0xf2, 0x26, 0xe9, 0xe0, 0x93, 0x28,
|
||||
0xa3, 0x10, 0x3b, 0x42, 0x1e, 0x51, 0x11, 0x12, 0x06, 0x5e, 0xaf, 0xce,
|
||||
0xb0, 0xa5, 0x14, 0xdd, 0x82, 0x58, 0xa1, 0xa4, 0x12, 0xdf, 0x65, 0x1d,
|
||||
0x51, 0x70, 0x64, 0xd5, 0x58, 0x68, 0x11, 0xa8, 0x6a, 0x23, 0xc2, 0xbf,
|
||||
0xa1, 0x25, 0x24, 0x47, 0xb3, 0xa4, 0x3c, 0x83, 0x96, 0xb7, 0x1f, 0xf4,
|
||||
0x44, 0xd4, 0xd1, 0xe9, 0xfc, 0x33, 0x68, 0x5e, 0xe2, 0x68, 0x99, 0x9c,
|
||||
0x91, 0xe8, 0x72, 0xc9, 0xd7, 0x8c, 0x80, 0x20, 0x8e, 0x77, 0x83, 0x4d,
|
||||
0xe4, 0xab, 0xf9, 0x74, 0xa1, 0xdf, 0xd3, 0xc0, 0x0d, 0x5b, 0x05, 0x51,
|
||||
0xc2, 0x6f, 0xb2, 0x91, 0x02, 0xec, 0xc0, 0x02, 0x1a, 0x5c, 0x91, 0x05,
|
||||
0xf1, 0xe3, 0xfa, 0x65, 0xc2, 0xad, 0x24, 0xe6, 0xe5, 0x3c, 0xb6, 0x16,
|
||||
0xf1, 0xa1, 0x67, 0x1a, 0x9d, 0x37, 0x56, 0xbf, 0x01, 0xd7, 0x3b, 0x35,
|
||||
0x30, 0x57, 0x73, 0xf4, 0xf0, 0x5e, 0xa7, 0xe8, 0x0a, 0xc1, 0x94, 0x17,
|
||||
0xcf, 0x0a, 0xbd, 0xf5, 0x31, 0xa7, 0x2d, 0xf7, 0xf5, 0xd9, 0x8c, 0xc2,
|
||||
0x01, 0xbd, 0xda, 0x16, 0x8e, 0xb9, 0x30, 0x40, 0xa6, 0x6e, 0xbd, 0xcd,
|
||||
0x4d, 0x84, 0x67, 0x4e, 0x0b, 0xce, 0xd5, 0xef, 0xf8, 0x08, 0x63, 0x02,
|
||||
0xc6, 0xc7, 0xf7, 0x67, 0x92, 0xe2, 0x23, 0x9d, 0x27, 0x22, 0x1d, 0xc6,
|
||||
0x67, 0x5e, 0x66, 0xbf, 0x03, 0xb8, 0xa9, 0x67, 0xd4, 0x39, 0xd8, 0x75,
|
||||
0xfa, 0xe8, 0xed, 0x56, 0xb8, 0x81, 0x02, 0x81, 0x81, 0x00, 0xf7, 0x46,
|
||||
0x68, 0xc6, 0x13, 0xf8, 0xba, 0x0f, 0x83, 0xdb, 0x05, 0xa8, 0x25, 0x00,
|
||||
0x70, 0x9c, 0x9e, 0x8b, 0x12, 0x34, 0x0d, 0x96, 0xcf, 0x0d, 0x98, 0x9b,
|
||||
0x8d, 0x9c, 0x96, 0x78, 0xd1, 0x3c, 0x01, 0x8c, 0xb9, 0x35, 0x5c, 0x20,
|
||||
0x42, 0xb4, 0x38, 0xe3, 0xd6, 0x54, 0xe7, 0x55, 0xd6, 0x26, 0x8a, 0x0c,
|
||||
0xf6, 0x1f, 0xe0, 0x04, 0xc1, 0x22, 0x42, 0x19, 0x61, 0xc4, 0x94, 0x7c,
|
||||
0x07, 0x2e, 0x80, 0x52, 0xfe, 0x8d, 0xe6, 0x92, 0x3a, 0x91, 0xfe, 0x72,
|
||||
0x99, 0xe1, 0x2a, 0x73, 0x76, 0xb1, 0x24, 0x20, 0x67, 0xde, 0x28, 0xcb,
|
||||
0x0e, 0xe6, 0x52, 0xb5, 0xfa, 0xfb, 0x8b, 0x1e, 0x6a, 0x1d, 0x09, 0x26,
|
||||
0xb9, 0xa7, 0x61, 0xba, 0xf8, 0x79, 0xd2, 0x66, 0x57, 0x28, 0xd7, 0x31,
|
||||
0xb5, 0x0b, 0x27, 0x19, 0x1e, 0x6f, 0x46, 0xfc, 0x54, 0x95, 0xeb, 0x78,
|
||||
0x01, 0xb6, 0xd9, 0x79, 0x5a, 0x4d, 0x02, 0x81, 0x81, 0x00, 0xd5, 0x8f,
|
||||
0x16, 0x53, 0x2f, 0x57, 0x93, 0xbf, 0x09, 0x75, 0xbf, 0x63, 0x40, 0x3d,
|
||||
0x27, 0xfd, 0x23, 0x21, 0xde, 0x9b, 0xe9, 0x73, 0x3f, 0x49, 0x02, 0xd2,
|
||||
0x38, 0x96, 0xcf, 0xc3, 0xba, 0x92, 0x07, 0x87, 0x52, 0xa9, 0x35, 0xe3,
|
||||
0x0c, 0xe4, 0x2f, 0x05, 0x7b, 0x37, 0xa5, 0x40, 0x9c, 0x3b, 0x94, 0xf7,
|
||||
0xad, 0xa0, 0xee, 0x3a, 0xa8, 0xfb, 0x1f, 0x11, 0x1f, 0xd8, 0x9a, 0x80,
|
||||
0x42, 0x3d, 0x7f, 0xa4, 0xb8, 0x9a, 0xaa, 0xea, 0x72, 0xc1, 0xe3, 0xed,
|
||||
0x06, 0x60, 0x92, 0x37, 0xf9, 0xba, 0xfb, 0x9e, 0xed, 0x05, 0xa6, 0xd4,
|
||||
0x72, 0x68, 0x4f, 0x63, 0xfe, 0xd6, 0x10, 0x0d, 0x4f, 0x0a, 0x93, 0xc6,
|
||||
0xb9, 0xd7, 0xaf, 0xfd, 0xd9, 0x57, 0x7d, 0xcb, 0x75, 0xe8, 0x93, 0x2b,
|
||||
0xae, 0x4f, 0xea, 0xd7, 0x30, 0x0b, 0x58, 0x44, 0x82, 0x0f, 0x84, 0x5d,
|
||||
0x62, 0x11, 0x78, 0xea, 0x5f, 0xc5, 0x02, 0x81, 0x81, 0x00, 0x82, 0x0c,
|
||||
0xc1, 0xe6, 0x0b, 0x72, 0xf1, 0x48, 0x5f, 0xac, 0xbd, 0x98, 0xe5, 0x7d,
|
||||
0x09, 0xbd, 0x15, 0x95, 0x47, 0x09, 0xa1, 0x6c, 0x03, 0x91, 0xbf, 0x05,
|
||||
0x70, 0xc1, 0x3e, 0x52, 0x64, 0x99, 0x0e, 0xa7, 0x98, 0x70, 0xfb, 0xf6,
|
||||
0xeb, 0x9e, 0x25, 0x9d, 0x8e, 0x88, 0x30, 0xf2, 0xf0, 0x22, 0x6c, 0xd0,
|
||||
0xcc, 0x51, 0x8f, 0x5c, 0x70, 0xc7, 0x37, 0xc4, 0x69, 0xab, 0x1d, 0xfc,
|
||||
0xed, 0x3a, 0x03, 0xbb, 0xa2, 0xad, 0xb6, 0xea, 0x89, 0x6b, 0x67, 0x4b,
|
||||
0x96, 0xaa, 0xd9, 0xcc, 0xc8, 0x4b, 0xfa, 0x18, 0x21, 0x08, 0xb2, 0xa3,
|
||||
0xb9, 0x3e, 0x61, 0x99, 0xdc, 0x5a, 0x97, 0x9c, 0x73, 0x6a, 0xb9, 0xf9,
|
||||
0x68, 0x03, 0x24, 0x5f, 0x55, 0x77, 0x9c, 0xb4, 0xbe, 0x7a, 0x78, 0x53,
|
||||
0x68, 0x48, 0x69, 0x53, 0xc8, 0xb1, 0xf5, 0xbf, 0x98, 0x2d, 0x11, 0x1e,
|
||||
0x98, 0xa8, 0x36, 0x50, 0xa0, 0xb1, 0x02, 0x81, 0x81, 0x00, 0x90, 0x88,
|
||||
0x30, 0x71, 0xc7, 0xfe, 0x9b, 0x6d, 0x95, 0x37, 0x6d, 0x79, 0xfc, 0x85,
|
||||
0xe7, 0x44, 0x78, 0xbc, 0x79, 0x6e, 0x47, 0x86, 0xc9, 0xf3, 0xdd, 0xc6,
|
||||
0xec, 0xa9, 0x94, 0x9f, 0x40, 0xeb, 0x87, 0xd0, 0xdb, 0xee, 0xcd, 0x1b,
|
||||
0x87, 0x23, 0xff, 0x76, 0xd4, 0x37, 0x8a, 0xcd, 0xb9, 0x6e, 0xd1, 0x98,
|
||||
0xf6, 0x97, 0x8d, 0xe3, 0x81, 0x6d, 0xc3, 0x4e, 0xd1, 0xa0, 0xc4, 0x9f,
|
||||
0xbd, 0x34, 0xe5, 0xe8, 0x53, 0x4f, 0xca, 0x10, 0xb5, 0xed, 0xe7, 0x16,
|
||||
0x09, 0x54, 0xde, 0x60, 0xa7, 0xd1, 0x16, 0x6e, 0x2e, 0xb7, 0xbe, 0x7a,
|
||||
0xd5, 0x9b, 0x26, 0xef, 0xe4, 0x0e, 0x77, 0xfa, 0xa9, 0xdd, 0xdc, 0xb9,
|
||||
0x88, 0x19, 0x23, 0x70, 0xc7, 0xe1, 0x60, 0xaf, 0x8c, 0x73, 0x04, 0xf7,
|
||||
0x71, 0x17, 0x81, 0x36, 0x75, 0xbb, 0x97, 0xd7, 0x75, 0xb6, 0x8e, 0xbc,
|
||||
0xac, 0x9c, 0x6a, 0x9b, 0x24, 0x89, 0x02, 0x81, 0x80, 0x5a, 0x2b, 0xc7,
|
||||
0x6b, 0x8c, 0x65, 0xdb, 0x04, 0x73, 0xab, 0x25, 0xe1, 0x5b, 0xbc, 0x3c,
|
||||
0xcf, 0x5a, 0x3c, 0x04, 0xae, 0x97, 0x2e, 0xfd, 0xa4, 0x97, 0x1f, 0x05,
|
||||
0x17, 0x27, 0xac, 0x7c, 0x30, 0x85, 0xb4, 0x82, 0x3f, 0x5b, 0xb7, 0x94,
|
||||
0x3b, 0x7f, 0x6c, 0x0c, 0xc7, 0x16, 0xc6, 0xa0, 0xbd, 0x80, 0xb0, 0x81,
|
||||
0xde, 0xa0, 0x23, 0xa6, 0xf6, 0x75, 0x33, 0x51, 0x35, 0xa2, 0x75, 0x55,
|
||||
0x70, 0x4d, 0x42, 0xbb, 0xcf, 0x54, 0xe4, 0xdb, 0x2d, 0x88, 0xa0, 0x7a,
|
||||
0xf2, 0x17, 0xa7, 0xdd, 0x13, 0x44, 0x9f, 0x5f, 0x6b, 0x2c, 0x42, 0x42,
|
||||
0x8b, 0x13, 0x4d, 0xf9, 0x5b, 0xf8, 0x33, 0x42, 0xd9, 0x9e, 0x50, 0x1c,
|
||||
0x7c, 0xbc, 0xfa, 0x62, 0x85, 0x0b, 0xcf, 0x99, 0xda, 0x9e, 0x04, 0x90,
|
||||
0xb2, 0xc6, 0xb2, 0x0a, 0x2a, 0x7c, 0x6d, 0x6a, 0x40, 0xfc, 0xf5, 0x50,
|
||||
0x98, 0x46, 0x89, 0x82, 0x40,
|
||||
};
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/*
|
||||
* -----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
|
||||
};
|
||||
|
||||
/*
|
||||
* -----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
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
/*
|
||||
* -----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;
|
||||
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL);
|
||||
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
|
||||
ERR_get_state();
|
||||
CRYPTO_free_ex_index(0, -1);
|
||||
idx = SSL_get_ex_data_X509_STORE_CTX_idx();
|
||||
FuzzerSetRand();
|
||||
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)
|
||||
BIO *bio_buf;
|
||||
#endif
|
||||
SSL_CTX *ctx;
|
||||
int ret;
|
||||
RSA *privkey;
|
||||
const uint8_t *bufp;
|
||||
EVP_PKEY *pkey;
|
||||
X509 *cert;
|
||||
#ifndef OPENSSL_NO_EC
|
||||
EC_KEY *ecdsakey = NULL;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
DSA *dsakey = NULL;
|
||||
#endif
|
||||
uint8_t opt;
|
||||
|
||||
if (len < 2)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* TODO: use the ossltest engine (optionally?) to disable crypto checks.
|
||||
*/
|
||||
|
||||
/* This only fuzzes the initial flow from the client so far. */
|
||||
ctx = SSL_CTX_new(SSLv23_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);
|
||||
|
||||
/* RSA */
|
||||
bufp = kRSAPrivateKeyDER;
|
||||
privkey = d2i_RSAPrivateKey(NULL, &bufp, sizeof(kRSAPrivateKeyDER));
|
||||
OPENSSL_assert(privkey != NULL);
|
||||
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);
|
||||
|
||||
bufp = kCertificateDER;
|
||||
cert = d2i_X509(NULL, &bufp, sizeof(kCertificateDER));
|
||||
OPENSSL_assert(cert != NULL);
|
||||
ret = SSL_CTX_use_certificate(ctx, cert);
|
||||
OPENSSL_assert(ret == 1);
|
||||
X509_free(cert);
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/* 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);
|
||||
|
||||
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
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
/* 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
|
||||
|
||||
/* TODO: Set up support for SRP and PSK */
|
||||
|
||||
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);
|
||||
|
||||
opt = (uint8_t)buf[len-1];
|
||||
len--;
|
||||
|
||||
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
|
||||
|
||||
if ((opt & 0x01) != 0)
|
||||
{
|
||||
do {
|
||||
char early_buf[16384];
|
||||
size_t early_len;
|
||||
ret = SSL_read_early_data(server, early_buf, sizeof(early_buf), &early_len);
|
||||
|
||||
if (ret != SSL_READ_EARLY_DATA_SUCCESS)
|
||||
break;
|
||||
} while (1);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
104
trunk/3rdparty/openssl-1.1-fit/fuzz/test-corpus.c
vendored
Normal file
104
trunk/3rdparty/openssl-1.1-fit/fuzz/test-corpus.c
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Given a list of files, run each of them through the fuzzer. Note that
|
||||
* failure will be indicated by some kind of crash. Switching on things like
|
||||
* asan improves the test.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include "fuzzer.h"
|
||||
#include "internal/o_dir.h"
|
||||
|
||||
#if defined(_WIN32) && defined(_MAX_PATH)
|
||||
# define PATH_MAX _MAX_PATH
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
# if !defined(S_ISREG)
|
||||
# define S_ISREG(m) ((m) & S_IFREG)
|
||||
# endif
|
||||
|
||||
static void testfile(const char *pathname)
|
||||
{
|
||||
struct stat st;
|
||||
FILE *f;
|
||||
unsigned char *buf;
|
||||
size_t s;
|
||||
|
||||
if (stat(pathname, &st) < 0 || !S_ISREG(st.st_mode))
|
||||
return;
|
||||
printf("# %s\n", pathname);
|
||||
fflush(stdout);
|
||||
f = fopen(pathname, "rb");
|
||||
if (f == NULL)
|
||||
return;
|
||||
buf = malloc(st.st_size);
|
||||
if (buf != NULL) {
|
||||
s = fread(buf, 1, st.st_size, f);
|
||||
OPENSSL_assert(s == (size_t)st.st_size);
|
||||
FuzzerTestOneInput(buf, s);
|
||||
free(buf);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n;
|
||||
|
||||
FuzzerInitialize(&argc, &argv);
|
||||
|
||||
for (n = 1; n < argc; ++n) {
|
||||
size_t dirname_len = strlen(argv[n]);
|
||||
const char *filename = NULL;
|
||||
char *pathname = NULL;
|
||||
OPENSSL_DIR_CTX *ctx = NULL;
|
||||
int wasdir = 0;
|
||||
|
||||
/*
|
||||
* We start with trying to read the given path as a directory.
|
||||
*/
|
||||
while ((filename = OPENSSL_DIR_read(&ctx, argv[n])) != NULL) {
|
||||
wasdir = 1;
|
||||
if (pathname == NULL) {
|
||||
pathname = malloc(PATH_MAX);
|
||||
if (pathname == NULL)
|
||||
break;
|
||||
strcpy(pathname, argv[n]);
|
||||
#ifdef __VMS
|
||||
if (strchr(":<]", pathname[dirname_len - 1]) == NULL)
|
||||
#endif
|
||||
pathname[dirname_len++] = '/';
|
||||
pathname[dirname_len] = '\0';
|
||||
}
|
||||
strcpy(pathname + dirname_len, filename);
|
||||
testfile(pathname);
|
||||
}
|
||||
OPENSSL_DIR_end(&ctx);
|
||||
|
||||
/* If it wasn't a directory, treat it as a file instead */
|
||||
if (!wasdir)
|
||||
testfile(argv[n]);
|
||||
|
||||
free(pathname);
|
||||
}
|
||||
|
||||
FuzzerCleanup();
|
||||
|
||||
return 0;
|
||||
}
|
51
trunk/3rdparty/openssl-1.1-fit/fuzz/x509.c
vendored
Normal file
51
trunk/3rdparty/openssl-1.1-fit/fuzz/x509.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL licenses, (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 <openssl/rand.h>
|
||||
#include "fuzzer.h"
|
||||
|
||||
#include "rand.inc"
|
||||
|
||||
int FuzzerInitialize(int *argc, char ***argv)
|
||||
{
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
|
||||
ERR_get_state();
|
||||
CRYPTO_free_ex_index(0, -1);
|
||||
FuzzerSetRand();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int FuzzerTestOneInput(const uint8_t *buf, size_t len)
|
||||
{
|
||||
const unsigned char *p = buf;
|
||||
unsigned char *der = NULL;
|
||||
|
||||
X509 *x509 = d2i_X509(NULL, &p, len);
|
||||
if (x509 != NULL) {
|
||||
BIO *bio = BIO_new(BIO_s_null());
|
||||
/* This will load and print the public key as well as extensions */
|
||||
X509_print(bio, x509);
|
||||
BIO_free(bio);
|
||||
|
||||
i2d_X509(x509, &der);
|
||||
OPENSSL_free(der);
|
||||
|
||||
X509_free(x509);
|
||||
}
|
||||
ERR_clear_error();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FuzzerCleanup(void)
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue