diff options
author | Matt Caswell <matt@openssl.org> | 2020-09-11 13:22:40 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-09-18 13:30:44 +0100 |
commit | 726b3293399cee7b1eedcfb3a524b91537bd5118 (patch) | |
tree | 24a01e5fdc8ba3568600ff6c92dfe138798f4a42 /util/perl/OpenSSL | |
parent | ecf15b16ee8223a9a383b97ee41126fbedf89bb5 (diff) | |
download | openssl-726b3293399cee7b1eedcfb3a524b91537bd5118.tar.gz |
Provide basis for fixing lhash code
Following on from the earlier safestack work we provide the basis for
fixing the lhash code such that unused static inline functions do not
cause linker errors for applications including those headers.
This brings the lhash code into line with the safestack code.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12860)
Diffstat (limited to 'util/perl/OpenSSL')
-rw-r--r-- | util/perl/OpenSSL/stackhash.pm | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/util/perl/OpenSSL/stackhash.pm b/util/perl/OpenSSL/stackhash.pm index fd7a8cbd06..7cf9c26411 100644 --- a/util/perl/OpenSSL/stackhash.pm +++ b/util/perl/OpenSSL/stackhash.pm @@ -16,7 +16,8 @@ our @ISA = qw(Exporter); our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros generate_stack_string_macros generate_stack_const_string_macros - generate_stack_block_macros); + generate_stack_block_macros + generate_lhash_macros); sub generate_stack_macros_int { my $nametype = shift; @@ -77,4 +78,28 @@ sub generate_stack_const_string_macros { sub generate_stack_block_macros { return generate_stack_macros_int("OPENSSL_BLOCK", "void", "void"); } + +sub generate_lhash_macros { + my $type = shift; + + my $macros = <<END_MACROS; +DEFINE_LHASH_OF_INTERNAL(${type}); +#define lh_${type}_new(hfn, cmp) ((LHASH_OF(${type}) *)OPENSSL_LH_new(ossl_check_${type}_lh_hashfunc_type(hfn), ossl_check_${type}_lh_compfunc_type(cmp))) +#define lh_${type}_free(lh) OPENSSL_LH_free(ossl_check_${type}_lh_type(lh)) +#define lh_${type}_flush(lh) OPENSSL_LH_flush(ossl_check_${type}_lh_type(lh)) +#define lh_${type}_insert(lh, ptr) ((${type} *)OPENSSL_LH_insert(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_plain_type(ptr))) +#define lh_${type}_delete(lh, ptr) ((${type} *)OPENSSL_LH_delete(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr))) +#define lh_${type}_retrieve(lh, ptr) ((${type} *)OPENSSL_LH_retrieve(ossl_check_${type}_lh_type(lh), ossl_check_const_${type}_lh_plain_type(ptr))) +#define lh_${type}_error(lh) OPENSSL_LH_error(ossl_check_${type}_lh_type(lh)) +#define lh_${type}_num_items(lh) OPENSSL_LH_num_items(ossl_check_${type}_lh_type(lh)) +#define lh_${type}_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_${type}_lh_type(lh), out) +#define lh_${type}_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_${type}_lh_type(lh), out) +#define lh_${type}_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_${type}_lh_type(lh), out) +#define lh_${type}_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_${type}_lh_type(lh)) +#define lh_${type}_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_${type}_lh_type(lh), dl) +#define lh_${type}_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_doallfunc_type(dfn)) +END_MACROS + + return $macros; +} 1; |