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:43:07 +0000 (09:43 +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)

crypto/rsa/rsa_pk1.c

index 13f1d827bed38d11b02a0279b9af3e9c0023abec..cb7518e1d23734681b5454be9779c75e3ae13591 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;
 
     /*