summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
authortb <>2024-03-02 11:37:13 +0000
committertb <>2024-03-02 11:37:13 +0000
commit0340c5dc4c22ea26987e0f29706413898d25e394 (patch)
tree22ca385e8261665022d07254b0ff103cb0c2f6f4 /src/lib/libcrypto
parent0e0cb92067894b44c4616c0ca3622a555adf404c (diff)
downloadopenbsd-0340c5dc4c22ea26987e0f29706413898d25e394.tar.gz
openbsd-0340c5dc4c22ea26987e0f29706413898d25e394.tar.bz2
openbsd-0340c5dc4c22ea26987e0f29706413898d25e394.zip
Make CRYPTO_THREADID opaque
With ERR_STATE out of the way, we can make CRYPTO_THREADID opaque. The type is still accessed by used public API, but some of the public API can also go away. ok jsing
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/Symbols.list4
-rw-r--r--src/lib/libcrypto/Symbols.namespace4
-rw-r--r--src/lib/libcrypto/cryptlib.c4
-rw-r--r--src/lib/libcrypto/crypto.h11
-rw-r--r--src/lib/libcrypto/crypto_local.h138
-rw-r--r--src/lib/libcrypto/err/err.c4
-rw-r--r--src/lib/libcrypto/err/err_prn.c3
-rw-r--r--src/lib/libcrypto/hidden/openssl/crypto.h6
8 files changed, 149 insertions, 25 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index f9ef997e30..846bd5ce83 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -623,11 +623,7 @@ CONF_set_nconf
623CRL_DIST_POINTS_free 623CRL_DIST_POINTS_free
624CRL_DIST_POINTS_it 624CRL_DIST_POINTS_it
625CRL_DIST_POINTS_new 625CRL_DIST_POINTS_new
626CRYPTO_THREADID_cmp
627CRYPTO_THREADID_cpy
628CRYPTO_THREADID_current
629CRYPTO_THREADID_get_callback 626CRYPTO_THREADID_get_callback
630CRYPTO_THREADID_hash
631CRYPTO_THREADID_set_callback 627CRYPTO_THREADID_set_callback
632CRYPTO_THREADID_set_numeric 628CRYPTO_THREADID_set_numeric
633CRYPTO_THREADID_set_pointer 629CRYPTO_THREADID_set_pointer
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace
index 489c618ec5..95b2a33720 100644
--- a/src/lib/libcrypto/Symbols.namespace
+++ b/src/lib/libcrypto/Symbols.namespace
@@ -1855,10 +1855,6 @@ _libre_CRYPTO_get_ex_data
1855_libre_CRYPTO_cleanup_all_ex_data 1855_libre_CRYPTO_cleanup_all_ex_data
1856_libre_CRYPTO_lock 1856_libre_CRYPTO_lock
1857_libre_CRYPTO_add_lock 1857_libre_CRYPTO_add_lock
1858_libre_CRYPTO_THREADID_current
1859_libre_CRYPTO_THREADID_cmp
1860_libre_CRYPTO_THREADID_cpy
1861_libre_CRYPTO_THREADID_hash
1862_libre_CRYPTO_set_mem_functions 1858_libre_CRYPTO_set_mem_functions
1863_libre_CRYPTO_set_locked_mem_functions 1859_libre_CRYPTO_set_locked_mem_functions
1864_libre_CRYPTO_set_mem_ex_functions 1860_libre_CRYPTO_set_mem_ex_functions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index 28b50c2c17..abf1159400 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptlib.c,v 1.47 2023/12/14 15:31:22 tb Exp $ */ 1/* $OpenBSD: cryptlib.c,v 1.48 2024/03/02 11:37:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -124,6 +124,8 @@
124#include <openssl/opensslconf.h> 124#include <openssl/opensslconf.h>
125#include <openssl/crypto.h> 125#include <openssl/crypto.h>
126 126
127#include "crypto_local.h"
128
127static void (*locking_callback)(int mode, int type, 129static void (*locking_callback)(int mode, int type,
128 const char *file, int line) = NULL; 130 const char *file, int line) = NULL;
129static int (*add_lock_callback)(int *pointer, int amount, 131static int (*add_lock_callback)(int *pointer, int amount,
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 382d40a350..01359c4297 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.68 2024/03/02 11:35:09 tb Exp $ */ 1/* $OpenBSD: crypto.h,v 1.69 2024/03/02 11:37:13 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -313,14 +313,7 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
313 int line); 313 int line);
314 314
315/* Don't use this structure directly. */ 315/* Don't use this structure directly. */
316typedef struct crypto_threadid_st { 316typedef struct crypto_threadid_st CRYPTO_THREADID;
317 void *ptr;
318 unsigned long val;
319} CRYPTO_THREADID;
320void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
321int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
322void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
323unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
324 317
325#ifndef LIBRESSL_INTERNAL 318#ifndef LIBRESSL_INTERNAL
326/* These functions are deprecated no-op stubs */ 319/* These functions are deprecated no-op stubs */
diff --git a/src/lib/libcrypto/crypto_local.h b/src/lib/libcrypto/crypto_local.h
new file mode 100644
index 0000000000..970a784660
--- /dev/null
+++ b/src/lib/libcrypto/crypto_local.h
@@ -0,0 +1,138 @@
1/* $OpenBSD: crypto_local.h,v 1.1 2024/03/02 11:37:13 tb Exp $ */
2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
56 * All rights reserved.
57 *
58 * This package is an SSL implementation written
59 * by Eric Young (eay@cryptsoft.com).
60 * The implementation was written so as to conform with Netscapes SSL.
61 *
62 * This library is free for commercial and non-commercial use as long as
63 * the following conditions are aheared to. The following conditions
64 * apply to all code found in this distribution, be it the RC4, RSA,
65 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
66 * included with this distribution is covered by the same copyright terms
67 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
68 *
69 * Copyright remains Eric Young's, and as such any Copyright notices in
70 * the code are not to be removed.
71 * If this package is used in a product, Eric Young should be given attribution
72 * as the author of the parts of the library used.
73 * This can be in the form of a textual message at program startup or
74 * in documentation (online or textual) provided with the package.
75 *
76 * Redistribution and use in source and binary forms, with or without
77 * modification, are permitted provided that the following conditions
78 * are met:
79 * 1. Redistributions of source code must retain the copyright
80 * notice, this list of conditions and the following disclaimer.
81 * 2. Redistributions in binary form must reproduce the above copyright
82 * notice, this list of conditions and the following disclaimer in the
83 * documentation and/or other materials provided with the distribution.
84 * 3. All advertising materials mentioning features or use of this software
85 * must display the following acknowledgement:
86 * "This product includes cryptographic software written by
87 * Eric Young (eay@cryptsoft.com)"
88 * The word 'cryptographic' can be left out if the rouines from the library
89 * being used are not cryptographic related :-).
90 * 4. If you include any Windows specific code (or a derivative thereof) from
91 * the apps directory (application code) you must include an acknowledgement:
92 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
93 *
94 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
95 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
96 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
97 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
98 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
99 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
100 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
101 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
103 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104 * SUCH DAMAGE.
105 *
106 * The licence and distribution terms for any publically available version or
107 * derivative of this code cannot be changed. i.e. this code cannot simply be
108 * copied and put under another distribution licence
109 * [including the GNU Public Licence.]
110 */
111/* ====================================================================
112 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
113 * ECDH support in OpenSSL originally developed by
114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115 */
116
117#include <stdint.h>
118#include <stdio.h>
119#include <stdlib.h>
120
121#ifndef HEADER_CRYPTO_LOCAL_H
122#define HEADER_CRYPTO_LOCAL_H
123
124__BEGIN_HIDDEN_DECLS
125
126struct crypto_threadid_st {
127 void *ptr;
128 unsigned long val;
129} /* CRYPTO_THREADID */;
130
131void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
132int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
133void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
134unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
135
136__END_HIDDEN_DECLS
137
138#endif
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index acbcda76cc..a7b13a5404 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.59 2024/03/02 10:30:48 tb Exp $ */ 1/* $OpenBSD: err.c,v 1.60 2024/03/02 11:37:13 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 *
@@ -122,6 +122,8 @@
122#include <openssl/err.h> 122#include <openssl/err.h>
123#include <openssl/lhash.h> 123#include <openssl/lhash.h>
124 124
125#include "crypto_local.h"
126
125DECLARE_LHASH_OF(ERR_STRING_DATA); 127DECLARE_LHASH_OF(ERR_STRING_DATA);
126DECLARE_LHASH_OF(ERR_STATE); 128DECLARE_LHASH_OF(ERR_STATE);
127 129
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c
index 61f4dad574..fb6e19c54c 100644
--- a/src/lib/libcrypto/err/err_prn.c
+++ b/src/lib/libcrypto/err/err_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err_prn.c,v 1.22 2024/01/10 14:23:37 tb Exp $ */ 1/* $OpenBSD: err_prn.c,v 1.23 2024/03/02 11:37:13 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 *
@@ -66,6 +66,7 @@
66#include <openssl/lhash.h> 66#include <openssl/lhash.h>
67 67
68#include "bio_local.h" 68#include "bio_local.h"
69#include "crypto_local.h"
69 70
70void 71void
71ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u) 72ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u)
diff --git a/src/lib/libcrypto/hidden/openssl/crypto.h b/src/lib/libcrypto/hidden/openssl/crypto.h
index 3e8f3dc7a8..10daf41f57 100644
--- a/src/lib/libcrypto/hidden/openssl/crypto.h
+++ b/src/lib/libcrypto/hidden/openssl/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.5 2024/03/02 11:32:31 tb Exp $ */ 1/* $OpenBSD: crypto.h,v 1.6 2024/03/02 11:37:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -38,10 +38,6 @@ LCRYPTO_USED(CRYPTO_get_ex_data);
38LCRYPTO_USED(CRYPTO_cleanup_all_ex_data); 38LCRYPTO_USED(CRYPTO_cleanup_all_ex_data);
39LCRYPTO_USED(CRYPTO_lock); 39LCRYPTO_USED(CRYPTO_lock);
40LCRYPTO_USED(CRYPTO_add_lock); 40LCRYPTO_USED(CRYPTO_add_lock);
41LCRYPTO_USED(CRYPTO_THREADID_current);
42LCRYPTO_USED(CRYPTO_THREADID_cmp);
43LCRYPTO_USED(CRYPTO_THREADID_cpy);
44LCRYPTO_USED(CRYPTO_THREADID_hash);
45LCRYPTO_USED(CRYPTO_set_mem_functions); 41LCRYPTO_USED(CRYPTO_set_mem_functions);
46LCRYPTO_USED(CRYPTO_set_mem_ex_functions); 42LCRYPTO_USED(CRYPTO_set_mem_ex_functions);
47LCRYPTO_USED(OpenSSLDie); 43LCRYPTO_USED(OpenSSLDie);