fix inconsistent flen check in rsa_pk1 and rsa_oaep
authorMansour Ahmadi <m.ahmadi@northeastern.edu>
Tue, 11 Dec 2018 22:26:50 +0000 (17:26 -0500)
committerMatt Caswell <matt@openssl.org>
Thu, 13 Dec 2018 09:48:50 +0000 (09:48 +0000)
Fixes #7117

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7880)

(cherry picked from commit 4fea7005c3d08ed0d575bdea5082b7b0ce355237)

crypto/rsa/rsa_pk1.c

index b3a7a061177999c5f46e503faebc2ee7a2fb4cf3..0626907418095ec74affc75ca9514982826cccc5 100644 (file)
@@ -161,7 +161,7 @@ int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
     unsigned int good, found_zero_byte, mask;
     int zero_index = 0, msg_index, mlen = -1;
 
-    if (tlen < 0 || flen < 0)
+    if (tlen <= 0 || flen <= 0)
         return -1;
 
     /*