summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2020-01-24 22:57:49 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2020-01-25 12:14:41 +0100
commit124f8a96034f47c4d9daffbe1df14113f18fc37a (patch)
tree71fab8765b32fee31d607d0b3034695b2843ebbb /fuzz
parentc5417511c3dfd8d048ff84f6cf36d953949471f7 (diff)
downloadgnutls-124f8a96034f47c4d9daffbe1df14113f18fc37a.tar.gz
fuzzers: added ed448 keys
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/certs.h78
-rw-r--r--fuzz/gnutls_client_rawpk_fuzzer.c8
-rw-r--r--fuzz/gnutls_psk_server_fuzzer.c11
-rw-r--r--fuzz/gnutls_server_fuzzer.c11
-rw-r--r--fuzz/gnutls_server_rawpk_fuzzer.c8
-rw-r--r--fuzz/gnutls_srp_server_fuzzer.c1
6 files changed, 103 insertions, 14 deletions
diff --git a/fuzz/certs.h b/fuzz/certs.h
index c95f63b5dd..de57f9d4fe 100644
--- a/fuzz/certs.h
+++ b/fuzz/certs.h
@@ -300,6 +300,74 @@ static const uint8_t kEd25519PrivateKeyDER[] = {
0xe5, 0xb4, 0x5f, 0x9b, 0xd7, 0xa6, 0xf8, 0x36, 0x0c, 0x92, 0x59, 0x70
};
+static const uint8_t kEd448PrivateKeyDER[] = {
+ 0x30, 0x47, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x71,
+ 0x04, 0x3b, 0x04, 0x39, 0x0c, 0xf8, 0x7e, 0xb0, 0x94, 0xbf, 0x46, 0xd1,
+ 0x61, 0xbd, 0xe3, 0xb9, 0x9d, 0x1d, 0x32, 0x85, 0x6f, 0xec, 0xfa, 0xe0,
+ 0x14, 0x23, 0x92, 0xcd, 0x98, 0xc0, 0x91, 0xdb, 0x20, 0x6d, 0x17, 0x4b,
+ 0xbf, 0x8e, 0xf4, 0x76, 0xa9, 0xcf, 0x74, 0x6d, 0x94, 0x30, 0x6c, 0x56,
+ 0x5f, 0x97, 0xac, 0x50, 0x79, 0x6f, 0x02, 0x1e, 0xff, 0x8d, 0x77, 0x9c,
+ 0xa5
+};
+
+static const uint8_t kEd448CertificateDER[] = {
+ 0x30, 0x82, 0x02, 0x86, 0x30, 0x82, 0x01, 0x3e, 0xa0, 0x03, 0x02, 0x01,
+ 0x02, 0x02, 0x14, 0x71, 0x76, 0x43, 0x3c, 0xd1, 0x31, 0x93, 0x61, 0xdd,
+ 0xf7, 0x39, 0x0e, 0x77, 0xd7, 0x35, 0x41, 0x3b, 0x9d, 0xed, 0x8d, 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, 0x20, 0x17, 0x0d, 0x31, 0x39, 0x30,
+ 0x34, 0x32, 0x34, 0x31, 0x34, 0x35, 0x36, 0x35, 0x38, 0x5a, 0x18, 0x0f,
+ 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39,
+ 0x35, 0x39, 0x5a, 0x30, 0x00, 0x30, 0x43, 0x30, 0x05, 0x06, 0x03, 0x2b,
+ 0x65, 0x71, 0x03, 0x3a, 0x00, 0x9a, 0xdd, 0xde, 0x61, 0xf6, 0x68, 0xf2,
+ 0xdb, 0xc0, 0xac, 0x24, 0x87, 0x4a, 0xdb, 0x47, 0xa2, 0xaa, 0x6a, 0xd5,
+ 0x9f, 0xa8, 0x88, 0xbd, 0xc5, 0xd4, 0x30, 0x70, 0x5e, 0xd0, 0x79, 0x6a,
+ 0x8c, 0x33, 0x07, 0x82, 0xb5, 0x18, 0x60, 0x78, 0x5b, 0xe6, 0x3f, 0xd7,
+ 0x9b, 0x1c, 0x7c, 0xf5, 0x8f, 0xd7, 0x28, 0xb2, 0xbf, 0x3d, 0x77, 0x39,
+ 0x51, 0x00, 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, 0x60, 0x1a, 0x34,
+ 0x07, 0x71, 0x25, 0xec, 0x23, 0x5a, 0xe5, 0x71, 0xbc, 0x95, 0xec, 0x1b,
+ 0x8b, 0x9a, 0x19, 0xdc, 0xfb, 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,
+ 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0xf3, 0x6b,
+ 0x54, 0x61, 0xac, 0x27, 0xf6, 0x1f, 0xec, 0x35, 0xe6, 0x22, 0xd2, 0xb8,
+ 0xef, 0x1d, 0x94, 0x47, 0x8e, 0x29, 0x70, 0x87, 0x2e, 0x9f, 0x36, 0x53,
+ 0xba, 0xe8, 0x4f, 0x97, 0xa2, 0xcd, 0x7a, 0x52, 0x27, 0xb8, 0xfa, 0x2f,
+ 0xa0, 0x9a, 0x7c, 0xce, 0xc1, 0xde, 0x70, 0x0f, 0x2c, 0x7b, 0x6a, 0x18,
+ 0x3b, 0x72, 0x34, 0x7c, 0x11, 0x77, 0x0a, 0x9c, 0x1d, 0x2c, 0x18, 0xc4,
+ 0x34, 0xa7, 0x58, 0x5a, 0xb7, 0x58, 0xff, 0x2f, 0x7c, 0xda, 0x70, 0xaa,
+ 0x78, 0xa4, 0x89, 0x06, 0x55, 0xee, 0xbf, 0x52, 0x89, 0xbf, 0x18, 0x0a,
+ 0x6f, 0x08, 0x51, 0xa2, 0x47, 0x59, 0x96, 0x06, 0xd9, 0x0e, 0x01, 0x72,
+ 0x5b, 0x3f, 0x7e, 0x74, 0xe9, 0x6a, 0x2f, 0x54, 0x00, 0xa4, 0x1e, 0x38,
+ 0x03, 0x6c, 0xa0, 0xb2, 0xb4, 0xf8, 0x33, 0x16, 0x4c, 0x1b, 0x0c, 0x00,
+ 0xa7, 0x7d, 0x84, 0xa3, 0x33, 0x44, 0x31, 0x96, 0x50, 0x9a, 0x99, 0xf2,
+ 0x4a, 0xdd
+};
+
/* Raw public-key key material for testing */
static char rawpk_public_key_pem1[] =
"-----BEGIN PUBLIC KEY-----\n"
@@ -365,4 +433,14 @@ const gnutls_datum_t rawpk_private_key1 = {
sizeof(rawpk_private_key_pem1) - 1
};
+#define IGNORE_CERTS \
+ (void) kEd25519PrivateKeyDER; \
+ (void) kEd25519CertificateDER; \
+ (void) kEd448PrivateKeyDER; \
+ (void) kEd448CertificateDER; \
+ (void) kECDSAPrivateKeyDER; \
+ (void) kECDSACertificateDER; \
+ (void) kRSAPrivateKeyDER; \
+ (void) kRSACertificateDER
+
#endif
diff --git a/fuzz/gnutls_client_rawpk_fuzzer.c b/fuzz/gnutls_client_rawpk_fuzzer.c
index af4336363a..c20b885538 100644
--- a/fuzz/gnutls_client_rawpk_fuzzer.c
+++ b/fuzz/gnutls_client_rawpk_fuzzer.c
@@ -54,13 +54,7 @@
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
{
- (void) kEd25519PrivateKeyDER;
- (void) kEd25519CertificateDER;
- (void) kECDSAPrivateKeyDER;
- (void) kECDSACertificateDER;
- (void) kRSAPrivateKeyDER;
- (void) kRSACertificateDER;
-
+ IGNORE_CERTS;
int res;
gnutls_session_t session;
gnutls_certificate_credentials_t rawpk_cred;
diff --git a/fuzz/gnutls_psk_server_fuzzer.c b/fuzz/gnutls_psk_server_fuzzer.c
index 3c1f62df19..d07e2eef60 100644
--- a/fuzz/gnutls_psk_server_fuzzer.c
+++ b/fuzz/gnutls_psk_server_fuzzer.c
@@ -51,6 +51,7 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;
gnutls_datum_t ed25519_cert, ed25519_key;
+ gnutls_datum_t ed448_cert, ed448_key;
gnutls_session_t session;
gnutls_certificate_credentials_t xcred;
gnutls_psk_server_credentials_t pcred;
@@ -83,6 +84,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
ed25519_key.data = (unsigned char *)kEd25519PrivateKeyDER;
ed25519_key.size = sizeof(kEd25519PrivateKeyDER);
+ ed448_cert.data = (unsigned char *)kEd448CertificateDER;
+ ed448_cert.size = sizeof(kEd448CertificateDER);
+ ed448_key.data = (unsigned char *)kEd448PrivateKeyDER;
+ ed448_key.size = sizeof(kEd448PrivateKeyDER);
+
res =
gnutls_certificate_set_x509_key_mem(xcred, &rsa_cert, &rsa_key,
GNUTLS_X509_FMT_DER);
@@ -98,6 +104,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
GNUTLS_X509_FMT_DER);
assert(res >= 0);
+ res =
+ gnutls_certificate_set_x509_key_mem(xcred, &ed448_cert, &ed448_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);
diff --git a/fuzz/gnutls_server_fuzzer.c b/fuzz/gnutls_server_fuzzer.c
index 3ef02aec3c..d42d27420f 100644
--- a/fuzz/gnutls_server_fuzzer.c
+++ b/fuzz/gnutls_server_fuzzer.c
@@ -34,6 +34,7 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;
gnutls_datum_t ed25519_cert, ed25519_key;
+ gnutls_datum_t ed448_cert, ed448_key;
gnutls_session_t session;
gnutls_certificate_credentials_t xcred;
struct mem_st memdata;
@@ -59,6 +60,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
ed25519_key.data = (unsigned char *)kEd25519PrivateKeyDER;
ed25519_key.size = sizeof(kEd25519PrivateKeyDER);
+ ed448_cert.data = (unsigned char *)kEd448CertificateDER;
+ ed448_cert.size = sizeof(kEd448CertificateDER);
+ ed448_key.data = (unsigned char *)kEd448PrivateKeyDER;
+ ed448_key.size = sizeof(kEd448PrivateKeyDER);
+
res =
gnutls_certificate_set_x509_key_mem(xcred, &rsa_cert, &rsa_key,
GNUTLS_X509_FMT_DER);
@@ -74,6 +80,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
GNUTLS_X509_FMT_DER);
assert(res >= 0);
+ res =
+ gnutls_certificate_set_x509_key_mem(xcred, &ed448_cert, &ed448_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);
diff --git a/fuzz/gnutls_server_rawpk_fuzzer.c b/fuzz/gnutls_server_rawpk_fuzzer.c
index 854f5872fe..a1a6713869 100644
--- a/fuzz/gnutls_server_rawpk_fuzzer.c
+++ b/fuzz/gnutls_server_rawpk_fuzzer.c
@@ -50,13 +50,7 @@
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
{
- (void) kEd25519PrivateKeyDER;
- (void) kEd25519CertificateDER;
- (void) kECDSAPrivateKeyDER;
- (void) kECDSACertificateDER;
- (void) kRSAPrivateKeyDER;
- (void) kRSACertificateDER;
-
+ IGNORE_CERTS;
int res;
gnutls_session_t session;
gnutls_certificate_credentials_t rawpk_cred;
diff --git a/fuzz/gnutls_srp_server_fuzzer.c b/fuzz/gnutls_srp_server_fuzzer.c
index 567b7d45c9..04301638e4 100644
--- a/fuzz/gnutls_srp_server_fuzzer.c
+++ b/fuzz/gnutls_srp_server_fuzzer.c
@@ -61,6 +61,7 @@ srp_cb(gnutls_session_t session, const char *username,
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
{
+ IGNORE_CERTS;
int res;
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;