Prepare to provide SSL_CTX_set1_cert_store()
authortb <tb@openbsd.org>
Sat, 3 Aug 2024 04:50:27 +0000 (04:50 +0000)
committertb <tb@openbsd.org>
Sat, 3 Aug 2024 04:50:27 +0000 (04:50 +0000)
commitdcd96ea64a010379ee4106ca8b978aecdfded350
treed52224327ad9f8d0fd84c2dc6b994a0d23c5bbcb
parentf4d0a2629d02c75337b910158daf8ea1b113d7b2
Prepare to provide SSL_CTX_set1_cert_store()

SSL_CTX_set_cert_store() should have been called SSL_CTX_set0_cert_store()
since it takes ownership of the store argument. Apparently a few people ran
into the issue of not bumping the refcount themselves, leading to use after
frees about 10 years ago. This is a quite rarely used API and there are no
misuses in the ports tree, but since someone did the work of writing a diff,
we can still add it.

Needless to say that SSL_CTX_get_cert_store() obviously has the exact same
issue and nobody seems to have thought of adding a get0 or get1 version to
match...

Fixes https://github.com/libressl/openbsd/issues/71
From Kenjiro Nakayama
lib/libssl/hidden/openssl/ssl.h
lib/libssl/ssl.h
lib/libssl/ssl_lib.c