Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/openssl
File: safestack.h
/*
[0] Fix | Delete
* Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
[1] Fix | Delete
*
[2] Fix | Delete
* Licensed under the OpenSSL license (the "License"). You may not use
[3] Fix | Delete
* this file except in compliance with the License. You can obtain a copy
[4] Fix | Delete
* in the file LICENSE in the source distribution or at
[5] Fix | Delete
* https://www.openssl.org/source/license.html
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
#ifndef HEADER_SAFESTACK_H
[9] Fix | Delete
# define HEADER_SAFESTACK_H
[10] Fix | Delete
[11] Fix | Delete
# include <openssl/stack.h>
[12] Fix | Delete
# include <openssl/e_os2.h>
[13] Fix | Delete
[14] Fix | Delete
#ifdef __cplusplus
[15] Fix | Delete
extern "C" {
[16] Fix | Delete
#endif
[17] Fix | Delete
[18] Fix | Delete
# define STACK_OF(type) struct stack_st_##type
[19] Fix | Delete
[20] Fix | Delete
# define SKM_DEFINE_STACK_OF(t1, t2, t3) \
[21] Fix | Delete
STACK_OF(t1); \
[22] Fix | Delete
typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \
[23] Fix | Delete
typedef void (*sk_##t1##_freefunc)(t3 *a); \
[24] Fix | Delete
typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \
[25] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \
[26] Fix | Delete
{ \
[27] Fix | Delete
return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \
[28] Fix | Delete
} \
[29] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \
[30] Fix | Delete
{ \
[31] Fix | Delete
return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \
[32] Fix | Delete
} \
[33] Fix | Delete
static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \
[34] Fix | Delete
{ \
[35] Fix | Delete
return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \
[36] Fix | Delete
} \
[37] Fix | Delete
static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \
[38] Fix | Delete
{ \
[39] Fix | Delete
return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \
[40] Fix | Delete
} \
[41] Fix | Delete
static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \
[42] Fix | Delete
{ \
[43] Fix | Delete
return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \
[44] Fix | Delete
} \
[45] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \
[46] Fix | Delete
{ \
[47] Fix | Delete
return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \
[48] Fix | Delete
} \
[49] Fix | Delete
static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \
[50] Fix | Delete
{ \
[51] Fix | Delete
OPENSSL_sk_free((OPENSSL_STACK *)sk); \
[52] Fix | Delete
} \
[53] Fix | Delete
static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \
[54] Fix | Delete
{ \
[55] Fix | Delete
OPENSSL_sk_zero((OPENSSL_STACK *)sk); \
[56] Fix | Delete
} \
[57] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \
[58] Fix | Delete
{ \
[59] Fix | Delete
return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \
[60] Fix | Delete
} \
[61] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \
[62] Fix | Delete
{ \
[63] Fix | Delete
return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \
[64] Fix | Delete
(const void *)ptr); \
[65] Fix | Delete
} \
[66] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \
[67] Fix | Delete
{ \
[68] Fix | Delete
return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \
[69] Fix | Delete
} \
[70] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \
[71] Fix | Delete
{ \
[72] Fix | Delete
return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \
[73] Fix | Delete
} \
[74] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \
[75] Fix | Delete
{ \
[76] Fix | Delete
return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \
[77] Fix | Delete
} \
[78] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \
[79] Fix | Delete
{ \
[80] Fix | Delete
return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \
[81] Fix | Delete
} \
[82] Fix | Delete
static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \
[83] Fix | Delete
{ \
[84] Fix | Delete
OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \
[85] Fix | Delete
} \
[86] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \
[87] Fix | Delete
{ \
[88] Fix | Delete
return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \
[89] Fix | Delete
} \
[90] Fix | Delete
static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \
[91] Fix | Delete
{ \
[92] Fix | Delete
return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \
[93] Fix | Delete
} \
[94] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \
[95] Fix | Delete
{ \
[96] Fix | Delete
return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \
[97] Fix | Delete
} \
[98] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \
[99] Fix | Delete
{ \
[100] Fix | Delete
return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \
[101] Fix | Delete
} \
[102] Fix | Delete
static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \
[103] Fix | Delete
{ \
[104] Fix | Delete
OPENSSL_sk_sort((OPENSSL_STACK *)sk); \
[105] Fix | Delete
} \
[106] Fix | Delete
static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \
[107] Fix | Delete
{ \
[108] Fix | Delete
return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \
[109] Fix | Delete
} \
[110] Fix | Delete
static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \
[111] Fix | Delete
{ \
[112] Fix | Delete
return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \
[113] Fix | Delete
} \
[114] Fix | Delete
static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \
[115] Fix | Delete
sk_##t1##_copyfunc copyfunc, \
[116] Fix | Delete
sk_##t1##_freefunc freefunc) \
[117] Fix | Delete
{ \
[118] Fix | Delete
return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \
[119] Fix | Delete
(OPENSSL_sk_copyfunc)copyfunc, \
[120] Fix | Delete
(OPENSSL_sk_freefunc)freefunc); \
[121] Fix | Delete
} \
[122] Fix | Delete
static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \
[123] Fix | Delete
{ \
[124] Fix | Delete
return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2)
[128] Fix | Delete
# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t)
[129] Fix | Delete
# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \
[130] Fix | Delete
SKM_DEFINE_STACK_OF(t1, const t2, t2)
[131] Fix | Delete
# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t)
[132] Fix | Delete
[133] Fix | Delete
/*-
[134] Fix | Delete
* Strings are special: normally an lhash entry will point to a single
[135] Fix | Delete
* (somewhat) mutable object. In the case of strings:
[136] Fix | Delete
*
[137] Fix | Delete
* a) Instead of a single char, there is an array of chars, NUL-terminated.
[138] Fix | Delete
* b) The string may have be immutable.
[139] Fix | Delete
*
[140] Fix | Delete
* So, they need their own declarations. Especially important for
[141] Fix | Delete
* type-checking tools, such as Deputy.
[142] Fix | Delete
*
[143] Fix | Delete
* In practice, however, it appears to be hard to have a const
[144] Fix | Delete
* string. For now, I'm settling for dealing with the fact it is a
[145] Fix | Delete
* string at all.
[146] Fix | Delete
*/
[147] Fix | Delete
typedef char *OPENSSL_STRING;
[148] Fix | Delete
typedef const char *OPENSSL_CSTRING;
[149] Fix | Delete
[150] Fix | Delete
/*-
[151] Fix | Delete
* Confusingly, LHASH_OF(STRING) deals with char ** throughout, but
[152] Fix | Delete
* STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned
[153] Fix | Delete
* above, instead of a single char each entry is a NUL-terminated array of
[154] Fix | Delete
* chars. So, we have to implement STRING specially for STACK_OF. This is
[155] Fix | Delete
* dealt with in the autogenerated macros below.
[156] Fix | Delete
*/
[157] Fix | Delete
DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
[158] Fix | Delete
DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char)
[159] Fix | Delete
[160] Fix | Delete
/*
[161] Fix | Delete
* Similarly, we sometimes use a block of characters, NOT nul-terminated.
[162] Fix | Delete
* These should also be distinguished from "normal" stacks.
[163] Fix | Delete
*/
[164] Fix | Delete
typedef void *OPENSSL_BLOCK;
[165] Fix | Delete
DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
[166] Fix | Delete
[167] Fix | Delete
/*
[168] Fix | Delete
* If called without higher optimization (min. -xO3) the Oracle Developer
[169] Fix | Delete
* Studio compiler generates code for the defined (static inline) functions
[170] Fix | Delete
* above.
[171] Fix | Delete
* This would later lead to the linker complaining about missing symbols when
[172] Fix | Delete
* this header file is included but the resulting object is not linked against
[173] Fix | Delete
* the Crypto library (openssl#6912).
[174] Fix | Delete
*/
[175] Fix | Delete
# ifdef __SUNPRO_C
[176] Fix | Delete
# pragma weak OPENSSL_sk_num
[177] Fix | Delete
# pragma weak OPENSSL_sk_value
[178] Fix | Delete
# pragma weak OPENSSL_sk_new
[179] Fix | Delete
# pragma weak OPENSSL_sk_new_null
[180] Fix | Delete
# pragma weak OPENSSL_sk_new_reserve
[181] Fix | Delete
# pragma weak OPENSSL_sk_reserve
[182] Fix | Delete
# pragma weak OPENSSL_sk_free
[183] Fix | Delete
# pragma weak OPENSSL_sk_zero
[184] Fix | Delete
# pragma weak OPENSSL_sk_delete
[185] Fix | Delete
# pragma weak OPENSSL_sk_delete_ptr
[186] Fix | Delete
# pragma weak OPENSSL_sk_push
[187] Fix | Delete
# pragma weak OPENSSL_sk_unshift
[188] Fix | Delete
# pragma weak OPENSSL_sk_pop
[189] Fix | Delete
# pragma weak OPENSSL_sk_shift
[190] Fix | Delete
# pragma weak OPENSSL_sk_pop_free
[191] Fix | Delete
# pragma weak OPENSSL_sk_insert
[192] Fix | Delete
# pragma weak OPENSSL_sk_set
[193] Fix | Delete
# pragma weak OPENSSL_sk_find
[194] Fix | Delete
# pragma weak OPENSSL_sk_find_ex
[195] Fix | Delete
# pragma weak OPENSSL_sk_sort
[196] Fix | Delete
# pragma weak OPENSSL_sk_is_sorted
[197] Fix | Delete
# pragma weak OPENSSL_sk_dup
[198] Fix | Delete
# pragma weak OPENSSL_sk_deep_copy
[199] Fix | Delete
# pragma weak OPENSSL_sk_set_cmp_func
[200] Fix | Delete
# endif /* __SUNPRO_C */
[201] Fix | Delete
[202] Fix | Delete
# ifdef __cplusplus
[203] Fix | Delete
}
[204] Fix | Delete
# endif
[205] Fix | Delete
#endif
[206] Fix | Delete
[207] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function