Commit 37eb7691ac for openssl.org
commit 37eb7691acf72f052c92172363dbcc39a960df84
Author: Neil Horman <nhorman@openssl.org>
Date: Tue Mar 3 09:45:19 2026 -0500
Add extern key buffer setup for hash table
One thing @npajkovsky noted in our recent discussion about the internal
hash table was that its unfortunate that keys have to be sized for the
maximal use case in our current hashtable code.
We can avoid that.
Introduce a new init mechanism that allows for keys to initalized using
an external buffer that can be setup and marshalled independently of the
key itself. This allows us to only allocate the amount of data needed
for the key, rather than a maximally sized buffer where appropriate and
adventageous.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
MergeDate: Tue Mar 24 16:23:07 2026
(Merged from https://github.com/openssl/openssl/pull/30254)
diff --git a/include/internal/hashtable.h b/include/internal/hashtable.h
index 320408bba4..b4d1f283f8 100644
--- a/include/internal/hashtable.h
+++ b/include/internal/hashtable.h
@@ -176,6 +176,13 @@ static ossl_inline ossl_unused int ossl_key_raw_copy(HT_KEY *key, const uint8_t
(key)->key_header.cached_hash = hash; \
} while (0)
+#define HT_INIT_KEY_EXTERNAL(key, buf, len) \
+ do { \
+ HT_INIT_KEY((key)); \
+ (key)->key_header.keybuf = (buf); \
+ (key)->key_header.keysize = (len); \
+ } while (0)
+
#define HT_KEY_GET_HASH(key) (key)->key_header.cached_hash
/*