summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/stack
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/stack')
-rw-r--r--src/lib/libcrypto/stack/safestack.h23
-rw-r--r--src/lib/libcrypto/stack/stack.c4
-rw-r--r--src/lib/libcrypto/stack/stack.h11
-rw-r--r--src/lib/libcrypto/stack/stack_local.h71
4 files changed, 79 insertions, 30 deletions
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h
index b64b865dc8..61770ef36f 100644
--- a/src/lib/libcrypto/stack/safestack.h
+++ b/src/lib/libcrypto/stack/safestack.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: safestack.h,v 1.30 2024/03/02 11:04:52 tb Exp $ */ 1/* $OpenBSD: safestack.h,v 1.31 2024/03/02 11:11:11 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -84,16 +84,8 @@
84#define STACK_OF(type) struct stack_st_##type 84#define STACK_OF(type) struct stack_st_##type
85#define PREDECLARE_STACK_OF(type) STACK_OF(type); 85#define PREDECLARE_STACK_OF(type) STACK_OF(type);
86 86
87#define DECLARE_STACK_OF(type) \ 87#define DECLARE_STACK_OF(type) STACK_OF(type);
88STACK_OF(type) \ 88#define DECLARE_SPECIAL_STACK_OF(type, type2) STACK_OF(type);
89 { \
90 _STACK stack; \
91 };
92#define DECLARE_SPECIAL_STACK_OF(type, type2) \
93STACK_OF(type) \
94 { \
95 _STACK stack; \
96 };
97 89
98#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ 90#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/
99 91
@@ -1815,7 +1807,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1815 LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg) 1807 LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)
1816#define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh) 1808#define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh)
1817#define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh) 1809#define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh)
1818#define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh)
1819#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh) 1810#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh)
1820 1811
1821#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value) 1812#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)
@@ -1827,7 +1818,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1827 LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg) 1818 LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)
1828#define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh) 1819#define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh)
1829#define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh) 1820#define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh)
1830#define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh)
1831#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh) 1821#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh)
1832 1822
1833#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state) 1823#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)
@@ -1839,7 +1829,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1839 LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg) 1829 LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)
1840#define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh) 1830#define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh)
1841#define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh) 1831#define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh)
1842#define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh)
1843#define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh) 1832#define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh)
1844 1833
1845#define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data) 1834#define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data)
@@ -1851,7 +1840,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1851 LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg) 1840 LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)
1852#define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh) 1841#define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh)
1853#define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh) 1842#define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh)
1854#define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,lh)
1855#define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh) 1843#define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh)
1856 1844
1857#define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item) 1845#define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item)
@@ -1863,7 +1851,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1863 LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg) 1851 LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg)
1864#define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh) 1852#define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh)
1865#define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh) 1853#define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh)
1866#define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh)
1867#define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh) 1854#define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh)
1868 1855
1869#define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function) 1856#define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function)
@@ -1875,7 +1862,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1875 LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg) 1862 LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)
1876#define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh) 1863#define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh)
1877#define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh) 1864#define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh)
1878#define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh)
1879#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh) 1865#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh)
1880 1866
1881#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name) 1867#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)
@@ -1887,7 +1873,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1887 LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg) 1873 LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)
1888#define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh) 1874#define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh)
1889#define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh) 1875#define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh)
1890#define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh)
1891#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh) 1876#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh)
1892 1877
1893#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string) 1878#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)
@@ -1899,7 +1884,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1899 LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg) 1884 LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)
1900#define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh) 1885#define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh)
1901#define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh) 1886#define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh)
1902#define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh)
1903#define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh) 1887#define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh)
1904 1888
1905#define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session) 1889#define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session)
@@ -1911,7 +1895,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
1911 LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg) 1895 LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)
1912#define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh) 1896#define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh)
1913#define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh) 1897#define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh)
1914#define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh)
1915#define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh) 1898#define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh)
1916 1899
1917#endif /* !defined HEADER_SAFESTACK_H */ 1900#endif /* !defined HEADER_SAFESTACK_H */
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c
index 86117f07a7..99bb52dcfa 100644
--- a/src/lib/libcrypto/stack/stack.c
+++ b/src/lib/libcrypto/stack/stack.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: stack.c,v 1.26 2024/03/02 09:47:16 tb Exp $ */ 1/* $OpenBSD: stack.c,v 1.27 2024/03/02 11:11:11 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,6 +63,8 @@
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/stack.h> 64#include <openssl/stack.h>
65 65
66#include "stack_local.h"
67
66#undef MIN_NODES 68#undef MIN_NODES
67#define MIN_NODES 4 69#define MIN_NODES 4
68 70
diff --git a/src/lib/libcrypto/stack/stack.h b/src/lib/libcrypto/stack/stack.h
index 6bea6348f2..8b490c7225 100644
--- a/src/lib/libcrypto/stack/stack.h
+++ b/src/lib/libcrypto/stack/stack.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: stack.h,v 1.9 2014/06/12 15:49:30 deraadt Exp $ */ 1/* $OpenBSD: stack.h,v 1.10 2024/03/02 11:11:11 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -63,14 +63,7 @@
63extern "C" { 63extern "C" {
64#endif 64#endif
65 65
66typedef struct stack_st { 66typedef struct stack_st _STACK;
67 int num;
68 char **data;
69 int sorted;
70
71 int num_alloc;
72 int (*comp)(const void *, const void *);
73} _STACK; /* Use STACK_OF(...) instead */
74 67
75#define M_sk_num(sk) ((sk) ? (sk)->num:-1) 68#define M_sk_num(sk) ((sk) ? (sk)->num:-1)
76#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) 69#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL)
diff --git a/src/lib/libcrypto/stack/stack_local.h b/src/lib/libcrypto/stack/stack_local.h
new file mode 100644
index 0000000000..a330707192
--- /dev/null
+++ b/src/lib/libcrypto/stack/stack_local.h
@@ -0,0 +1,71 @@
1/* $OpenBSD: stack_local.h,v 1.1 2024/03/02 11:11:11 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_STACK_LOCAL_H
60#define HEADER_STACK_LOCAL_H
61
62struct stack_st {
63 int num;
64 char **data;
65 int sorted;
66
67 int num_alloc;
68 int (*comp)(const void *, const void *);
69} /* _STACK */;
70
71#endif