mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 10:15:38 +01:00
Minor readability improvement
Polish the beginning of mbedtls_rsa_rsaes_pkcs1_v15_decrypt a little, to prepare for some behavior changes.
This commit is contained in:
parent
53546ea099
commit
5908dd4455
@ -1390,15 +1390,17 @@ int mbedtls_rsa_rsaes_pkcs1_v15_decrypt( mbedtls_rsa_context *ctx,
|
|||||||
size_t output_max_len )
|
size_t output_max_len )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
size_t ilen, pad_count = 0, i;
|
size_t ilen = ctx->len;
|
||||||
unsigned char *p, bad, pad_done = 0;
|
size_t pad_count = 0;
|
||||||
|
size_t i;
|
||||||
|
unsigned bad = 0;
|
||||||
|
unsigned char pad_done = 0;
|
||||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||||
|
unsigned char *p = buf;
|
||||||
|
|
||||||
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ilen = ctx->len;
|
|
||||||
|
|
||||||
if( ilen < 16 || ilen > sizeof( buf ) )
|
if( ilen < 16 || ilen > sizeof( buf ) )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
@ -1409,9 +1411,6 @@ int mbedtls_rsa_rsaes_pkcs1_v15_decrypt( mbedtls_rsa_context *ctx,
|
|||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
p = buf;
|
|
||||||
bad = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check and get padding len in "constant-time"
|
* Check and get padding len in "constant-time"
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user