]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/bn/bn_gf2m.c: optimize ossl_(un)likely
authorNorbert Pocs <norbertp@openssl.org>
Thu, 3 Jul 2025 13:53:31 +0000 (15:53 +0200)
committerNeil Horman <nhorman@openssl.org>
Wed, 16 Jul 2025 17:07:15 +0000 (13:07 -0400)
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27961)

crypto/bn/bn_gf2m.c

index ae7e9d751c29cefa3703b380edbfc0303eca5623..666c7bef03cf222348837001210836860fd0a23a 100644 (file)
@@ -344,7 +344,7 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
         d0 = p[0] % BN_BITS2;
         d1 = BN_BITS2 - d0;
         z[j - n] ^= (zz >> d0);
-        if (d0)
+        if (ossl_likely(d0))
             z[j - n - 1] ^= (zz << d1);
     }
 
@@ -358,7 +358,7 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
         d1 = BN_BITS2 - d0;
 
         /* clear up the top d1 bits */
-        if (d0)
+        if (ossl_likely(d0))
             z[dN] = (z[dN] << d1) >> d1;
         else
             z[dN] = 0;