1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Merge remote-tracking branch 'pj/development' into mbedtls-1.3

* pj/development:
  Added more constant-time code and removed biases in the prime number generation routines.
This commit is contained in:
Manuel Pégourié-Gonnard
2015-04-15 14:12:59 +02:00
2 changed files with 32 additions and 19 deletions

View File

@ -773,7 +773,7 @@ int rsa_rsaes_oaep_decrypt( rsa_context *ctx,
for( i = 0; i < ilen - 2 * hlen - 2; i++ )
{
pad_done |= p[i];
pad_len += ( pad_done == 0 );
pad_len += ((pad_done | (unsigned char)-pad_done) >> 7) ^ 1;
}
p += pad_len;
@ -847,8 +847,8 @@ int rsa_rsaes_pkcs1_v15_decrypt( rsa_context *ctx,
* (minus one, for the 00 byte) */
for( i = 0; i < ilen - 3; i++ )
{
pad_done |= ( p[i] == 0 );
pad_count += ( pad_done == 0 );
pad_done |= ((p[i] | (unsigned char)-p[i]) >> 7) ^ 1;
pad_count += ((pad_done | (unsigned char)-pad_done) >> 7) ^ 1;
}
p += pad_count;