aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-01 19:21:36 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-24 09:48:35 +0200
commit8c8026b8922a139d67e5b3fd143ca3a3b5bbc88a (patch)
tree4d64a7e4d5bcfe137fe2ef2a0233836d2821ee2c /tests
parent80be1d0ee9eb77166853100439cda59747be4b55 (diff)
downloadlibssh-8c8026b8922a139d67e5b3fd143ca3a3b5bbc88a.tar.gz
libssh-8c8026b8922a139d67e5b3fd143ca3a3b5bbc88a.tar.xz
libssh-8c8026b8922a139d67e5b3fd143ca3a3b5bbc88a.zip
tests: Init cipher structure in thread_crypto_aes256_cbc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests')
-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,