Use PSA_BITS_TO_BYTES instead of open-coded calculation in mbedtls_pk_wrap_as_opaque()

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2022-03-22 10:25:14 +01:00
parent b354742371
commit 7e1b4a45fa

View File

@ -728,7 +728,7 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
/* export the private key material in the format PSA wants */
ec = mbedtls_pk_ec( *pk );
d_len = ( ec->grp.nbits + 7 ) / 8;
d_len = PSA_BITS_TO_BYTES( ec->grp.nbits );
if( ( ret = mbedtls_mpi_write_binary( &ec->d, d, d_len ) ) != 0 )
return( ret );