aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-21 13:13:21 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-21 13:13:21 +0200
commitfa4f2d8bc134ba550ef33569a5486c6b3405ca0f (patch)
tree97139f7e86cf0612c1bba767a396c72044089b11 /tests/unittests
parent42cea1f2f1f1137ffa00ac29588a75ff9cff363d (diff)
downloadlibssh-fa4f2d8bc134ba550ef33569a5486c6b3405ca0f.tar.gz
libssh-fa4f2d8bc134ba550ef33569a5486c6b3405ca0f.tar.xz
libssh-fa4f2d8bc134ba550ef33569a5486c6b3405ca0f.zip
tests: Add pki torture tests for keytypes.
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/torture_pki.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unittests/torture_pki.c b/tests/unittests/torture_pki.c
index 1d14938..9dc703f 100644
--- a/tests/unittests/torture_pki.c
+++ b/tests/unittests/torture_pki.c
@@ -108,6 +108,28 @@ static int torture_read_one_line(const char *filename, char *buffer, size_t len)
return 0;
}
+static void torture_pki_keytype(void **state) {
+ enum ssh_keytypes_e type;
+ const char *type_c;
+
+ (void) state; /* unused */
+
+ type = ssh_key_type(NULL);
+ assert_true(type == SSH_KEYTYPE_UNKNOWN);
+
+ type = ssh_key_type_from_name(NULL);
+ assert_true(type == SSH_KEYTYPE_UNKNOWN);
+
+ type = ssh_key_type_from_name("42");
+ assert_true(type == SSH_KEYTYPE_UNKNOWN);
+
+ type_c = ssh_key_type_to_char(SSH_KEYTYPE_UNKNOWN);
+ assert_true(type_c == NULL);
+
+ type_c = ssh_key_type_to_char(42);
+ assert_true(type_c == NULL);
+}
+
static void torture_pki_import_privkey_base64_RSA(void **state) {
int rc;
char *key_str;
@@ -535,6 +557,8 @@ static void torture_pki_duplicate_key_dsa(void **state)
int torture_run_tests(void) {
int rc;
const UnitTest tests[] = {
+ unit_test(torture_pki_keytype),
+
/* ssh_pki_import_privkey_base64 */
unit_test_setup_teardown(torture_pki_import_privkey_base64_NULL_key,
setup_rsa_key,