summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/stack/safestack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/stack/safestack.h')
-rw-r--r--src/lib/libcrypto/stack/safestack.h53
1 files changed, 25 insertions, 28 deletions
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h
index 6010b7f122..bd1121c279 100644
--- a/src/lib/libcrypto/stack/safestack.h
+++ b/src/lib/libcrypto/stack/safestack.h
@@ -55,9 +55,6 @@
55#ifndef HEADER_SAFESTACK_H 55#ifndef HEADER_SAFESTACK_H
56#define HEADER_SAFESTACK_H 56#define HEADER_SAFESTACK_H
57 57
58typedef void (*openssl_fptr)(void);
59#define openssl_fcast(f) ((openssl_fptr)f)
60
61#include <openssl/stack.h> 58#include <openssl/stack.h>
62 59
63#ifdef DEBUG_SAFESTACK 60#ifdef DEBUG_SAFESTACK
@@ -76,74 +73,74 @@ STACK_OF(type) \
76/* SKM_sk_... stack macros are internal to safestack.h: 73/* SKM_sk_... stack macros are internal to safestack.h:
77 * never use them directly, use sk_<type>_... instead */ 74 * never use them directly, use sk_<type>_... instead */
78#define SKM_sk_new(type, cmp) \ 75#define SKM_sk_new(type, cmp) \
79 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp) 76 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))sk_new)(cmp)
80#define SKM_sk_new_null(type) \ 77#define SKM_sk_new_null(type) \
81 ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))() 78 ((STACK_OF(type) * (*)(void))sk_new_null)()
82#define SKM_sk_free(type, st) \ 79#define SKM_sk_free(type, st) \
83 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st) 80 ((void (*)(STACK_OF(type) *))sk_free)(st)
84#define SKM_sk_num(type, st) \ 81#define SKM_sk_num(type, st) \
85 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st) 82 ((int (*)(const STACK_OF(type) *))sk_num)(st)
86#define SKM_sk_value(type, st,i) \ 83#define SKM_sk_value(type, st,i) \
87 ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i) 84 ((type * (*)(const STACK_OF(type) *, int))sk_value)(st, i)
88#define SKM_sk_set(type, st,i,val) \ 85#define SKM_sk_set(type, st,i,val) \
89 ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val) 86 ((type * (*)(STACK_OF(type) *, int, type *))sk_set)(st, i, val)
90#define SKM_sk_zero(type, st) \ 87#define SKM_sk_zero(type, st) \
91 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st) 88 ((void (*)(STACK_OF(type) *))sk_zero)(st)
92#define SKM_sk_push(type, st,val) \ 89#define SKM_sk_push(type, st,val) \
93 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val) 90 ((int (*)(STACK_OF(type) *, type *))sk_push)(st, val)
94#define SKM_sk_unshift(type, st,val) \ 91#define SKM_sk_unshift(type, st,val) \
95 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val) 92 ((int (*)(STACK_OF(type) *, type *))sk_unshift)(st, val)
96#define SKM_sk_find(type, st,val) \ 93#define SKM_sk_find(type, st,val) \
97 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val) 94 ((int (*)(STACK_OF(type) *, type *))sk_find)(st, val)
98#define SKM_sk_delete(type, st,i) \ 95#define SKM_sk_delete(type, st,i) \
99 ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i) 96 ((type * (*)(STACK_OF(type) *, int))sk_delete)(st, i)
100#define SKM_sk_delete_ptr(type, st,ptr) \ 97#define SKM_sk_delete_ptr(type, st,ptr) \
101 ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr) 98 ((type * (*)(STACK_OF(type) *, type *))sk_delete_ptr)(st, ptr)
102#define SKM_sk_insert(type, st,val,i) \ 99#define SKM_sk_insert(type, st,val,i) \
103 ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i) 100 ((int (*)(STACK_OF(type) *, type *, int))sk_insert)(st, val, i)
104#define SKM_sk_set_cmp_func(type, st,cmp) \ 101#define SKM_sk_set_cmp_func(type, st,cmp) \
105 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \ 102 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
106 (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\ 103 (const type * const *, const type * const *))sk_set_cmp_func)\
107 (st, cmp) 104 (st, cmp)
108#define SKM_sk_dup(type, st) \ 105#define SKM_sk_dup(type, st) \
109 ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st) 106 ((STACK_OF(type) *(*)(STACK_OF(type) *))sk_dup)(st)
110#define SKM_sk_pop_free(type, st,free_func) \ 107#define SKM_sk_pop_free(type, st,free_func) \
111 ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\ 108 ((void (*)(STACK_OF(type) *, void (*)(type *)))sk_pop_free)\
112 (st, free_func) 109 (st, free_func)
113#define SKM_sk_shift(type, st) \ 110#define SKM_sk_shift(type, st) \
114 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st) 111 ((type * (*)(STACK_OF(type) *))sk_shift)(st)
115#define SKM_sk_pop(type, st) \ 112#define SKM_sk_pop(type, st) \
116 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st) 113 ((type * (*)(STACK_OF(type) *))sk_pop)(st)
117#define SKM_sk_sort(type, st) \ 114#define SKM_sk_sort(type, st) \
118 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st) 115 ((void (*)(STACK_OF(type) *))sk_sort)(st)
119#define SKM_sk_is_sorted(type, st) \ 116#define SKM_sk_is_sorted(type, st) \
120 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st) 117 ((int (*)(const STACK_OF(type) *))sk_is_sorted)(st)
121 118
122#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ 119#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
123 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ 120 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \
124 type *(*)(type **, unsigned char **,long), \ 121 type *(*)(type **, unsigned char **,long), \
125 void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \ 122 void (*)(type *), int ,int )) d2i_ASN1_SET) \
126 (st,pp,length, d2i_func, free_func, ex_tag,ex_class) 123 (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
127#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ 124#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
128 ((int (*)(STACK_OF(type) *,unsigned char **, \ 125 ((int (*)(STACK_OF(type) *,unsigned char **, \
129 int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \ 126 int (*)(type *,unsigned char **), int , int , int)) i2d_ASN1_SET) \
130 (st,pp,i2d_func,ex_tag,ex_class,is_set) 127 (st,pp,i2d_func,ex_tag,ex_class,is_set)
131 128
132#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ 129#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
133 ((unsigned char *(*)(STACK_OF(type) *, \ 130 ((unsigned char *(*)(STACK_OF(type) *, \
134 int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \ 131 int (*)(type *,unsigned char **), unsigned char **,int *)) ASN1_seq_pack) \
135 (st, i2d_func, buf, len) 132 (st, i2d_func, buf, len)
136#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ 133#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
137 ((STACK_OF(type) * (*)(unsigned char *,int, \ 134 ((STACK_OF(type) * (*)(unsigned char *,int, \
138 type *(*)(type **,unsigned char **, long), \ 135 type *(*)(type **,unsigned char **, long), \
139 void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \ 136 void (*)(type *)))ASN1_seq_unpack) \
140 (buf,len,d2i_func, free_func) 137 (buf,len,d2i_func, free_func)
141 138
142#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ 139#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
143 ((STACK_OF(type) * (*)(X509_ALGOR *, \ 140 ((STACK_OF(type) * (*)(X509_ALGOR *, \
144 type *(*)(type **, unsigned char **, long), void (*)(type *), \ 141 type *(*)(type **, unsigned char **, long), void (*)(type *), \
145 const char *, int, \ 142 const char *, int, \
146 ASN1_STRING *, int))openssl_fcast(PKCS12_decrypt_d2i)) \ 143 ASN1_STRING *, int))PKCS12_decrypt_d2i) \
147 (algor,d2i_func,free_func,pass,passlen,oct,seq) 144 (algor,d2i_func,free_func,pass,passlen,oct,seq)
148 145
149#else 146#else