diff options
Diffstat (limited to 'crypto/stack')
-rw-r--r-- | crypto/stack/safestack.h | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/crypto/stack/safestack.h b/crypto/stack/safestack.h index 5e55d15866..2d3a2e940e 100644 --- a/crypto/stack/safestack.h +++ b/crypto/stack/safestack.h @@ -1,5 +1,5 @@ /* ==================================================================== - * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +57,69 @@ #include <openssl/stack.h> +#ifdef OPENSSL_NO_FCAST + +#ifndef OPENSSL_INLINE +#define OPENSSL_INLINE static inline +#endif + +#define STACK_OF(type) struct stack_st_##type + +#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ + +#define DECLARE_STACK_OF(type) \ +STACK_OF(type) \ + { \ + STACK stack; \ + }; \ +OPENSSL_INLINE STACK_OF(type) *sk_##type##_new( \ + int (*cmp)(const type * const *, const type *const *)) \ + { return (STACK_OF(type) *)sk_new((int (*)())cmp); } \ +OPENSSL_INLINE STACK_OF(type) *sk_##type##_new_null() \ + { return (STACK_OF(type) *)sk_new_null(); } \ +OPENSSL_INLINE void sk_##type##_free(STACK_OF(type) *sk) \ + { sk_free((STACK *)sk); } \ +OPENSSL_INLINE int sk_##type##_num(const STACK_OF(type) *sk) \ + { return M_sk_num((const STACK *)sk); } \ +OPENSSL_INLINE type *sk_##type##_value(const STACK_OF(type) *sk,int n) \ + { return (type *)sk_value((STACK *)sk,n); } \ +OPENSSL_INLINE type *sk_##type##_set(STACK_OF(type) *sk,int n,type *v) \ + { return (type *)(sk_set((STACK *)sk,n,(char *)v)); } \ +OPENSSL_INLINE void sk_##type##_zero(STACK_OF(type) *sk) \ + { sk_zero((STACK *)sk); } \ +OPENSSL_INLINE int sk_##type##_push(STACK_OF(type) *sk,type *v) \ + { return sk_push((STACK *)sk,(char *)v); } \ +OPENSSL_INLINE int sk_##type##_unshift(STACK_OF(type) *sk,type *v) \ + { return sk_unshift((STACK *)sk,(char *)v); } \ +OPENSSL_INLINE int sk_##type##_find(STACK_OF(type) *sk,type *v) \ + { return sk_find((STACK *)sk,(char *)v); } \ +OPENSSL_INLINE type *sk_##type##_delete(STACK_OF(type) *sk,int n) \ + { return (type *)sk_delete((STACK *)sk,n); } \ +OPENSSL_INLINE void sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v) \ + { sk_delete_ptr((STACK *)sk,(char *)v); } \ +OPENSSL_INLINE int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n) \ + { return sk_insert((STACK *)sk,(char *)v,n); } \ +OPENSSL_INLINE int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \ + int (*cmp)(const type * const *,const type * const *))) \ + (const type *const *,const type *const *) \ + { return (int (*)(const type * const *,const type *const *)) \ + sk_set_cmp_func((STACK *)sk,(int(*)(const char * const *, const char * const *))cmp); } \ +OPENSSL_INLINE STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk) \ + { return (STACK_OF(type) *)sk_dup((STACK *)sk); } \ +OPENSSL_INLINE void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)) \ + { sk_pop_free((STACK *)sk,(void (*)(void *))func); } \ +OPENSSL_INLINE type *sk_##type##_shift(STACK_OF(type) *sk) \ + { return (type *)sk_shift((STACK *)sk); } \ +OPENSSL_INLINE type *sk_##type##_pop(STACK_OF(type) *sk) \ + { return (type *)sk_pop((STACK *)sk); } \ +OPENSSL_INLINE void sk_##type##_sort(STACK_OF(type) *sk) \ + { sk_sort((STACK *)sk); } \ +OPENSSL_INLINE int sk_##type##_is_sorted(const STACK_OF(type) *sk) \ + { return sk_is_sorted((const STACK *)sk); } + + +#else + typedef void (*openssl_fptr)(void); #define openssl_fcast(f) ((openssl_fptr)f) @@ -1918,4 +1981,6 @@ STACK_OF(type) \ SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) /* End of util/mkstack.pl block, you may now edit :-) */ +#endif + #endif /* !defined HEADER_SAFESTACK_H */ |