From 256c75df90e4d88fc624dd7d88dbbfa89210353c Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Thu, 23 Mar 2023 14:09:34 +0100 Subject: [PATCH] Fix signed/unsigned comparison (windows compilation failure) Signed-off-by: Przemek Stekiel --- library/psa_crypto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 049edfcac..e2e0cb849 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -7909,6 +7909,9 @@ psa_status_t psa_pake_input( { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_crypto_driver_pake_step_t driver_step = PSA_JPAKE_STEP_INVALID; + const size_t max_input_length = (size_t) PSA_PAKE_INPUT_SIZE(operation->alg, + operation->primitive, + step); if (operation->stage == PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS) { status = psa_pake_complete_inputs(operation); @@ -7922,9 +7925,8 @@ psa_status_t psa_pake_input( goto exit; } - if (input_length == 0 || input_length > PSA_PAKE_INPUT_SIZE(operation->alg, - operation->primitive, - step)) { + + if (input_length == 0 || input_length > max_input_length) { status = PSA_ERROR_INVALID_ARGUMENT; goto exit; }