Limit max input cost to 32bit

Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
This commit is contained in:
Kusumit Ghoderao 2023-05-08 15:57:41 +05:30
parent d0422f30c5
commit 3fc4ca7272
2 changed files with 4 additions and 4 deletions

View file

@ -116,7 +116,7 @@ typedef enum {
typedef struct {
psa_pbkdf2_key_derivation_state_t MBEDTLS_PRIVATE(state);
uint64_t MBEDTLS_PRIVATE(input_cost);
size_t MBEDTLS_PRIVATE(input_cost);
uint8_t *MBEDTLS_PRIVATE(salt);
size_t MBEDTLS_PRIVATE(salt_length);
uint8_t *MBEDTLS_PRIVATE(password);

View file

@ -6423,11 +6423,11 @@ static psa_status_t psa_pbkdf2_set_input_cost(
if (pbkdf2->state != PSA_PBKDF2_STATE_INIT) {
return PSA_ERROR_BAD_STATE;
}
#if UINT_MAX > 0xFFFFFFFF
if (data > 0xFFFFFFFF) {
return PSA_ERROR_INVALID_ARGUMENT;
return PSA_ERROR_NOT_SUPPORTED;
}
#endif
if (data == 0) {
return PSA_ERROR_INVALID_ARGUMENT;
}