Don't always recompute context length in mbedtls_rsa_get_len

This commit changes the implementation of `mbedtls_rsa_get_len` to return
`ctx->len` instead of always re-computing the modulus' byte-size via
`mbedtls_mpi_size`.
This commit is contained in:
Hanno Becker 2017-09-29 11:47:26 +01:00
parent 54cfc585cd
commit 2f8f06aa25

View File

@ -923,7 +923,7 @@ void mbedtls_rsa_set_padding( mbedtls_rsa_context *ctx, int padding, int hash_id
size_t mbedtls_rsa_get_len( const mbedtls_rsa_context *ctx )
{
return( mbedtls_mpi_size( &ctx->N ) );
return( ctx->len );
}