diff --git a/cipher/rsa-common.c b/cipher/rsa-common.c index 1c36c912..b1cb9958 100644 --- a/cipher/rsa-common.c +++ b/cipher/rsa-common.c @@ -668,6 +668,7 @@ _gcry_rsa_oaep_decode (unsigned char **r_result, size_t *r_resultlen, int failed = 0; /* Error indicator. */ size_t n, n1; unsigned int not_found = 1; + unsigned int ps_error = 0; /* Catch PS failure. */ *r_result = NULL; @@ -755,8 +756,9 @@ _gcry_rsa_oaep_decode (unsigned char **r_result, size_t *r_resultlen, { not_found &= ct_not_equal_byte (db[n], 0x01); n1 += not_found; + ps_error |= (not_found & ct_not_equal_byte (db[n], 0x00)); } - failed |= not_found; + failed |= (not_found | ps_error); failed |= ct_not_equal_byte (frame[0], 0x00); xfree (lhash);