From 8c8026b8922a139d67e5b3fd143ca3a3b5bbc88a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 1 Oct 2018 19:21:36 +0200 Subject: [PATCH] tests: Init cipher structure in thread_crypto_aes256_cbc() Signed-off-by: Andreas Schneider --- tests/unittests/torture_threads_crypto.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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,