From d66387f8fa3937dff5037c589d19c9846ccf5627 Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Thu, 3 Feb 2022 08:55:33 +0100 Subject: [PATCH] Init psa status to PSA_ERROR_CORRUPTION_DETECTED Signed-off-by: Przemyslaw Stekiel --- library/ssl_msg.c | 8 ++++---- library/ssl_tls.c | 2 +- tests/suites/test_suite_ssl.function | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index b9395107bf..0e8ce6590e 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -774,7 +774,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl, int dynamic_iv_is_explicit = ssl_transform_aead_dynamic_iv_is_explicit( transform ); #if defined(MBEDTLS_USE_PSA_CRYPTO) - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; #else int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; #endif /* MBEDTLS_USE_PSA_CRYPTO */ @@ -892,7 +892,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl, size_t padlen, i; size_t olen; #if defined(MBEDTLS_USE_PSA_CRYPTO) - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; size_t part_len; psa_cipher_operation_t cipher_op = PSA_CIPHER_OPERATION_INIT; #endif /* MBEDTLS_USE_PSA_CRYPTO */ @@ -1178,7 +1178,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl, unsigned char *dynamic_iv; size_t dynamic_iv_len; #if defined(MBEDTLS_USE_PSA_CRYPTO) - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; #endif /* MBEDTLS_USE_PSA_CRYPTO */ /* @@ -1302,7 +1302,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl, { size_t minlen = 0; #if defined(MBEDTLS_USE_PSA_CRYPTO) - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; size_t part_len; psa_cipher_operation_t cipher_op = PSA_CIPHER_OPERATION_INIT; #endif /* MBEDTLS_USE_PSA_CRYPTO */ diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 0c92a059ea..1e9cb2ddf3 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -722,7 +722,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform, psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_algorithm_t alg; size_t key_bits; - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; #endif #if !defined(MBEDTLS_DEBUG_C) && \ diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index 0351db0930..00a9f8cad1 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -1192,7 +1192,7 @@ static int psa_cipher_encrypt_helper( mbedtls_ssl_transform *transform, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen ) { - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_cipher_operation_t cipher_op = PSA_CIPHER_OPERATION_INIT; size_t part_len; @@ -1239,7 +1239,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in, psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_algorithm_t alg; size_t key_bits; - psa_status_t status; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; #endif size_t keylen, maclen, ivlen;