aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/torture_pki_rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/torture_pki_rsa.c')
-rw-r--r--tests/unittests/torture_pki_rsa.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unittests/torture_pki_rsa.c b/tests/unittests/torture_pki_rsa.c
index 54e459f9..1f4f8402 100644
--- a/tests/unittests/torture_pki_rsa.c
+++ b/tests/unittests/torture_pki_rsa.c
@@ -31,6 +31,8 @@ static int setup_rsa_key(void **state)
torture_get_testkey(SSH_KEYTYPE_RSA, 0, 1));
torture_write_file(LIBSSH_RSA_TESTKEY ".pub",
torture_get_testkey_pub(SSH_KEYTYPE_RSA, 0));
+ torture_write_file(LIBSSH_RSA_TESTKEY ".pub",
+ torture_get_testkey_pub(SSH_KEYTYPE_RSA, 0));
torture_write_file(LIBSSH_RSA_TESTKEY "-cert.pub",
torture_get_testkey_pub(SSH_KEYTYPE_RSA_CERT01, 0));
@@ -48,6 +50,21 @@ static int teardown(void **state) {
return 0;
}
+static void torture_pki_rsa_import_pubkey_file(void **state)
+{
+ ssh_key pubkey = NULL;
+ int rc;
+
+ (void)state;
+
+ /* The key doesn't have the hostname as comment after the key */
+ rc = ssh_pki_import_pubkey_file(LIBSSH_RSA_TESTKEY ".pub", &pubkey);
+ assert_return_code(rc, errno);
+ assert_non_null(pubkey);
+
+ ssh_key_free(pubkey);
+}
+
static void torture_pki_rsa_import_privkey_base64_NULL_key(void **state)
{
int rc;
@@ -546,6 +563,9 @@ static void torture_pki_rsa_import_privkey_base64_passphrase(void **state)
int torture_run_tests(void) {
int rc;
struct CMUnitTest tests[] = {
+ cmocka_unit_test_setup_teardown(torture_pki_rsa_import_pubkey_file,
+ setup_rsa_key,
+ teardown),
cmocka_unit_test_setup_teardown(torture_pki_rsa_import_privkey_base64_NULL_key,
setup_rsa_key,
teardown),