aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-01 19:21:36 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-19 22:01:28 +0200
commitb290f9f2172cbf09a8e775f529564f59528f46c0 (patch)
treeff4f6d6c4afd1a3db6ee89678562420fe9b47221
parent17c0974685158d915cf5f141f6be7c109aaa764a (diff)
downloadlibssh-b290f9f2172cbf09a8e775f529564f59528f46c0.tar.gz
libssh-b290f9f2172cbf09a8e775f529564f59528f46c0.tar.xz
libssh-b290f9f2172cbf09a8e775f529564f59528f46c0.zip
tests: Init cipher structure in thread_crypto_aes256_cbc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/unittests/torture_threads_crypto.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/unittests/torture_threads_crypto.c b/tests/unittests/torture_threads_crypto.c
index 12105ae3..871f2920 100644
--- a/tests/unittests/torture_threads_crypto.c
+++ b/tests/unittests/torture_threads_crypto.c
@@ -108,7 +108,9 @@ static void *thread_crypto_aes256_cbc(void *threadid)
{
uint8_t output[sizeof(cleartext)] = {0};
uint8_t iv[16] = {0};
- struct ssh_cipher_struct cipher;
+ struct ssh_cipher_struct cipher = {
+ .name = NULL,
+ };
int rc;
/* Unused */
@@ -116,6 +118,14 @@ static void *thread_crypto_aes256_cbc(void *threadid)
rc = get_cipher(&cipher, "aes256-cbc");
assert_int_equal(rc, SSH_OK);
+ assert_non_null(cipher.set_encrypt_key);
+ assert_non_null(cipher.encrypt);
+
+ /* This is for dump static analizyer without modelling support */
+ if (cipher.set_encrypt_key == NULL ||
+ cipher.encrypt == NULL) {
+ return NULL;
+ }
memcpy(iv, IV, sizeof(IV));
cipher.set_encrypt_key(&cipher,
@@ -136,6 +146,14 @@ static void *thread_crypto_aes256_cbc(void *threadid)
rc = get_cipher(&cipher, "aes256-cbc");
assert_int_equal(rc, SSH_OK);
+ assert_non_null(cipher.set_encrypt_key);
+ assert_non_null(cipher.encrypt);
+
+ /* This is for dump static analizyer without modelling support */
+ if (cipher.set_encrypt_key == NULL ||
+ cipher.encrypt == NULL) {
+ return NULL;
+ }
memcpy(iv, IV, sizeof(IV));
cipher.set_decrypt_key(&cipher,