]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Increase the query cache insert grow retry
authorIngo Franzki <ifranzki@linux.ibm.com>
Mon, 20 Apr 2026 11:34:58 +0000 (13:34 +0200)
committerNikola Pajkovsky <nikolap@openssl.org>
Mon, 27 Apr 2026 05:56:44 +0000 (05:56 +0000)
On s390x, the distribution of the query cache hash values is different
compared to other architectures, probably because of endianess and pointer
alignment being different (the hash key contains pointer values and integers).
This leads to the fact that ossl_ht_cache_QUERY_insert() is not always able to
add a query during the FIPS selftests, and thus ossl_ht_cache_QUERY_insert()
returns -1 is such cases.

Increase the number of retries inside ossl_ht_insert() to at least the
number elements per neighborhood plus 1. With this it is able to grow the
hash table enough so that the queries used during the FIPS selftest can
all be added to the hash table, even on s390x.

There is still no guarantee that the number of retries is enough for all
possible queries. It can still happen that certain queries can't be added to
the cache, even on other architectures. This does not really hurt, such
queries will just not be cached and are freshly fetched again the next time.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Mon Apr 27 05:56:53 2026
(Merged from https://github.com/openssl/openssl/pull/30903)

crypto/hashtable/hashtable.c

index 5ed956e2ed5dfec659e32db09f05ecadc0a61bb0..febc8f69d172ff4edad20b0bc9ab3c5c3d713de1 100644 (file)
@@ -711,7 +711,7 @@ int ossl_ht_insert(HT *h, HT_KEY *key, HT_VALUE *data, HT_VALUE **olddata)
      */
     for (i = 0;
         (rc = ossl_ht_insert_locked(h, hash, newval, olddata)) == -1
-        && i < 4;
+        && i <= (int)NEIGHBORHOOD_LEN;
         ++i)
         if (!grow_hashtable(h, h->wpd.neighborhood_len)) {
             rc = -1;