summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-11-13 09:24:06 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-11-15 13:43:10 +0100
commitedeea341813d3cad544a2e089ef8192711ac79aa (patch)
treee8a538999b4c7636f67aa9813ec4d4c91ddc19e1 /tests
parent123c57a0ad9585e49a24ca72353c01dda26ef96f (diff)
downloadgnutls-edeea341813d3cad544a2e089ef8192711ac79aa.tar.gz
gnutls_x509_privkey_import_ecc_raw(): fail on invalid sizes
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/key-import-export.c5
-rw-r--r--tests/pubkey-import-export.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/key-import-export.c b/tests/key-import-export.c
index 8fdea07f95..47b8804c32 100644
--- a/tests/key-import-export.c
+++ b/tests/key-import-export.c
@@ -431,6 +431,11 @@ int check_privkey_import_export(void)
if (ret < 0)
fail("error\n");
+ /* test whether an invalid size would fail */
+ ret = gnutls_privkey_import_ecc_raw(key, GNUTLS_ECC_CURVE_ED25519, &_rsa_m, NULL, &_rsa_m);
+ if (ret != GNUTLS_E_INVALID_REQUEST)
+ fail("error\n");
+
ret = gnutls_privkey_import_ecc_raw(key, GNUTLS_ECC_CURVE_ED25519, &_ed25519_x, NULL, &_ed25519_k);
if (ret < 0)
fail("error\n");
diff --git a/tests/pubkey-import-export.c b/tests/pubkey-import-export.c
index 0f32537b94..46bfb729d9 100644
--- a/tests/pubkey-import-export.c
+++ b/tests/pubkey-import-export.c
@@ -276,6 +276,11 @@ int check_pubkey_import_export(void)
if (ret < 0)
fail("error\n");
+ /* test whether an invalid size would fail */
+ ret = gnutls_pubkey_import_ecc_raw(key, GNUTLS_ECC_CURVE_ED25519, &_rsa_m, NULL);
+ if (ret != GNUTLS_E_INVALID_REQUEST)
+ fail("error\n");
+
ret = gnutls_pubkey_import_ecc_raw(key, GNUTLS_ECC_CURVE_ED25519, &_ed25519_x, NULL);
if (ret < 0)
fail("error\n");