1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

psa_pake_input: validate buffer size using PSA_PAKE_INPUT_SIZE

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel
2023-03-22 13:15:33 +01:00
parent 3543806026
commit 656b2595fb
2 changed files with 8 additions and 2 deletions

View File

@ -7323,6 +7323,8 @@ psa_status_t psa_pake_setup(
memset(&operation->data.inputs, 0, sizeof(operation->data.inputs));
operation->alg = cipher_suite->algorithm;
operation->primitive = PSA_PAKE_PRIMITIVE(cipher_suite->type,
cipher_suite->family, cipher_suite->bits);
operation->data.inputs.cipher_suite = *cipher_suite;
#if defined(PSA_WANT_ALG_JPAKE)
@ -7920,7 +7922,9 @@ psa_status_t psa_pake_input(
goto exit;
}
if (input_length == 0 || input_length > PSA_PAKE_INPUT_MAX_SIZE) {
if (input_length == 0 || input_length > PSA_PAKE_INPUT_SIZE(operation->alg,
operation->primitive,
step)) {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}