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)
(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
/*