Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 28 Nov 2023 17:34:03 +0000 (12:34 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 28 Nov 2023 17:34:03 +0000 (12:34 -0500)
commitc82207a548db47623a2bfa2447babdaa630302b9
tree7ff63dac975744872cd60b0a591a28b2090283c5
parent10a59925a378bd67aa3834c842dad19de9c5e4c0
Use BIO_{get,set}_app_data instead of BIO_{get,set}_data.

We should have done it this way all along, but we accidentally got
away with using the wrong BIO field up until OpenSSL 3.2.  There,
the library's BIO routines that we rely on use the "data" field
for their own purposes, and our conflicting use causes assorted
weird behaviors up to and including core dumps when SSL connections
are attempted.  Switch to using the approved field for the purpose,
i.e. app_data.

While at it, remove our configure probes for BIO_get_data as well
as the fallback implementation.  BIO_{get,set}_app_data have been
there since long before any OpenSSL version that we still support,
even in the back branches.

Also, update src/test/ssl/t/001_ssltests.pl to allow for a minor
change in an error message spelling that evidently came in with 3.2.

Tristan Partin and Bo Andreson.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/CAN55FZ1eDDYsYaL7mv+oSLUij2h_u6hvD4Qmv-7PK7jkji0uyQ@mail.gmail.com
configure
configure.ac
meson.build
src/backend/libpq/be-secure-openssl.c
src/include/pg_config.h.in
src/interfaces/libpq/fe-secure-openssl.c
src/test/ssl/t/001_ssltests.pl
src/tools/msvc/Solution.pm