diff options
author | Matt Caswell <matt@openssl.org> | 2020-09-03 18:35:41 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-09-13 12:11:56 +0200 |
commit | c6029deab2dba334874b17a9969b6c5fbbb7f96c (patch) | |
tree | 4ecf26ee33b6989cc4da98263a9d93b6dd39b1db /util/perl | |
parent | Add a CHANGES entry for the safestack updates (diff) | |
download | openssl-c6029deab2dba334874b17a9969b6c5fbbb7f96c.tar.xz openssl-c6029deab2dba334874b17a9969b6c5fbbb7f96c.zip |
Streamline the safestack generated code
The safestack code generation was generating a little too much. Some of
it could be done with a normal macro.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12781)
Diffstat (limited to 'util/perl')
-rw-r--r-- | util/perl/OpenSSL/stackhash.pm | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/util/perl/OpenSSL/stackhash.pm b/util/perl/OpenSSL/stackhash.pm index 21d852eae0..fd7a8cbd06 100644 --- a/util/perl/OpenSSL/stackhash.pm +++ b/util/perl/OpenSSL/stackhash.pm @@ -24,34 +24,7 @@ sub generate_stack_macros_int { my $plaintype = shift; my $macros = <<END_MACROS; -STACK_OF(${nametype}); -typedef int (*sk_${nametype}_compfunc)(const ${plaintype} * const *a, const ${plaintype} *const *b); -typedef void (*sk_${nametype}_freefunc)(${plaintype} *a); -typedef ${plaintype} * (*sk_${nametype}_copyfunc)(const ${plaintype} *a); -static ossl_unused ossl_inline ${realtype} *ossl_check_${nametype}_type(${realtype} *ptr) -{ - return ptr; -} -static ossl_unused ossl_inline const OPENSSL_STACK *ossl_check_const_${nametype}_sk_type(const STACK_OF(${nametype}) *sk) -{ - return (const OPENSSL_STACK *)sk; -} -static ossl_unused ossl_inline OPENSSL_STACK *ossl_check_${nametype}_sk_type(STACK_OF(${nametype}) *sk) -{ - return (OPENSSL_STACK *)sk; -} -static ossl_unused ossl_inline OPENSSL_sk_compfunc ossl_check_${nametype}_compfunc_type(sk_${nametype}_compfunc cmp) -{ - return (OPENSSL_sk_compfunc)cmp; -} -static ossl_unused ossl_inline OPENSSL_sk_copyfunc ossl_check_${nametype}_copyfunc_type(sk_${nametype}_copyfunc cpy) -{ - return (OPENSSL_sk_copyfunc)cpy; -} -static ossl_unused ossl_inline OPENSSL_sk_freefunc ossl_check_${nametype}_freefunc_type(sk_${nametype}_freefunc fr) -{ - return (OPENSSL_sk_freefunc)fr; -} +SKM_DEFINE_STACK_OF_INTERNAL(${nametype}, ${realtype}, ${plaintype}) #define sk_${nametype}_num(sk) OPENSSL_sk_num(ossl_check_const_${nametype}_sk_type(sk)) #define sk_${nametype}_value(sk, idx) ((${realtype} *)OPENSSL_sk_value(ossl_check_const_${nametype}_sk_type(sk), (idx))) #define sk_${nametype}_new(cmp) ((STACK_OF(${nametype}) *)OPENSSL_sk_new(ossl_check_${nametype}_compfunc_type(cmp))) |