Use PSA_BITS_TO_BYTES instead of open-coded calculation in mbedtls_pk_wrap_as_opaque()
@@ -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 );
