mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
tests: Add pki torture tests for keytypes.
This commit is contained in:
@@ -108,6 +108,28 @@ static int torture_read_one_line(const char *filename, char *buffer, size_t len)
|
|||||||
return 0;
|
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) {
|
static void torture_pki_import_privkey_base64_RSA(void **state) {
|
||||||
int rc;
|
int rc;
|
||||||
char *key_str;
|
char *key_str;
|
||||||
@@ -535,6 +557,8 @@ static void torture_pki_duplicate_key_dsa(void **state)
|
|||||||
int torture_run_tests(void) {
|
int torture_run_tests(void) {
|
||||||
int rc;
|
int rc;
|
||||||
const UnitTest tests[] = {
|
const UnitTest tests[] = {
|
||||||
|
unit_test(torture_pki_keytype),
|
||||||
|
|
||||||
/* ssh_pki_import_privkey_base64 */
|
/* ssh_pki_import_privkey_base64 */
|
||||||
unit_test_setup_teardown(torture_pki_import_privkey_base64_NULL_key,
|
unit_test_setup_teardown(torture_pki_import_privkey_base64_NULL_key,
|
||||||
setup_rsa_key,
|
setup_rsa_key,
|
||||||
|
|||||||
Reference in New Issue
Block a user