libtomcrypt: fix pkcs_1_v1_5_decode() when empty message

In case of EME-PKCS1-v1_5 decoding, the encoded message
format is as follow : EM = 0x00 || 0x02 || PS || 0x00 || M.
When using an empty message, the 0x00 octet that separates
the padding string and message is located at the end. Thus,
update the condition to pass the check in case of empty message.

This fixes the following AOSP cts test:
Module: CtsKeystoreTestCases
Test: testEmptyPlaintextEncryptsAndDecrypts
Link: https://android.googlesource.com/platform/cts/+/refs/tags/android-cts-12.0_r6/tests/tests/keystore/src/android/keystore/cts/CipherTest.java

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
[jf: upstream commit caf350028833]
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/core/lib/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c b/core/lib/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c
index c07d81f..e988060 100644
--- a/core/lib/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c
+++ b/core/lib/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c
@@ -58,7 +58,7 @@
     }
     ps_len = i++ - 2;
 
-    if (i >= modulus_len) {
+    if (i > modulus_len) {
       /* There was no octet with hexadecimal value 0x00 to separate ps from m.
        */
       result = CRYPT_INVALID_PACKET;