From 6d77830c6a0ee0bd7314c4e752f9d9d3fa338556 Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Tue, 14 Feb 2023 20:24:32 +0100 Subject: [PATCH] Remove redundant code Signed-off-by: Przemek Stekiel --- library/psa_crypto.c | 4 ---- library/psa_crypto_pake.c | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 0fd0eff88..c57583aef 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -7508,11 +7508,7 @@ static psa_status_t psa_pake_complete_inputs( computation_stage->input_step = PSA_PAKE_STEP_X1_X2; computation_stage->output_step = PSA_PAKE_STEP_X1_X2; } - } else { - inputs.password_len = 0; - inputs.password = NULL; } - return status; } diff --git a/library/psa_crypto_pake.c b/library/psa_crypto_pake.c index 382f0214a..fdfbd16fb 100644 --- a/library/psa_crypto_pake.c +++ b/library/psa_crypto_pake.c @@ -242,7 +242,6 @@ psa_status_t mbedtls_psa_pake_setup(mbedtls_psa_pake_operation_t *operation, operation->buffer_offset = 0; status = psa_pake_ecjpake_setup(operation); - if (status != PSA_SUCCESS) { return status; } @@ -503,8 +502,6 @@ psa_status_t mbedtls_psa_pake_get_implicit_key( memcpy(output, operation->buffer, operation->buffer_length); *output_size = operation->buffer_length; - mbedtls_platform_zeroize(operation->buffer, MBEDTLS_PSA_PAKE_BUFFER_SIZE); - return PSA_SUCCESS; } else #else @@ -518,9 +515,7 @@ psa_status_t mbedtls_psa_pake_abort(mbedtls_psa_pake_operation_t *operation) #if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE) if (operation->alg == PSA_ALG_JPAKE) { - if (operation->password_len > 0) { - mbedtls_platform_zeroize(operation->password, operation->password_len); - } + mbedtls_platform_zeroize(operation->password, operation->password_len); mbedtls_free(operation->password); operation->password = NULL; operation->password_len = 0;