From b8513fa6acbe45414f1168f694072e656e2e1499 Mon Sep 17 00:00:00 2001 From: gabor-mezei-arm Date: Mon, 24 Aug 2020 09:53:04 +0200 Subject: [PATCH] Initialize return variable to the appropriate error code The return variable is initilized to make the code more robust against glitch attacks. Signed-off-by: gabor-mezei-arm --- library/pkcs5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/pkcs5.c b/library/pkcs5.c index 37cca00faf..82b63bc3ae 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -223,7 +223,8 @@ int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx, unsigned int iteration_count, uint32_t key_length, unsigned char *output ) { - int ret = 0, j; + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + int j; unsigned int i; unsigned char md1[MBEDTLS_MD_MAX_SIZE]; unsigned char work[MBEDTLS_MD_MAX_SIZE];