openssl/util
David Benjamin 08cecb4448 Add X509_STORE_get1_objects
X509_STORE_get0_objects returns a pointer to the X509_STORE's storage,
but this function is a bit deceptive. It is practically unusable in a
multi-threaded program. See, for example, RUSTSEC-2023-0072, a security
vulnerability caused by this OpenSSL API.

One might think that, if no other threads are mutating the X509_STORE,
it is safe to read the resulting list. However, the documention does not
mention that other logically-const operations on the X509_STORE, notably
certifcate verifications when a hash_dir is installed, will, under a
lock, write to the X509_STORE. The X509_STORE also internally re-sorts
the list on the first query.

If the caller knows to call X509_STORE_lock and X509_STORE_unlock, it
can work around this. But this is not obvious, and the documentation
does not discuss how X509_STORE_lock is very rarely safe to use. E.g.
one cannot call any APIs like X509_STORE_add_cert or
X509_STORE_CTX_get1_issuer while holding the lock because those
functions internally expect to take the lock. (X509_STORE_lock is
another such API which is not safe to export as public API.)

Rather than leave all this to the caller to figure out, the API should
have returned a shallow copy of the list, refcounting the values. Then
it could be internally locked and the caller can freely inspect the
result without synchronization with the X509_STORE.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23224)
2024-01-15 16:29:54 +01:00
..
perl Augment RSA provider to generate CRT coefficients on EVP_PKEY_fromdata() 2024-01-09 12:03:32 +01:00
platform_symbols Create a rudimentary symbol scanning script 2023-11-01 16:32:26 +01:00
add-depends.pl Update copyright year 2022-05-03 13:34:51 +01:00
build.info Disable building quicserver utility when configured with no-apps option 2023-12-29 10:16:46 +01:00
c-compress-test.pl FIPS module checksums: add scripts and Makefile rule 2021-05-04 11:32:16 +02:00
cavs-to-evptest.pl
check-format-test-negatives.c check-format.pl: improve whitespace reporting on <op>= 2022-09-02 21:32:46 +02:00
check-format-test-positives.c check-format.pl: improve whitespace reporting on <op>= 2022-09-02 21:32:46 +02:00
check-format.pl Copyright year updates 2023-09-07 09:59:15 +01:00
check-malloc-errs
checkplatformsyms.pl Create a rudimentary symbol scanning script 2023-11-01 16:32:26 +01:00
ck_errf.pl
copy.pl
ctags.sh Fix new typos found by codespell 2023-06-18 16:53:09 +10:00
dofile.pl configdata.pm.in, util/dofile.pl: Make a HERE document stricter. 2020-10-27 10:17:19 +01:00
echo.pl always use the same perl in $PATH 2021-09-02 12:55:39 +10:00
engines.num
err-to-raise Simplify util/err-to-raise 2020-11-18 11:40:52 +01:00
find-doc-nits Copyright year updates 2023-09-07 09:59:15 +01:00
find-unused-errs
fips-checksums.sh always use the same perl in $PATH 2021-09-02 12:55:39 +10:00
fix-deprecation always use the same perl in $PATH 2021-09-02 12:55:39 +10:00
fix-includes Update copyright year 2020-04-23 13:55:52 +01:00
fix-includes.sed CRYPTO: split cipher_platform.h into algorithm specific headers 2019-12-19 13:31:29 +01:00
help.pl Add "make help" option 2023-03-06 08:00:58 +11:00
indent.pro Removed unused struct ssl3_comp_st 2023-08-29 16:59:54 +02:00
lang-compress.pl util: update FIPS checksumming script to be more aggressive with whitespace 2021-06-03 11:56:21 +10:00
libcrypto.num Add X509_STORE_get1_objects 2024-01-15 16:29:54 +01:00
libssl.num Fix CI breakage due to ABIDIFF failure 2023-11-10 16:38:39 +01:00
markdownlint.rb Adjust mdl configuration 2023-10-24 17:34:07 +01:00
merge-err-lines Add merge-err-lines script 2019-09-19 09:27:38 -04:00
missingcrypto111.txt DOC: Add a few previously documented functions 2021-11-23 19:34:19 +01:00
missingcrypto-internal.txt STORE: Move the built-in 'file:' loader to become an engine module 2020-09-03 17:48:32 +02:00
missingcrypto.txt Add missing documentation for X509_ATTRIBUTE related functions. 2024-01-03 12:50:54 +01:00
missingmacro111.txt Document some SSL DH related functions/macros 2020-11-18 14:14:53 +00:00
missingmacro.txt BIO_s_dgram: add documentation and hazard warnings 2022-12-15 06:32:45 +00:00
missingssl111.txt Adjust all util/missing*.txt to include the section number 2019-12-21 22:53:54 +01:00
missingssl-internal.txt Initialize files that declare internal symbols 2020-04-11 15:51:43 +02:00
missingssl.txt Add documentation for the function SSL_CONF_CTX_finish. 2023-09-20 10:25:51 +10:00
mk-fipsmodule-cnf.pl Copyright year updates 2023-09-07 09:59:15 +01:00
mkbuildinf.pl
mkdef.pl Fix various typos, repeated words, align some spelling to LDP. 2022-10-12 16:55:28 +11:00
mkdir-p.pl Update copyright year 2021-04-08 13:04:41 +01:00
mkerr.pl Copyright year updates 2023-09-07 09:59:15 +01:00
mkinstallvars.pl Add exporters for CMake 2023-11-15 08:22:29 +01:00
mknum.pl Ensure ordinals are created during release process 2021-06-29 09:51:30 +10:00
mkpod2html.pl Fix util/mkpod2html.pl to call pod2html with absolute paths 2021-09-21 11:05:53 +02:00
mkrc.pl util/mkrc.pl: Make sure FILEVERSION and PRODUCTVERSION have four numbers 2020-11-17 13:18:16 +01:00
mktar.sh Fix treatment of BUILD_METADATA 2022-12-08 07:01:33 +01:00
opensslwrap.sh util/opensslwrap.sh: adjust to define OPENSSL_MODULES as well 2019-07-15 16:14:35 +02:00
other-internal.syms Suppress errors about undocumented asn1_d2i_read_bio 2021-02-22 12:11:38 +00:00
other.syms Add missing documentation for X509_ATTRIBUTE related functions. 2024-01-03 12:50:54 +01:00
providers.num
quicserver.c QUIC CHANNEL: Consolidate forward object declarations in a single header 2023-12-21 08:11:59 +00:00
shlib_wrap.sh.in Add explicit support in util/shlib_wrap.sh.in for NonStop DLL loading. 2021-03-30 19:08:32 +02:00
su-filter.pl
update_abi_check.sh Update ci and ABI xml files to validate function parameters 2023-11-15 11:08:17 +01:00
withlibctx.pl Perl util to do with_libctx renaming 2020-10-01 09:23:05 +01:00
wrap.pl.in Fix util/wrap.pl.in for VMS usage 2023-03-08 12:29:22 +01:00
write-man-symlinks write-man-symlinks: Write relative symlinks not absolute 2021-05-25 17:14:09 +02:00