[openssl] openssl-3.0 update

tomas at openssl.org tomas at openssl.org
Thu Jan 27 09:37:39 UTC 2022


The branch openssl-3.0 has been updated
       via  9fa43878ec74f8fa1aa70d9838d913e1c843c4e3 (commit)
      from  4ac8e51e3272c7d7f2e7d62da699f52e0112ac05 (commit)


- Log -----------------------------------------------------------------
commit 9fa43878ec74f8fa1aa70d9838d913e1c843c4e3
Author: Tomas Mraz <tomas at openssl.org>
Date:   Tue Jan 25 17:14:52 2022 +0100

    lhash: Avoid 32 bit right shift of a 32 bit value
    
    Fixes #17583
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/17589)
    
    (cherry picked from commit 2ce0a3d19005271e7e3c351b562d9da93e2d4c80)

-----------------------------------------------------------------------

Summary of changes:
 crypto/lhash/lhash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 82d0ec5b8b..29ba153dc8 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -383,7 +383,8 @@ unsigned long OPENSSL_LH_strhash(const char *c)
         v = n | (*c);
         n += 0x100;
         r = (int)((v >> 2) ^ v) & 0x0f;
-        ret = (ret << r) | (ret >> (32 - r));
+        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
+        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
         ret &= 0xFFFFFFFFL;
         ret ^= v * v;
         c++;
@@ -404,7 +405,8 @@ unsigned long ossl_lh_strcasehash(const char *c)
     for (n = 0x100; *c != '\0'; n += 0x100) {
         v = n | ossl_tolower(*c);
         r = (int)((v >> 2) ^ v) & 0x0f;
-        ret = (ret << r) | (ret >> (32 - r));
+        /* cast to uint64_t to avoid 32 bit shift of 32 bit value */
+        ret = (ret << r) | (unsigned long)((uint64_t)ret >> (32 - r));
         ret &= 0xFFFFFFFFL;
         ret ^= v * v;
         c++;


More information about the openssl-commits mailing list