| 1 | // Match the init API to the OpenSSL headers that are actually available. |
| 2 | #if defined(LIBRESSL_VERSION_NUMBER) || !defined(OPENSSL_VERSION_NUMBER) \ |
| 3 | || OPENSSL_VERSION_NUMBER < 0x10100000L |
| 4 | static int v_net_openssl_init_ssl(void) { |
| 5 | SSL_load_error_strings(); |
| 6 | return SSL_library_init(); |
| 7 | } |
| 8 | #else |
| 9 | static int v_net_openssl_init_ssl(void) { |
| 10 | return OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, 0); |
| 11 | } |
| 12 | #endif |
| 13 | |
| 14 | // SSL_get1_peer_certificate is only available in OpenSSL 3.x. |
| 15 | #if defined(LIBRESSL_VERSION_NUMBER) || !defined(OPENSSL_VERSION_NUMBER) \ |
| 16 | || OPENSSL_VERSION_NUMBER < 0x30000000L |
| 17 | static X509 *v_net_openssl_get1_peer_certificate(SSL *ssl) { |
| 18 | return SSL_get_peer_certificate(ssl); |
| 19 | } |
| 20 | #else |
| 21 | static X509 *v_net_openssl_get1_peer_certificate(SSL *ssl) { |
| 22 | return SSL_get1_peer_certificate(ssl); |
| 23 | } |
| 24 | #endif |
| 25 | |