diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-07-12 08:56:18 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-02-19 15:29:33 +0100 |
commit | b5ef35f789b9be6b4c89dd0f19450dd724288d62 (patch) | |
tree | 380298911dd3cabece71bd56dc99153ae32d50c8 | |
parent | 10ca2ee958fecab5a1784b3e4103c7cd4fd3c76f (diff) | |
download | gnutls-b5ef35f789b9be6b4c89dd0f19450dd724288d62.tar.gz |
tests: added signature tests for ECDSA-SECP256R1-SHA256
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/common-key-tests.h | 8 | ||||
-rw-r--r-- | tests/sign-verify-data-newapi.c | 6 | ||||
-rw-r--r-- | tests/sign-verify-data.c | 6 | ||||
-rw-r--r-- | tests/sign-verify-ext.c | 5 | ||||
-rw-r--r-- | tests/sign-verify-newapi.c | 5 | ||||
-rw-r--r-- | tests/sign-verify.c | 5 | ||||
-rw-r--r-- | tests/x509sign-verify.c | 3 |
7 files changed, 21 insertions, 17 deletions
diff --git a/tests/common-key-tests.h b/tests/common-key-tests.h index c769c66850..2c60176e6f 100644 --- a/tests/common-key-tests.h +++ b/tests/common-key-tests.h @@ -62,6 +62,14 @@ struct _key_tests_st common_key_tests[] = { .sigalgo = GNUTLS_SIGN_ECDSA_SHA256 }, { + .name = "ecdsa key", + .key = {(void *) server_ca3_ecc_key_pem, sizeof(server_ca3_ecc_key_pem)-1}, + .cert = {(void *) server_localhost_ca3_ecc_cert_pem, sizeof(server_localhost_ca3_ecc_cert_pem)-1}, + .pk = GNUTLS_PK_ECDSA, + .digest = GNUTLS_DIG_SHA256, + .sigalgo = GNUTLS_SIGN_ECDSA_SECP256R1_SHA256 + }, + { .name = "rsa pss key", .key = {(void *) server_ca3_rsa_pss_key_pem, sizeof(server_ca3_rsa_pss_key_pem)-1}, .cert = {(void *) server_ca3_rsa_pss_cert_pem, sizeof(server_ca3_rsa_pss_cert_pem)-1}, diff --git a/tests/sign-verify-data-newapi.c b/tests/sign-verify-data-newapi.c index b3f6f60707..5bc3f3088b 100644 --- a/tests/sign-verify-data-newapi.c +++ b/tests/sign-verify-data-newapi.c @@ -84,11 +84,11 @@ void doit(void) gnutls_global_set_log_level(6); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - if (debug) - success("loop %d\n", (int) i); - if (tests[i].pk == GNUTLS_PK_DSA) continue; + + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); + ret = gnutls_pubkey_init(&pubkey); if (ret < 0) testfail("gnutls_privkey_init\n"); diff --git a/tests/sign-verify-data.c b/tests/sign-verify-data.c index cbcee12333..3aa2611755 100644 --- a/tests/sign-verify-data.c +++ b/tests/sign-verify-data.c @@ -84,11 +84,11 @@ void doit(void) gnutls_global_set_log_level(6); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - if (debug) - success("loop %d\n", (int) i); - if (tests[i].pk == GNUTLS_PK_DSA) continue; + + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); + ret = gnutls_pubkey_init(&pubkey); if (ret < 0) testfail("gnutls_privkey_init\n"); diff --git a/tests/sign-verify-ext.c b/tests/sign-verify-ext.c index 6c1d0de804..eecb1f357b 100644 --- a/tests/sign-verify-ext.c +++ b/tests/sign-verify-ext.c @@ -141,12 +141,11 @@ void doit(void) gnutls_global_set_log_level(6); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - if (debug) - success("loop %d: %s\n", (int) i, tests[i].name); - if (tests[i].pk == GNUTLS_PK_RSA_PSS || tests[i].pk == GNUTLS_PK_EDDSA_ED25519) continue; + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); + if (tests[i].digest == GNUTLS_DIG_SHA1) { hash_data = &sha1_hash_data; } else { diff --git a/tests/sign-verify-newapi.c b/tests/sign-verify-newapi.c index 43991c2803..47ac3d983d 100644 --- a/tests/sign-verify-newapi.c +++ b/tests/sign-verify-newapi.c @@ -107,12 +107,11 @@ void doit(void) gnutls_global_set_log_level(6); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - if (debug) - success("loop %d\n", (int) i); - if (tests[i].pk == GNUTLS_PK_EDDSA_ED25519) continue; + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); + if (tests[i].digest == GNUTLS_DIG_SHA1) { hash_data = &sha1_hash_data; invalid_hash_data = &sha1_invalid_hash_data; diff --git a/tests/sign-verify.c b/tests/sign-verify.c index 53384f7772..1fbed5ece2 100644 --- a/tests/sign-verify.c +++ b/tests/sign-verify.c @@ -106,12 +106,11 @@ void doit(void) gnutls_global_set_log_level(6); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - if (debug) - success("loop %d\n", (int) i); - if (tests[i].pk == GNUTLS_PK_EDDSA_ED25519) continue; + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); + if (tests[i].digest == GNUTLS_DIG_SHA1) { hash_data = &sha1_hash_data; invalid_hash_data = &sha1_invalid_hash_data; diff --git a/tests/x509sign-verify.c b/tests/x509sign-verify.c index 45231e512f..e815d28b55 100644 --- a/tests/x509sign-verify.c +++ b/tests/x509sign-verify.c @@ -88,8 +88,7 @@ void doit(void) if (tests[i].pk == GNUTLS_PK_DSA || tests[i].pk == GNUTLS_PK_EDDSA_ED25519) continue; - if (debug) - success("loop %d\n", (int) i); + success("testing: %s - %s\n", tests[i].name, gnutls_sign_algorithm_get_name(tests[i].sigalgo)); ret = gnutls_x509_privkey_init(&privkey); if (ret < 0) |