mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 06:33:06 +00:00
Fix intermittent test failure
Ecp key data length should not be measured by mbedtls_mpi_size(), as this does not count leading zeros, which are still part of the key. This resulted intermittently in the code attempting to import a wrongly sized key as the first byte was all zero. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
30437e6408
commit
7164dc52ce
@ -634,7 +634,7 @@ psa_status_t mbedtls_psa_generate_key_complete(
|
||||
|
||||
operation->num_ops = 1;
|
||||
|
||||
*key_len = mbedtls_mpi_size(&operation->ecp.d);
|
||||
*key_len = operation->ecp.d.n * sizeof(mbedtls_mpi_uint);
|
||||
if (*key_len > key_output_size) {
|
||||
return PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user