summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/Symbols.namespace
diff options
context:
space:
mode:
authortb <>2024-02-23 10:39:07 +0000
committertb <>2024-02-23 10:39:07 +0000
commit501fb5e3889fa53d51e5261dede7b653c754d22a (patch)
tree757f8cb1cb0fbfb3f9f6c1a21099d615a566c7fd /src/lib/libcrypto/Symbols.namespace
parent2f9cfbbab0541be2daffe9ee996acdac0d1846a2 (diff)
downloadopenbsd-501fb5e3889fa53d51e5261dede7b653c754d22a.tar.gz
openbsd-501fb5e3889fa53d51e5261dede7b653c754d22a.tar.bz2
openbsd-501fb5e3889fa53d51e5261dede7b653c754d22a.zip
Prepare to provide X509_STORE_get1_objects()
The OpenSSL 1.1 API X509_STORE_get0_objects() is not thread safe. It exposes a naked internal pointer containing certificates, CRLs and cached objects added by X509_LOOKUP_hash_dir(). Thus, if the store is shared between threads, it is not possible to inspect this pointer safely since another thread could concurrently add to it. This may happen in particular during certificate verification. This API led to security issues in rust-openssl and is also problematic in current Python. Other consumers of X509_STORE_get0_objects() are haproxy, isync, openvpn. The solution is to take a snapshot of the state under a lock and return that. This is what X509_STORE_get1_objects() does. It returns a newly allocated stack that needs to be freed with sk_X509_OBJECT_pop_free(), passing X509_OBJECT_free as a second argument. Based on a diff by David Benjamin for BoringSSL. https://boringssl-review.googlesource.com/c/boringssl/+/65787 ok beck jsing PS: Variants of this have landed in Python and OpenSSL 3 as well. There the sk_*deep_copy() API is used, which in OpenSSL relies on evaluating function pointers after casts (BoringSSL fixed that). Instead of using this macro insanity and exposing that garbage in public, we can do this by implementing a pedestrian, static sk_X509_OBJECT_deep_copy() by hand.
Diffstat (limited to 'src/lib/libcrypto/Symbols.namespace')
-rw-r--r--src/lib/libcrypto/Symbols.namespace1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace
index 62d6b5a3ad..bcd5b84ba6 100644
--- a/src/lib/libcrypto/Symbols.namespace
+++ b/src/lib/libcrypto/Symbols.namespace
@@ -525,6 +525,7 @@ _libre_X509_STORE_new
525_libre_X509_STORE_free 525_libre_X509_STORE_free
526_libre_X509_STORE_up_ref 526_libre_X509_STORE_up_ref
527_libre_X509_STORE_get0_objects 527_libre_X509_STORE_get0_objects
528_libre_X509_STORE_get1_objects
528_libre_X509_STORE_get_ex_data 529_libre_X509_STORE_get_ex_data
529_libre_X509_STORE_set_ex_data 530_libre_X509_STORE_set_ex_data
530_libre_X509_STORE_set_flags 531_libre_X509_STORE_set_flags