tests: Add null checks in torture_pki_rsa.c
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
77f58a225f
Коммит
8170e30073
@ -352,6 +352,7 @@ static void torture_pki_rsa_duplicate_key(void **state)
|
||||
|
||||
rc = ssh_pki_import_pubkey_file(LIBSSH_RSA_TESTKEY ".pub", &pubkey);
|
||||
assert_true(rc == 0);
|
||||
assert_non_null(pubkey);
|
||||
|
||||
rc = ssh_pki_export_pubkey_base64(pubkey, &b64_key);
|
||||
assert_true(rc == 0);
|
||||
@ -366,13 +367,15 @@ static void torture_pki_rsa_duplicate_key(void **state)
|
||||
assert_non_null(privkey);
|
||||
|
||||
privkey_dup = ssh_key_dup(privkey);
|
||||
assert_true(privkey_dup != NULL);
|
||||
assert_non_null(privkey_dup);
|
||||
|
||||
rc = ssh_pki_export_privkey_to_pubkey(privkey, &pubkey);
|
||||
assert_true(rc == SSH_OK);
|
||||
assert_non_null(pubkey);
|
||||
|
||||
rc = ssh_pki_export_pubkey_base64(pubkey, &b64_key_gen);
|
||||
assert_true(rc == 0);
|
||||
assert_non_null(b64_key_gen);
|
||||
|
||||
assert_string_equal(b64_key, b64_key_gen);
|
||||
|
||||
@ -493,6 +496,7 @@ static void torture_pki_rsa_write_privkey(void **state)
|
||||
NULL,
|
||||
&origkey);
|
||||
assert_true(rc == 0);
|
||||
assert_non_null(origkey);
|
||||
|
||||
unlink(LIBSSH_RSA_TESTKEY);
|
||||
|
||||
@ -509,6 +513,7 @@ static void torture_pki_rsa_write_privkey(void **state)
|
||||
NULL,
|
||||
&privkey);
|
||||
assert_true(rc == 0);
|
||||
assert_non_null(privkey);
|
||||
|
||||
rc = ssh_key_cmp(origkey, privkey, SSH_KEY_CMP_PRIVATE);
|
||||
assert_true(rc == 0);
|
||||
@ -523,6 +528,7 @@ static void torture_pki_rsa_write_privkey(void **state)
|
||||
NULL,
|
||||
&origkey);
|
||||
assert_true(rc == 0);
|
||||
assert_non_null(origkey);
|
||||
|
||||
unlink(LIBSSH_RSA_TESTKEY_PASSPHRASE);
|
||||
rc = ssh_pki_export_privkey_file(origkey,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user