diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-07-04 11:42:59 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-07-04 11:57:02 +0200 |
commit | e62eddfdc8ac82ddb96a3dfcd6011441039daca2 (patch) | |
tree | 368f761be4913b1dbe0ccfa109ff439384a15ab3 /devel | |
parent | 23489789f05d5901c8d2e38dbf73f019abf06799 (diff) | |
download | gnutls-e62eddfdc8ac82ddb96a3dfcd6011441039daca2.tar.gz |
fuzz: updated server with multiple keys (ECDSA, RSA) and DH parameters [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'devel')
-rw-r--r-- | devel/fuzz/gnutls_server_fuzzer.cc | 87 |
1 files changed, 79 insertions, 8 deletions
diff --git a/devel/fuzz/gnutls_server_fuzzer.cc b/devel/fuzz/gnutls_server_fuzzer.cc index 546ab14b15..9099570e13 100644 --- a/devel/fuzz/gnutls_server_fuzzer.cc +++ b/devel/fuzz/gnutls_server_fuzzer.cc @@ -1,5 +1,5 @@ /* -# Copyright 2016 Google Inc. +# Copyright 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ #include <gnutls/gnutls.h> -static const uint8_t kCertificateDER[] = { +static const uint8_t kRSACertificateDER[] = { 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, @@ -194,13 +194,71 @@ static const uint8_t kRSAPrivateKeyDER[] = { 0x98, 0x46, 0x89, 0x82, 0x40, }; +static const uint8_t kECDSACertificateDER[] = { +0x30, 0x82, 0x02, 0xA6, 0x30, 0x82, 0x01, 0x5E, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x53, +0x66, 0x2B, 0x39, 0x11, 0xBE, 0x18, 0xCB, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, +0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30, 0x19, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, +0x03, 0x13, 0x0E, 0x47, 0x6E, 0x75, 0x54, 0x4C, 0x53, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, +0x41, 0x30, 0x22, 0x18, 0x0F, 0x32, 0x30, 0x31, 0x34, 0x30, 0x35, 0x30, 0x34, 0x31, 0x31, 0x35, +0x37, 0x34, 0x36, 0x5A, 0x18, 0x0F, 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, +0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, +0x13, 0x09, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74, 0x30, 0x59, 0x30, 0x13, 0x06, +0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, +0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4C, 0x54, 0x46, 0xB0, 0x82, 0x30, 0x2F, 0x08, 0x16, 0xB7, +0x9F, 0x23, 0xFF, 0xCF, 0xBA, 0x05, 0x0D, 0x8B, 0x6D, 0x18, 0x58, 0xAC, 0x46, 0xB9, 0xD0, 0x9E, +0xAB, 0x72, 0x76, 0xF7, 0xC8, 0x0B, 0x3B, 0xD7, 0x6F, 0x6D, 0xC4, 0x97, 0xFB, 0x0D, 0x88, 0x33, +0xBD, 0x17, 0xE2, 0xFE, 0x43, 0x8B, 0x48, 0x99, 0x60, 0x24, 0x57, 0x9C, 0xB7, 0x25, 0x6E, 0x71, +0x4A, 0x3F, 0x03, 0x64, 0xDC, 0xB1, 0xA3, 0x81, 0x8D, 0x30, 0x81, 0x8A, 0x30, 0x0C, 0x06, 0x03, +0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x14, 0x06, 0x03, 0x55, 0x1D, +0x11, 0x04, 0x0D, 0x30, 0x0B, 0x82, 0x09, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74, +0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, +0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, +0x05, 0x03, 0x03, 0x07, 0x80, 0x00, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, +0x14, 0xBE, 0xF6, 0x00, 0xC6, 0x24, 0x6B, 0x60, 0xEA, 0xB5, 0xF8, 0x13, 0xC9, 0xA5, 0xD5, 0xE0, +0xC9, 0x29, 0xD5, 0xD7, 0x33, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, +0x80, 0x14, 0x4D, 0x56, 0xB7, 0x6A, 0x00, 0x58, 0xF1, 0x67, 0x92, 0xF4, 0xA6, 0x75, 0x55, 0x1B, +0x8E, 0x53, 0x01, 0x03, 0xEF, 0xCF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, +0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x31, 0x00, 0x63, 0xCD, 0xAF, 0xA6, 0xFF, 0xCC, +0x78, 0x47, 0xE5, 0x00, 0xE3, 0x69, 0xF8, 0xC5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0xBC, 0x60, 0xE2, +0xDC, 0x2F, 0x43, 0x42, 0x1D, 0xE5, 0x66, 0xD2, 0x45, 0xAA, 0x86, 0x84, 0x41, 0xB3, 0x31, 0xA9, +0xC8, 0x2F, 0xA6, 0x79, 0xC6, 0xA2, 0xBB, 0x7E, 0x08, 0x84, 0x43, 0x14, 0xBC, 0xB9, 0x30, 0xCA, +0xA4, 0x46, 0x51, 0xFA, 0x40, 0xF4, 0x09, 0xAC, 0x03, 0xE0, 0xBC, 0xCE, 0x2C, 0xB3, 0xB4, 0x55, +0xC7, 0x20, 0x4F, 0xE8, 0xAC, 0xC4, 0x95, 0x81, 0x6B, 0x4B, 0x1C, 0x02, 0x12, 0xB7, 0xA4, 0x1A, +0x69, 0x69, 0xF1, 0x7D, 0x97, 0x55, 0xB4, 0x53, 0x40, 0x95, 0x10, 0x3A, 0x23, 0xE9, 0x43, 0xD3, +0x62, 0xB7, 0x07, 0xAF, 0xE0, 0xF6, 0x81, 0x47, 0x93, 0x55, 0x1E, 0xE1, 0x0A, 0x64, 0xAA, 0x62, +0x1D, 0x8B, 0xEA, 0xFA, 0xC7, 0x15, 0xA0, 0x8F, 0x88, 0xE0 +}; + +static const uint8_t kECDSAPrivateKeyDER[] = { +0x30, 0x78, 0x02, 0x01, 0x01, 0x04, 0x21, 0x00, 0xDB, 0x98, 0xC6, 0xEB, 0xDB, 0xC9, 0x68, 0x33, +0x25, 0x2C, 0x0B, 0xA9, 0xEC, 0x0C, 0x98, 0x4A, 0x3A, 0x01, 0x38, 0xB6, 0x10, 0x70, 0x4E, 0x24, +0x5B, 0xAB, 0xB7, 0xD0, 0xB2, 0xC3, 0x99, 0xAB, 0xA0, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, +0x3D, 0x03, 0x01, 0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x4C, 0x54, 0x46, 0xB0, 0x82, 0x30, +0x2F, 0x08, 0x16, 0xB7, 0x9F, 0x23, 0xFF, 0xCF, 0xBA, 0x05, 0x0D, 0x8B, 0x6D, 0x18, 0x58, 0xAC, +0x46, 0xB9, 0xD0, 0x9E, 0xAB, 0x72, 0x76, 0xF7, 0xC8, 0x0B, 0x3B, 0xD7, 0x6F, 0x6D, 0xC4, 0x97, +0xFB, 0x0D, 0x88, 0x33, 0xBD, 0x17, 0xE2, 0xFE, 0x43, 0x8B, 0x48, 0x99, 0x60, 0x24, 0x57, 0x9C, +0xB7, 0x25, 0x6E, 0x71, 0x4A, 0x3F, 0x03, 0x64, 0xDC, 0xB1 +}; + #ifdef __cplusplus extern "C" #endif int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int res; - gnutls_datum_t cert, key; + gnutls_datum_t rsa_cert, rsa_key; + gnutls_datum_t ecdsa_cert, ecdsa_key; gnutls_session_t session; gnutls_certificate_credentials_t xcred; @@ -218,13 +276,26 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) res = gnutls_certificate_allocate_credentials(&xcred); assert(res >= 0); - cert.data = (unsigned char *)kCertificateDER; - cert.size = sizeof(kCertificateDER); - key.data = (unsigned char *)kRSAPrivateKeyDER; - key.size = sizeof(kRSAPrivateKeyDER); + rsa_cert.data = (unsigned char *)kRSACertificateDER; + rsa_cert.size = sizeof(kRSACertificateDER); + rsa_key.data = (unsigned char *)kRSAPrivateKeyDER; + rsa_key.size = sizeof(kRSAPrivateKeyDER); + + ecdsa_cert.data = (unsigned char *)kECDSACertificateDER; + ecdsa_cert.size = sizeof(kECDSACertificateDER); + ecdsa_key.data = (unsigned char *)kECDSAPrivateKeyDER; + ecdsa_key.size = sizeof(kECDSAPrivateKeyDER); + res = gnutls_certificate_set_x509_key_mem( - xcred, &cert, &key, GNUTLS_X509_FMT_DER); + xcred, &rsa_cert, &rsa_key, GNUTLS_X509_FMT_DER); assert(res >= 0); + + res = gnutls_certificate_set_x509_key_mem( + xcred, &ecdsa_cert, &ecdsa_key, GNUTLS_X509_FMT_DER); + assert(res >= 0); + + gnutls_certificate_set_known_dh_params(xcred, GNUTLS_SEC_PARAM_MEDIUM); + res = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); assert(res >= 0); |