Commit be36a92f25 for openssl.org

commit be36a92f25fd393dfc737642b88054fd93202962
Author: Nicky Mouha <nicky@mouha.be>
Date:   Sun Nov 8 21:13:00 2026 -0500

    crypto/rsa/rsa_pss.c: perform array access after range check

    The code in ossl_rsa_verify_PKCS1_PSS_mgf1() performed an array index
    before a range check.  Although there is no bug here, performing
    the range check before the array access would make it immediately clear
    that the code is correct, and also avoids a static analyzer warning.
    Move the index check before the array access.

    Complements: d51204f1b1fe "PSS update [from 0.9.7]."
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Merge-date: Tue Nov 10 14:26:06 2026
    Merged-from: https://github.com/openssl/openssl/pull/33611

diff --git a/crypto/rsa/rsa_pss.c b/crypto/rsa/rsa_pss.c
index 98d6e70346..c71a956871 100644
--- a/crypto/rsa/rsa_pss.c
+++ b/crypto/rsa/rsa_pss.c
@@ -114,7 +114,7 @@ int ossl_rsa_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
         DB[i] ^= EM[i];
     if (MSBits)
         DB[0] &= 0xFF >> (8 - MSBits);
-    for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++)
+    for (i = 0; i < (maskedDBLen - 1) && DB[i] == 0; i++)
         ;
     if (DB[i++] != 0x1) {
         ERR_raise(ERR_LIB_RSA, RSA_R_SLEN_RECOVERY_FAILED);