aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-09-13 16:46:20 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-18 10:19:59 +0200
commit8170e3007311758e55fc7f7566a63dd113746d30 (patch)
tree052f9a60065d43c3d8be5c26c2a2cc0e31343ad2
parent77f58a225fd2b9f45717c91e73a62d5e9ac8e398 (diff)
downloadlibssh-8170e3007311758e55fc7f7566a63dd113746d30.tar.gz
libssh-8170e3007311758e55fc7f7566a63dd113746d30.tar.xz
libssh-8170e3007311758e55fc7f7566a63dd113746d30.zip
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>
-rw-r--r--tests/unittests/torture_pki_rsa.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/unittests/torture_pki_rsa.c b/tests/unittests/torture_pki_rsa.c
index 34f76040..0d5e97fa 100644
--- a/tests/unittests/torture_pki_rsa.c
+++ b/tests/unittests/torture_pki_rsa.c
@@ -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,