mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-14 01:26:49 +00:00
Guard memcpy so that it won't fail on null input pointer
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
b41c3c9582
commit
5d2e82f0ce
@ -6864,12 +6864,12 @@ static psa_status_t psa_pbkdf2_hmac_set_password(psa_algorithm_t hash_alg,
|
||||
{
|
||||
psa_status_t status = PSA_SUCCESS;
|
||||
if (input_len > PSA_HASH_BLOCK_LENGTH(hash_alg)) {
|
||||
status = psa_hash_compute(hash_alg, input, input_len, output,
|
||||
PSA_HMAC_MAX_HASH_BLOCK_SIZE, output_len);
|
||||
} else {
|
||||
return psa_hash_compute(hash_alg, input, input_len, output,
|
||||
PSA_HMAC_MAX_HASH_BLOCK_SIZE, output_len);
|
||||
} else if (input_len > 0) {
|
||||
memcpy(output, input, input_len);
|
||||
*output_len = PSA_HASH_BLOCK_LENGTH(hash_alg);
|
||||
}
|
||||
*output_len = PSA_HASH_BLOCK_LENGTH(hash_alg);
|
||||
return status;
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC */
|
||||
|
Loading…
x
Reference in New Issue
Block a user