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