diff --git a/crypto/conf/internal.h b/crypto/conf/internal.h index 04359ad25a..23496d9f64 100644 --- a/crypto/conf/internal.h +++ b/crypto/conf/internal.h @@ -26,10 +26,6 @@ extern "C" { DEFINE_LHASH_OF(CONF_VALUE) -struct conf_st { - LHASH_OF(CONF_VALUE) *data; -}; - // CONF_VALUE_new returns a freshly allocated and zeroed |CONF_VALUE|. CONF_VALUE *CONF_VALUE_new(void); diff --git a/crypto/lhash/internal.h b/crypto/lhash/internal.h index 512f06df44..d9b0bc9a46 100644 --- a/crypto/lhash/internal.h +++ b/crypto/lhash/internal.h @@ -105,7 +105,6 @@ typedef int (*lhash_cmp_func_helper)(lhash_cmp_func func, const void *a, typedef uint32_t (*lhash_hash_func)(const void *a); typedef uint32_t (*lhash_hash_func_helper)(lhash_hash_func func, const void *a); -typedef struct lhash_st _LHASH; // OPENSSL_lh_new returns a new, empty hash table or NULL on error. OPENSSL_EXPORT _LHASH *OPENSSL_lh_new(lhash_hash_func hash, diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index 86f1cea1dd..22d04f319a 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -347,3 +347,7 @@ void OPENSSL_lh_doall_arg(_LHASH *lh, void (*func)(void *, void *), void *arg) { // resizing is done here. lh_maybe_resize(lh); } + +void lh_doall_arg(_LHASH *lh, void (*func)(void *, void *), void *arg) { + OPENSSL_lh_doall_arg(lh, func, arg); +} diff --git a/include/openssl/conf.h b/include/openssl/conf.h index cd6c615703..b600bd5869 100644 --- a/include/openssl/conf.h +++ b/include/openssl/conf.h @@ -94,6 +94,9 @@ struct conf_value_st { DEFINE_STACK_OF(CONF_VALUE) DECLARE_LHASH_OF(CONF_VALUE) +struct conf_st { + LHASH_OF(CONF_VALUE) *data; +}; // NCONF_new returns a fresh, empty |CONF|, or NULL on error. The |method| // argument must be NULL. diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h index 129754161f..9ff22baa17 100644 --- a/include/openssl/lhash.h +++ b/include/openssl/lhash.h @@ -63,6 +63,7 @@ extern "C" { #endif +typedef struct lhash_st _LHASH; // lhash is an internal library and not exported for use outside BoringSSL. This // header is provided for compatibility with code that expects OpenSSL. @@ -73,6 +74,18 @@ extern "C" { #define LHASH_OF(type) struct lhash_st_##type #define DECLARE_LHASH_OF(type) LHASH_OF(type); +OPENSSL_EXPORT void lh_doall_arg(_LHASH *lh, void (*func)(void *, void *), + void *arg); + +// These two macros are the bare minimum of |LHASH| macros downstream consumers +// use. +#define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type *a = arg1; \ + a_type *b = arg2; \ + name##_doall_arg(a, b); } +#define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + #if defined(__cplusplus) } // extern C