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

📄 safestack.h

📁 OpenSSL 0.9.8k 最新版OpenSSL
💻 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>#ifdef DEBUG_SAFESTACK#ifndef CHECKED_PTR_OF#define CHECKED_PTR_OF(type, p) \    ((void*) (1 ? p : (type*)0))#endif#define CHECKED_SK_FREE_FUNC(type, p) \    ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))#define CHECKED_SK_CMP_FUNC(type, p) \    ((int (*)(const char * const *, const char * const *)) \	((1 ? p : (int (*)(const type * const *, const type * const *))0)))#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) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp)))#define SKM_sk_new_null(type) \	((STACK_OF(type) *)sk_new_null())#define SKM_sk_free(type, st) \	sk_free(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_num(type, st) \	sk_num(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_value(type, st,i) \	((type *)sk_value(CHECKED_PTR_OF(STACK_OF(type), st), i))#define SKM_sk_set(type, st,i,val) \	sk_set(CHECKED_PTR_OF(STACK_OF(type), st), i, CHECKED_PTR_OF(type, val))#define SKM_sk_zero(type, st) \	sk_zero(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_push(type, st,val) \	sk_push(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))#define SKM_sk_unshift(type, st,val) \	sk_unshift(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))#define SKM_sk_find(type, st,val) \	sk_find(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))#define SKM_sk_delete(type, st,i) \	(type *)sk_delete(CHECKED_PTR_OF(STACK_OF(type), st), i)#define SKM_sk_delete_ptr(type, st,ptr) \	(type *)sk_delete_ptr(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, ptr))#define SKM_sk_insert(type, st,val,i) \	sk_insert(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val), i)#define SKM_sk_set_cmp_func(type, st,cmp) \	((int (*)(const type * const *,const type * const *)) \	sk_set_cmp_func(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_CMP_FUNC(type, cmp)))#define SKM_sk_dup(type, st) \	(STACK_OF(type) *)sk_dup(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_pop_free(type, st,free_func) \	sk_pop_free(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_FREE_FUNC(type, free_func))#define SKM_sk_shift(type, st) \	(type *)sk_shift(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_pop(type, st) \	(type *)sk_pop(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_sort(type, st) \	sk_sort(CHECKED_PTR_OF(STACK_OF(type), st))#define SKM_sk_is_sorted(type, st) \	sk_is_sorted(CHECKED_PTR_OF(STACK_OF(type), st))#define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \	(STACK_OF(type) *)d2i_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), \				pp, length, \				CHECKED_D2I_OF(type, d2i_func), \				CHECKED_SK_FREE_FUNC(type, free_func), \				ex_tag, ex_class)#define	SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \	i2d_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), pp, \				CHECKED_I2D_OF(type, i2d_func), \				ex_tag, ex_class, is_set)#define	SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \	ASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \			CHECKED_I2D_OF(type, i2d_func), buf, len)#define	SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \	(STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func))#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \	(STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \				CHECKED_D2I_OF(type, d2i_func), \				CHECKED_SK_FREE_FUNC(type, 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, (char *)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))

⌨️ 快捷键说明

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