Log Message: |
Adapt to OpenSSL 1.1.x API changes.
OpenSSL 1.1.x makes various types opaque, requiring the use of
accessors, and rewrote the state machine describing the handshake
process. Of particular interest to serf are the BIO, BIO_METHOD, and
X509_STORE types.
Patch by: 'James McCoy' <jamessan{_AT_}debian.org>
* buckets/ssl_buckets.c
(): New USE_LEGACY_OPENSSL define
(): New X509_STORE_get0_param() define for use with pre-1.1.x OpenSSL
(detect_renegotiate): Use SSL_get_state to check for the
TLS_ST_SW_HELLO_REQ state, indicating the server is starting a new
negotiation.
(bio_set_data, bio_get_data): New functions to abstract access to
the BIO data.
(bio_bucket_read, bio_bucket_write, bio_file_read, bio_file_write,
bio_file_gets): Use bio_get_data.
(bio_bucket_create): Use BIO accessor functions when available.
(bio_meth_bucket_new, bio_meth_file_new): New functions to abstract
creation of BIO_METHOD. With OpenSSL 1.1.x or newer, the BIO_meth_*
functions are used to allocate a new BIO_METOD and set the
callbacks, otherwise the pointers to the statically defined structs
are used.
(bio_meth_free): New function.
(ocsp_callback): Use OCSP_response_status to get status instead of
accessing internals of OCSP_RESPONSE struct. Remove unused
OCSP_RESPBYTES variable.
(ssl_decrypt): Use SSL_get_state to check for the TLS_ST_OK state,
indicating completed handshake.
(init_ssl_libraries): Exclude threading code when OpenSSL 1.1.x is in
use since OpenSSL now handles this appropriately without users of
the library setting up locking functions.
(ssl_need_client_cert, ssl_init_context, serf_ssl_load_cert_file,
serf_ssl_add_crl_from_file): Use new bio_meth_*_new functions to
provide the BIO_METHOD* to BIO_new(). Also use the bio_set_data
function to set the data for the callback.
* test/MockHTTPinC/MockHTTP_server.c
(): New USE_OPENSSL_1_1_API define
(bio_set_data, bio_get_data): New functions to abstract access to
the BIO data.
(bio_apr_socket_read, bio_apr_socket_write): Use bio_get_data.
(bio_apr_socket_create): Use BIO accessor functions when available.
(bio_meth_apr_socket_new): New function to abstract creation of
BIO_METHOD. With OpenSSL 1.1.x or newer, the BIO_meth_* functions
are used to allocate a new BIO_METOD and set the callbacks,
otherwise the pointer to the statically defined struct is used.
(initSSLCtx): Use new bio_meth_apr_socket_new function to
provide the BIO_METHOD* to BIO_new(). Also use the bio_set_data
function to set the data for the callback.
|