summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-07-30 02:57:03 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-04 16:53:54 +0200
commit2db9b2210fac7bd14f6b581a956db01d4da87cd0 (patch)
treefbbca47f841630c77d37d067d9aa3e5c6f54876f /devel
parent40682c7349579a347c5fcadc9428c03039e3d3ee (diff)
downloadgnutls-2db9b2210fac7bd14f6b581a956db01d4da87cd0.tar.gz
gnutls_server_fuzzer: added ed25519 key/cert
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'devel')
-rw-r--r--devel/fuzz/certs.h48
-rw-r--r--devel/fuzz/gnutls_psk_server_fuzzer.cc11
-rw-r--r--devel/fuzz/gnutls_server_fuzzer.cc11
-rw-r--r--devel/fuzz/gnutls_srp_server_fuzzer.cc11
4 files changed, 81 insertions, 0 deletions
diff --git a/devel/fuzz/certs.h b/devel/fuzz/certs.h
index 754c130b1c..6843714fe0 100644
--- a/devel/fuzz/certs.h
+++ b/devel/fuzz/certs.h
@@ -252,4 +252,52 @@ static const uint8_t kECDSAPrivateKeyDER[] = {
0xB7, 0x25, 0x6E, 0x71, 0x4A, 0x3F, 0x03, 0x64, 0xDC, 0xB1
};
+static const uint8_t kEd25519CertificateDER[] = {
+ 0x30, 0x82, 0x01, 0xc1, 0x30, 0x82, 0x01, 0x66, 0xa0, 0x03, 0x02, 0x01,
+ 0x02, 0x02, 0x08, 0x59, 0x36, 0x5a, 0xb1, 0x05, 0x86, 0x35, 0x51, 0x30,
+ 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30,
+ 0x7d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
+ 0x42, 0x45, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13,
+ 0x06, 0x47, 0x6e, 0x75, 0x54, 0x4c, 0x53, 0x31, 0x25, 0x30, 0x23, 0x06,
+ 0x03, 0x55, 0x04, 0x0b, 0x13, 0x1c, 0x47, 0x6e, 0x75, 0x54, 0x4c, 0x53,
+ 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65,
+ 0x20, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x0f,
+ 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x06, 0x4c, 0x65, 0x75,
+ 0x76, 0x65, 0x6e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03,
+ 0x13, 0x1c, 0x47, 0x6e, 0x75, 0x54, 0x4c, 0x53, 0x20, 0x63, 0x65, 0x72,
+ 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x75, 0x74,
+ 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30, 0x20, 0x17, 0x0d, 0x31, 0x37,
+ 0x30, 0x36, 0x30, 0x36, 0x30, 0x37, 0x33, 0x33, 0x30, 0x35, 0x5a, 0x18,
+ 0x0f, 0x39, 0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35,
+ 0x39, 0x35, 0x39, 0x5a, 0x30, 0x19, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
+ 0x55, 0x04, 0x03, 0x13, 0x0e, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39,
+ 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x2a, 0x30, 0x05, 0x06,
+ 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, 0xf3, 0x05, 0xfb, 0xe9, 0x73,
+ 0x2c, 0x8c, 0xdf, 0xc8, 0x25, 0xf4, 0xbf, 0x40, 0x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 0x47, 0x26,
+ 0xed, 0xb6, 0xab, 0x46, 0x88, 0x7e, 0xab, 0x1e, 0xd9, 0x55, 0x8a, 0x5e,
+ 0xfb, 0x9c, 0x37, 0x25, 0x8b, 0xb1, 0xcb, 0x5e, 0xb0
+};
+
+static const uint8_t kEd25519PrivateKeyDER[] = {
+ 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70,
+ 0x04, 0x22, 0x04, 0x20, 0xe5, 0xc3, 0x25, 0x73, 0x94, 0xe8, 0x9e, 0x97,
+ 0x75, 0x7c, 0x78, 0x59, 0xf7, 0x32, 0x3c, 0x82, 0xcf, 0x60, 0x90, 0xc7,
+ 0xe5, 0xb4, 0x5f, 0x9b, 0xd7, 0xa6, 0xf8, 0x36, 0x0c, 0x92, 0x59, 0x70
+};
+
#endif
diff --git a/devel/fuzz/gnutls_psk_server_fuzzer.cc b/devel/fuzz/gnutls_psk_server_fuzzer.cc
index d54cf068cd..dcbbba6640 100644
--- a/devel/fuzz/gnutls_psk_server_fuzzer.cc
+++ b/devel/fuzz/gnutls_psk_server_fuzzer.cc
@@ -54,6 +54,7 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
int res;
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;
+ gnutls_datum_t ed25519_cert, ed25519_key;
gnutls_session_t session;
gnutls_certificate_credentials_t xcred;
gnutls_psk_server_credentials_t pcred;
@@ -81,6 +82,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
ecdsa_key.data = (unsigned char *)kECDSAPrivateKeyDER;
ecdsa_key.size = sizeof(kECDSAPrivateKeyDER);
+ ed25519_cert.data = (unsigned char *)kEd25519CertificateDER;
+ ed25519_cert.size = sizeof(kEd25519CertificateDER);
+ ed25519_key.data = (unsigned char *)kEd25519PrivateKeyDER;
+ ed25519_key.size = sizeof(kEd25519PrivateKeyDER);
+
res =
gnutls_certificate_set_x509_key_mem(xcred, &rsa_cert, &rsa_key,
GNUTLS_X509_FMT_DER);
@@ -91,6 +97,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, &ed25519_cert, &ed25519_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/devel/fuzz/gnutls_server_fuzzer.cc b/devel/fuzz/gnutls_server_fuzzer.cc
index de12fdcb7d..ef2176af16 100644
--- a/devel/fuzz/gnutls_server_fuzzer.cc
+++ b/devel/fuzz/gnutls_server_fuzzer.cc
@@ -35,6 +35,7 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
int res;
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;
+ gnutls_datum_t ed25519_cert, ed25519_key;
gnutls_session_t session;
gnutls_certificate_credentials_t xcred;
struct mem_st memdata;
@@ -55,6 +56,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
ecdsa_key.data = (unsigned char *)kECDSAPrivateKeyDER;
ecdsa_key.size = sizeof(kECDSAPrivateKeyDER);
+ ed25519_cert.data = (unsigned char *)kEd25519CertificateDER;
+ ed25519_cert.size = sizeof(kEd25519CertificateDER);
+ ed25519_key.data = (unsigned char *)kEd25519PrivateKeyDER;
+ ed25519_key.size = sizeof(kEd25519PrivateKeyDER);
+
res =
gnutls_certificate_set_x509_key_mem(xcred, &rsa_cert, &rsa_key,
GNUTLS_X509_FMT_DER);
@@ -65,6 +71,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, &ed25519_cert, &ed25519_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/devel/fuzz/gnutls_srp_server_fuzzer.cc b/devel/fuzz/gnutls_srp_server_fuzzer.cc
index e58cfa413d..95db8c34a1 100644
--- a/devel/fuzz/gnutls_srp_server_fuzzer.cc
+++ b/devel/fuzz/gnutls_srp_server_fuzzer.cc
@@ -66,6 +66,7 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
int res;
gnutls_datum_t rsa_cert, rsa_key;
gnutls_datum_t ecdsa_cert, ecdsa_key;
+ gnutls_datum_t ed25519_cert, ed25519_key;
gnutls_session_t session;
gnutls_certificate_credentials_t xcred;
gnutls_srp_server_credentials_t pcred;
@@ -92,6 +93,11 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
ecdsa_key.data = (unsigned char *)kECDSAPrivateKeyDER;
ecdsa_key.size = sizeof(kECDSAPrivateKeyDER);
+ ed25519_cert.data = (unsigned char *)kEd25519CertificateDER;
+ ed25519_cert.size = sizeof(kEd25519CertificateDER);
+ ed25519_key.data = (unsigned char *)kEd25519PrivateKeyDER;
+ ed25519_key.size = sizeof(kEd25519PrivateKeyDER);
+
res =
gnutls_certificate_set_x509_key_mem(xcred, &rsa_cert, &rsa_key,
GNUTLS_X509_FMT_DER);
@@ -102,6 +108,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, &ed25519_cert, &ed25519_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);