⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 safestack.h

📁 一个支持FTP,SFTP的客户端程序
💻 H
📖 第 1 页 / 共 5 页
字号:
/* ==================================================================== * Copyright (c) 1999 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 * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer.  * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. All advertising materials mentioning features or use of this *    software must display the following acknowledgment: *    "This product includes software developed by the OpenSSL Project *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to *    endorse or promote products derived from this software without *    prior written permission. For written permission, please contact *    openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" *    nor may "OpenSSL" appear in their names without prior written *    permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following *    acknowledgment: *    "This product includes software developed by the OpenSSL Project *    for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com).  This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */#ifndef HEADER_SAFESTACK_H#define HEADER_SAFESTACK_H#include <openssl/stack.h>typedef void (*openssl_fptr)(void);#define openssl_fcast(f) ((openssl_fptr)f)#ifdef DEBUG_SAFESTACK#define STACK_OF(type) struct stack_st_##type#define PREDECLARE_STACK_OF(type) STACK_OF(type);#define DECLARE_STACK_OF(type) \STACK_OF(type) \    { \    STACK stack; \    };#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*//* SKM_sk_... stack macros are internal to safestack.h: * never use them directly, use sk_<type>_... instead */#define SKM_sk_new(type, cmp) \	((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp)#define SKM_sk_new_null(type) \	((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))()#define SKM_sk_free(type, st) \	((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st)#define SKM_sk_num(type, st) \	((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st)#define SKM_sk_value(type, st,i) \	((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i)#define SKM_sk_set(type, st,i,val) \	((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val)#define SKM_sk_zero(type, st) \	((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st)#define SKM_sk_push(type, st,val) \	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val)#define SKM_sk_unshift(type, st,val) \	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val)#define SKM_sk_find(type, st,val) \	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val)#define SKM_sk_delete(type, st,i) \	((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i)#define SKM_sk_delete_ptr(type, st,ptr) \	((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr)#define SKM_sk_insert(type, st,val,i) \	((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i)#define SKM_sk_set_cmp_func(type, st,cmp) \	((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \	  (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\	(st, cmp)#define SKM_sk_dup(type, st) \	((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st)#define SKM_sk_pop_free(type, st,free_func) \	((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\	(st, free_func)#define SKM_sk_shift(type, st) \	((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st)#define SKM_sk_pop(type, st) \	((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st)#define SKM_sk_sort(type, st) \	((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st)#define SKM_sk_is_sorted(type, st) \	((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st)#define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \((STACK_OF(type) * (*) (STACK_OF(type) **,const unsigned char **, long , \                         type *(*)(type **, const unsigned char **,long), \                                void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \			(st,pp,length, d2i_func, free_func, ex_tag,ex_class)#define	SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \	((int (*)(STACK_OF(type) *,unsigned char **, \        int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \						(st,pp,i2d_func,ex_tag,ex_class,is_set)#define	SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \	((unsigned char *(*)(STACK_OF(type) *, \        int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \				(st, i2d_func, buf, len)#define	SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \	((STACK_OF(type) * (*)(const unsigned char *,int, \                              type *(*)(type **,const unsigned char **, long), \                              void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \					(buf,len,d2i_func, free_func)#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \	((STACK_OF(type) * (*)(X509_ALGOR *, \            		type *(*)(type **, const unsigned char **, long), \				void (*)(type *), \                                const char *, int, \                                ASN1_STRING *, int))PKCS12_decrypt_d2i) \				(algor,d2i_func,free_func,pass,passlen,oct,seq)#else#define STACK_OF(type) STACK#define PREDECLARE_STACK_OF(type) /* nada */#define DECLARE_STACK_OF(type)    /* nada */#define IMPLEMENT_STACK_OF(type)  /* nada */#define SKM_sk_new(type, cmp) \	sk_new((int (*)(const char * const *, const char * const *))(cmp))#define SKM_sk_new_null(type) \	sk_new_null()#define SKM_sk_free(type, st) \	sk_free(st)#define SKM_sk_num(type, st) \	sk_num(st)#define SKM_sk_value(type, st,i) \	((type *)sk_value(st, i))#define SKM_sk_set(type, st,i,val) \	((type *)sk_set(st, i,(char *)val))#define SKM_sk_zero(type, st) \	sk_zero(st)#define SKM_sk_push(type, st,val) \	sk_push(st, (char *)val)#define SKM_sk_unshift(type, st,val) \	sk_unshift(st, val)#define SKM_sk_find(type, st,val) \	sk_find(st, (char *)val)#define SKM_sk_delete(type, st,i) \	((type *)sk_delete(st, i))#define SKM_sk_delete_ptr(type, st,ptr) \	((type *)sk_delete_ptr(st,(char *)ptr))#define SKM_sk_insert(type, st,val,i) \	sk_insert(st, (char *)val, i)#define SKM_sk_set_cmp_func(type, st,cmp) \	((int (*)(const type * const *,const type * const *)) \	sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp)))#define SKM_sk_dup(type, st) \	sk_dup(st)#define SKM_sk_pop_free(type, st,free_func) \	sk_pop_free(st, (void (*)(void *))free_func)#define SKM_sk_shift(type, st) \	((type *)sk_shift(st))#define SKM_sk_pop(type, st) \	((type *)sk_pop(st))#define SKM_sk_sort(type, st) \	sk_sort(st)#define SKM_sk_is_sorted(type, st) \	sk_is_sorted(st)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -