| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // Copyright (C) 2014 BlackBerry Limited. All rights reserved. |
| 3 | // Copyright (C) 2016 Richard J. Moore <rich@kde.org> |
| 4 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 5 | |
| 6 | /**************************************************************************** |
| 7 | ** |
| 8 | ** In addition, as a special exception, the copyright holders listed above give |
| 9 | ** permission to link the code of its release of Qt with the OpenSSL project's |
| 10 | ** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the |
| 11 | ** same license as the original version), and distribute the linked executables. |
| 12 | ** |
| 13 | ** You must comply with the GNU General Public License version 2 in all |
| 14 | ** respects for all of the code used other than the "OpenSSL" code. If you |
| 15 | ** modify this file, you may extend this exception to your version of the file, |
| 16 | ** but you are not obligated to do so. If you do not wish to do so, delete |
| 17 | ** this exception statement from your version of this file. |
| 18 | ** |
| 19 | ****************************************************************************/ |
| 20 | |
| 21 | #include "qsslsocket_openssl_symbols_p.h" |
| 22 | #include "qtlsbackend_openssl_p.h" |
| 23 | |
| 24 | #include <QtNetwork/private/qssl_p.h> |
| 25 | |
| 26 | #ifdef Q_OS_WIN |
| 27 | # include <QtCore/private/qsystemlibrary_p.h> |
| 28 | #elif QT_CONFIG(library) |
| 29 | # include <QtCore/qlibrary.h> |
| 30 | #endif |
| 31 | #include <QtCore/qdatetime.h> |
| 32 | #if defined(Q_OS_UNIX) |
| 33 | #include <QtCore/qdir.h> |
| 34 | #endif |
| 35 | #include <QtCore/private/qduplicatetracker_p.h> |
| 36 | #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) |
| 37 | #include <link.h> |
| 38 | #endif |
| 39 | #ifdef Q_OS_DARWIN |
| 40 | #include <QtCore/private/qcore_mac_p.h> |
| 41 | #endif |
| 42 | |
| 43 | #include <algorithm> |
| 44 | |
| 45 | QT_BEGIN_NAMESPACE |
| 46 | |
| 47 | using namespace Qt::StringLiterals; |
| 48 | |
| 49 | /* |
| 50 | Note to maintainer: |
| 51 | ------------------- |
| 52 | |
| 53 | We load OpenSSL symbols dynamically. Because symbols are known to |
| 54 | disappear, and signatures sometimes change, between releases, we need to |
| 55 | be careful about how this is done. To ensure we don't end up dereferencing |
| 56 | null function pointers, and continue running even if certain functions are |
| 57 | missing, we define helper functions for each of the symbols we load from |
| 58 | OpenSSL, all prefixed with "q_" (declared in |
| 59 | qsslsocket_openssl_symbols_p.h). So instead of calling SSL_connect |
| 60 | directly, we call q_SSL_connect, which is a function that checks if the |
| 61 | actual SSL_connect fptr is null, and returns a failure if it is, or calls |
| 62 | SSL_connect if it isn't. |
| 63 | |
| 64 | This requires a somewhat tedious process of declaring each function we |
| 65 | want to call in OpenSSL thrice: once with the q_, in _p.h, once using the |
| 66 | DEFINEFUNC macros below, and once in the function that actually resolves |
| 67 | the symbols, below the DEFINEFUNC declarations below. |
| 68 | |
| 69 | There's one DEFINEFUNC macro declared for every number of arguments |
| 70 | exposed by OpenSSL (feel free to extend when needed). The easiest thing to |
| 71 | do is to find an existing entry that matches the arg count of the function |
| 72 | you want to import, and do the same. |
| 73 | |
| 74 | The first macro arg is the function return type. The second is the |
| 75 | verbatim name of the function/symbol. Then follows a list of N pairs of |
| 76 | argument types with a variable name, and just the variable name (char *a, |
| 77 | a, char *b, b, etc). Finally there's two arguments - a suitable return |
| 78 | statement for the error case (for an int function, return 0 or return -1 |
| 79 | is usually right). Then either just "return" or DUMMYARG, the latter being |
| 80 | for void functions. |
| 81 | |
| 82 | Note: Take into account that these macros and declarations are processed |
| 83 | at compile-time, and the result depends on the OpenSSL headers the |
| 84 | compiling host has installed, but the symbols are resolved at run-time, |
| 85 | possibly with a different version of OpenSSL. |
| 86 | */ |
| 87 | |
| 88 | #ifndef QT_LINKED_OPENSSL |
| 89 | |
| 90 | namespace { |
| 91 | void qsslSocketUnresolvedSymbolWarning(const char *functionName) |
| 92 | { |
| 93 | qCWarning(lcTlsBackend, "QSslSocket: cannot call unresolved function %s" , functionName); |
| 94 | } |
| 95 | |
| 96 | #if QT_CONFIG(library) |
| 97 | void qsslSocketCannotResolveSymbolWarning(const char *functionName) |
| 98 | { |
| 99 | qCWarning(lcTlsBackend, "QSslSocket: cannot resolve %s" , functionName); |
| 100 | } |
| 101 | #endif |
| 102 | |
| 103 | } |
| 104 | |
| 105 | #endif // QT_LINKED_OPENSSL |
| 106 | |
| 107 | DEFINEFUNC(const unsigned char *, ASN1_STRING_get0_data, const ASN1_STRING *a, a, return nullptr, return) |
| 108 | DEFINEFUNC2(int, OPENSSL_init_ssl, uint64_t opts, opts, const OPENSSL_INIT_SETTINGS *settings, settings, return 0, return) |
| 109 | DEFINEFUNC2(int, OPENSSL_init_crypto, uint64_t opts, opts, const OPENSSL_INIT_SETTINGS *settings, settings, return 0, return) |
| 110 | DEFINEFUNC(BIO *, BIO_new, const BIO_METHOD *a, a, return nullptr, return) |
| 111 | DEFINEFUNC(const BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return nullptr, return) |
| 112 | DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return) |
| 113 | DEFINEFUNC(int, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX *c, c, return 0, return) |
| 114 | DEFINEFUNC(int, EVP_PKEY_up_ref, EVP_PKEY *a, a, return 0, return) |
| 115 | DEFINEFUNC2(EVP_PKEY_CTX *, EVP_PKEY_CTX_new, EVP_PKEY *pkey, pkey, ENGINE *e, e, return nullptr, return) |
| 116 | DEFINEFUNC(int, EVP_PKEY_param_check, EVP_PKEY_CTX *ctx, ctx, return 0, return) |
| 117 | DEFINEFUNC(void, EVP_PKEY_CTX_free, EVP_PKEY_CTX *ctx, ctx, return, return) |
| 118 | DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return) |
| 119 | DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG) |
| 120 | DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return) |
| 121 | DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG) |
| 122 | DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG) |
| 123 | DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return) |
| 124 | DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return) |
| 125 | DEFINEFUNC2(qssloptions, SSL_CTX_set_options, SSL_CTX *ctx, ctx, qssloptions op, op, return 0, return) |
| 126 | using info_callback = void (*) (const SSL *ssl, int type, int val); |
| 127 | DEFINEFUNC2(void, SSL_set_info_callback, SSL *ssl, ssl, info_callback cb, cb, return, return) |
| 128 | DEFINEFUNC(const char *, SSL_alert_type_string, int value, value, return nullptr, return) |
| 129 | DEFINEFUNC(const char *, SSL_alert_desc_string_long, int value, value, return nullptr, return) |
| 130 | DEFINEFUNC(int, SSL_CTX_get_security_level, const SSL_CTX *ctx, ctx, return -1, return) |
| 131 | DEFINEFUNC2(void, SSL_CTX_set_security_level, SSL_CTX *ctx, ctx, int level, level, return, return) |
| 132 | #ifdef TLS1_3_VERSION |
| 133 | DEFINEFUNC2(int, SSL_CTX_set_ciphersuites, SSL_CTX *ctx, ctx, const char *str, str, return 0, return) |
| 134 | DEFINEFUNC2(void, SSL_set_psk_use_session_callback, SSL *ssl, ssl, q_SSL_psk_use_session_cb_func_t callback, callback, return, DUMMYARG) |
| 135 | DEFINEFUNC2(void, SSL_CTX_sess_set_new_cb, SSL_CTX *ctx, ctx, NewSessionCallback cb, cb, return, return) |
| 136 | DEFINEFUNC(int, SSL_SESSION_is_resumable, const SSL_SESSION *s, s, return 0, return) |
| 137 | #endif |
| 138 | DEFINEFUNC3(size_t, SSL_get_client_random, SSL *a, a, unsigned char *out, out, size_t outlen, outlen, return 0, return) |
| 139 | DEFINEFUNC3(size_t, SSL_SESSION_get_master_key, const SSL_SESSION *ses, ses, unsigned char *out, out, size_t outlen, outlen, return 0, return) |
| 140 | DEFINEFUNC6(int, CRYPTO_get_ex_new_index, int class_index, class_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) |
| 141 | DEFINEFUNC2(unsigned long, SSL_set_options, SSL *ssl, ssl, unsigned long op, op, return 0, return) |
| 142 | |
| 143 | DEFINEFUNC(const SSL_METHOD *, TLS_method, DUMMYARG, DUMMYARG, return nullptr, return) |
| 144 | DEFINEFUNC(const SSL_METHOD *, TLS_client_method, DUMMYARG, DUMMYARG, return nullptr, return) |
| 145 | DEFINEFUNC(const SSL_METHOD *, TLS_server_method, DUMMYARG, DUMMYARG, return nullptr, return) |
| 146 | DEFINEFUNC(void, X509_up_ref, X509 *a, a, return, DUMMYARG) |
| 147 | DEFINEFUNC(ASN1_TIME *, X509_getm_notBefore, X509 *a, a, return nullptr, return) |
| 148 | DEFINEFUNC(ASN1_TIME *, X509_getm_notAfter, X509 *a, a, return nullptr, return) |
| 149 | DEFINEFUNC2(void, ASN1_item_free, ASN1_VALUE *val, val, const ASN1_ITEM *it, it, return, return) |
| 150 | DEFINEFUNC(void, X509V3_conf_free, CONF_VALUE *val, val, return, return) |
| 151 | DEFINEFUNC(long, X509_get_version, X509 *a, a, return -1, return) |
| 152 | DEFINEFUNC(EVP_PKEY *, X509_get_pubkey, X509 *a, a, return nullptr, return) |
| 153 | DEFINEFUNC2(void, X509_STORE_set_verify_cb, X509_STORE *a, a, X509_STORE_CTX_verify_cb verify_cb, verify_cb, return, DUMMYARG) |
| 154 | DEFINEFUNC3(int, X509_STORE_set_ex_data, X509_STORE *a, a, int idx, idx, void *data, data, return 0, return) |
| 155 | DEFINEFUNC2(void *, X509_STORE_get_ex_data, X509_STORE *r, r, int idx, idx, return nullptr, return) |
| 156 | DEFINEFUNC(STACK_OF(X509) *, X509_STORE_CTX_get0_chain, X509_STORE_CTX *a, a, return nullptr, return) |
| 157 | DEFINEFUNC3(void, CRYPTO_free, void *str, str, const char *file, file, int line, line, return, DUMMYARG) |
| 158 | DEFINEFUNC3(int, CRYPTO_memcmp, const void * in_a, in_a, const void * in_b, in_b, size_t len, len, return 1, return); |
| 159 | DEFINEFUNC(long, OpenSSL_version_num, void, DUMMYARG, return 0, return) |
| 160 | DEFINEFUNC(const char *, OpenSSL_version, int a, a, return nullptr, return) |
| 161 | DEFINEFUNC(unsigned long, SSL_SESSION_get_ticket_lifetime_hint, const SSL_SESSION *session, session, return 0, return) |
| 162 | |
| 163 | #if QT_CONFIG(dtls) |
| 164 | DEFINEFUNC2(int, DTLSv1_listen, SSL *s, s, BIO_ADDR *c, c, return -1, return) |
| 165 | DEFINEFUNC(BIO_ADDR *, BIO_ADDR_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 166 | DEFINEFUNC(void, BIO_ADDR_free, BIO_ADDR *ap, ap, return, DUMMYARG) |
| 167 | DEFINEFUNC2(BIO_METHOD *, BIO_meth_new, int type, type, const char *name, name, return nullptr, return) |
| 168 | DEFINEFUNC(void, BIO_meth_free, BIO_METHOD *biom, biom, return, DUMMYARG) |
| 169 | DEFINEFUNC2(int, BIO_meth_set_write, BIO_METHOD *biom, biom, DgramWriteCallback write, write, return 0, return) |
| 170 | DEFINEFUNC2(int, BIO_meth_set_read, BIO_METHOD *biom, biom, DgramReadCallback read, read, return 0, return) |
| 171 | DEFINEFUNC2(int, BIO_meth_set_puts, BIO_METHOD *biom, biom, DgramPutsCallback puts, puts, return 0, return) |
| 172 | DEFINEFUNC2(int, BIO_meth_set_ctrl, BIO_METHOD *biom, biom, DgramCtrlCallback ctrl, ctrl, return 0, return) |
| 173 | DEFINEFUNC2(int, BIO_meth_set_create, BIO_METHOD *biom, biom, DgramCreateCallback crt, crt, return 0, return) |
| 174 | DEFINEFUNC2(int, BIO_meth_set_destroy, BIO_METHOD *biom, biom, DgramDestroyCallback dtr, dtr, return 0, return) |
| 175 | #endif // dtls |
| 176 | |
| 177 | #if QT_CONFIG(ocsp) |
| 178 | DEFINEFUNC(const OCSP_CERTID *, OCSP_SINGLERESP_get0_id, const OCSP_SINGLERESP *x, x, return nullptr, return) |
| 179 | DEFINEFUNC3(OCSP_RESPONSE *, d2i_OCSP_RESPONSE, OCSP_RESPONSE **a, a, const unsigned char **in, in, long len, len, return nullptr, return) |
| 180 | DEFINEFUNC(void, OCSP_RESPONSE_free, OCSP_RESPONSE *rs, rs, return, DUMMYARG) |
| 181 | DEFINEFUNC(OCSP_BASICRESP *, OCSP_response_get1_basic, OCSP_RESPONSE *resp, resp, return nullptr, return) |
| 182 | DEFINEFUNC(void, OCSP_BASICRESP_free, OCSP_BASICRESP *bs, bs, return, DUMMYARG) |
| 183 | DEFINEFUNC(int, OCSP_response_status, OCSP_RESPONSE *resp, resp, return OCSP_RESPONSE_STATUS_INTERNALERROR, return) |
| 184 | DEFINEFUNC4(int, OCSP_basic_verify, OCSP_BASICRESP *bs, bs, STACK_OF(X509) *certs, certs, X509_STORE *st, st, unsigned long flags, flags, return -1, return) |
| 185 | DEFINEFUNC(int, OCSP_resp_count, OCSP_BASICRESP *bs, bs, return 0, return) |
| 186 | DEFINEFUNC2(OCSP_SINGLERESP *, OCSP_resp_get0, OCSP_BASICRESP *bs, bs, int idx, idx, return nullptr, return) |
| 187 | DEFINEFUNC5(int, OCSP_single_get0_status, OCSP_SINGLERESP *single, single, int *reason, reason, ASN1_GENERALIZEDTIME **revtime, revtime, |
| 188 | ASN1_GENERALIZEDTIME **thisupd, thisupd, ASN1_GENERALIZEDTIME **nextupd, nextupd, return -1, return) |
| 189 | DEFINEFUNC4(int, OCSP_check_validity, ASN1_GENERALIZEDTIME *thisupd, thisupd, ASN1_GENERALIZEDTIME *nextupd, nextupd, long nsec, nsec, long maxsec, maxsec, return 0, return) |
| 190 | DEFINEFUNC3(OCSP_CERTID *, OCSP_cert_to_id, const EVP_MD *dgst, dgst, X509 *subject, subject, X509 *issuer, issuer, return nullptr, return) |
| 191 | DEFINEFUNC(void, OCSP_CERTID_free, OCSP_CERTID *cid, cid, return, DUMMYARG) |
| 192 | DEFINEFUNC5(int, OCSP_id_get0_info, ASN1_OCTET_STRING **piNameHash, piNameHash, ASN1_OBJECT **pmd, pmd, |
| 193 | ASN1_OCTET_STRING **piKeyHash, piKeyHash, ASN1_INTEGER **pserial, pserial, OCSP_CERTID *cid, cid, |
| 194 | return 0, return) |
| 195 | DEFINEFUNC2(OCSP_RESPONSE *, OCSP_response_create, int status, status, OCSP_BASICRESP *bs, bs, return nullptr, return) |
| 196 | DEFINEFUNC(const STACK_OF(X509) *, OCSP_resp_get0_certs, const OCSP_BASICRESP *bs, bs, return nullptr, return) |
| 197 | DEFINEFUNC2(int, OCSP_id_cmp, OCSP_CERTID *a, a, OCSP_CERTID *b, b, return -1, return) |
| 198 | DEFINEFUNC7(OCSP_SINGLERESP *, OCSP_basic_add1_status, OCSP_BASICRESP *r, r, OCSP_CERTID *c, c, int s, s, |
| 199 | int re, re, ASN1_TIME *rt, rt, ASN1_TIME *t, t, ASN1_TIME *n, n, return nullptr, return) |
| 200 | DEFINEFUNC(OCSP_BASICRESP *, OCSP_BASICRESP_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 201 | DEFINEFUNC2(int, i2d_OCSP_RESPONSE, OCSP_RESPONSE *r, r, unsigned char **ppout, ppout, return 0, return) |
| 202 | DEFINEFUNC6(int, OCSP_basic_sign, OCSP_BASICRESP *br, br, X509 *signer, signer, EVP_PKEY *key, key, |
| 203 | const EVP_MD *dg, dg, STACK_OF(X509) *cs, cs, unsigned long flags, flags, return 0, return) |
| 204 | #endif // ocsp |
| 205 | |
| 206 | DEFINEFUNC(void, AUTHORITY_INFO_ACCESS_free, AUTHORITY_INFO_ACCESS *p, p, return, return) |
| 207 | DEFINEFUNC2(void, BIO_set_data, BIO *a, a, void *ptr, ptr, return, DUMMYARG) |
| 208 | DEFINEFUNC(void *, BIO_get_data, BIO *a, a, return nullptr, return) |
| 209 | DEFINEFUNC2(void, BIO_set_init, BIO *a, a, int init, init, return, DUMMYARG) |
| 210 | DEFINEFUNC(int, BIO_get_shutdown, BIO *a, a, return -1, return) |
| 211 | DEFINEFUNC2(void, BIO_set_shutdown, BIO *a, a, int shut, shut, return, DUMMYARG) |
| 212 | |
| 213 | DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) |
| 214 | DEFINEFUNC2(int, ASN1_INTEGER_cmp, const ASN1_INTEGER *a, a, const ASN1_INTEGER *b, b, return 1, return) |
| 215 | DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) |
| 216 | DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return) |
| 217 | DEFINEFUNC2(int, ASN1_TIME_to_tm, const ASN1_TIME *s, s, struct tm *tm, tm, return 0, return) |
| 218 | DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) |
| 219 | DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return) |
| 220 | DEFINEFUNC2(BIO *, BIO_new_mem_buf, void *a, a, int b, b, return nullptr, return) |
| 221 | DEFINEFUNC3(int, BIO_read, BIO *a, a, void *b, b, int c, c, return -1, return) |
| 222 | |
| 223 | DEFINEFUNC3(int, BIO_write, BIO *a, a, const void *b, b, int c, c, return -1, return) |
| 224 | DEFINEFUNC(int, BN_num_bits, const BIGNUM *a, a, return 0, return) |
| 225 | DEFINEFUNC2(BN_ULONG, BN_mod_word, const BIGNUM *a, a, BN_ULONG w, w, return static_cast<BN_ULONG>(-1), return) |
| 226 | DEFINEFUNC3(X509 *, d2i_X509, X509 **a, a, const unsigned char **b, b, long c, c, return nullptr, return) |
| 227 | DEFINEFUNC2(char *, ERR_error_string, unsigned long a, a, char *b, b, return nullptr, return) |
| 228 | DEFINEFUNC3(void, ERR_error_string_n, unsigned long e, e, char *b, b, size_t len, len, return, DUMMYARG) |
| 229 | DEFINEFUNC(unsigned long, ERR_get_error, DUMMYARG, DUMMYARG, return 0, return) |
| 230 | DEFINEFUNC(EVP_CIPHER_CTX *, EVP_CIPHER_CTX_new, void, DUMMYARG, return nullptr, return) |
| 231 | DEFINEFUNC(void, EVP_CIPHER_CTX_free, EVP_CIPHER_CTX *a, a, return, DUMMYARG) |
| 232 | DEFINEFUNC4(int, EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX *ctx, ctx, int type, type, int arg, arg, void *ptr, ptr, return 0, return) |
| 233 | DEFINEFUNC2(int, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX *ctx, ctx, int keylen, keylen, return 0, return) |
| 234 | DEFINEFUNC5(int, EVP_CipherInit, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *type, type, const unsigned char *key, key, const unsigned char *iv, iv, int enc, enc, return 0, return) |
| 235 | DEFINEFUNC6(int, EVP_CipherInit_ex, EVP_CIPHER_CTX *ctx, ctx, const EVP_CIPHER *cipher, cipher, ENGINE *impl, impl, const unsigned char *key, key, const unsigned char *iv, iv, int enc, enc, return 0, return) |
| 236 | DEFINEFUNC5(int, EVP_CipherUpdate, EVP_CIPHER_CTX *ctx, ctx, unsigned char *out, out, int *outl, outl, const unsigned char *in, in, int inl, inl, return 0, return) |
| 237 | DEFINEFUNC3(int, EVP_CipherFinal, EVP_CIPHER_CTX *ctx, ctx, unsigned char *out, out, int *outl, outl, return 0, return) |
| 238 | DEFINEFUNC(const EVP_MD *, EVP_get_digestbyname, const char *name, name, return nullptr, return) |
| 239 | #ifndef OPENSSL_NO_DES |
| 240 | DEFINEFUNC(const EVP_CIPHER *, EVP_des_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 241 | DEFINEFUNC(const EVP_CIPHER *, EVP_des_ede3_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 242 | #endif |
| 243 | #ifndef OPENSSL_NO_RC2 |
| 244 | DEFINEFUNC(const EVP_CIPHER *, EVP_rc2_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 245 | #endif |
| 246 | #ifndef OPENSSL_NO_AES |
| 247 | DEFINEFUNC(const EVP_CIPHER *, EVP_aes_128_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 248 | DEFINEFUNC(const EVP_CIPHER *, EVP_aes_192_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 249 | DEFINEFUNC(const EVP_CIPHER *, EVP_aes_256_cbc, DUMMYARG, DUMMYARG, return nullptr, return) |
| 250 | #endif |
| 251 | DEFINEFUNC(const EVP_MD *, EVP_sha1, DUMMYARG, DUMMYARG, return nullptr, return) |
| 252 | DEFINEFUNC(void, EVP_PKEY_free, EVP_PKEY *a, a, return, DUMMYARG) |
| 253 | DEFINEFUNC(EVP_PKEY *, EVP_PKEY_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 254 | DEFINEFUNC(int, EVP_PKEY_type, int a, a, return NID_undef, return) |
| 255 | DEFINEFUNC2(int, i2d_X509, X509 *a, a, unsigned char **b, b, return -1, return) |
| 256 | DEFINEFUNC(const char *, OBJ_nid2sn, int a, a, return nullptr, return) |
| 257 | DEFINEFUNC(const char *, OBJ_nid2ln, int a, a, return nullptr, return) |
| 258 | DEFINEFUNC(int, OBJ_sn2nid, const char *s, s, return 0, return) |
| 259 | DEFINEFUNC(int, OBJ_ln2nid, const char *s, s, return 0, return) |
| 260 | DEFINEFUNC3(int, i2t_ASN1_OBJECT, char *a, a, int b, b, ASN1_OBJECT *c, c, return -1, return) |
| 261 | DEFINEFUNC4(int, OBJ_obj2txt, char *a, a, int b, b, ASN1_OBJECT *c, c, int d, d, return -1, return) |
| 262 | DEFINEFUNC(int, OBJ_obj2nid, const ASN1_OBJECT *a, a, return NID_undef, return) |
| 263 | DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PrivateKey, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 264 | |
| 265 | DEFINEFUNC7(int, PEM_write_bio_PrivateKey, BIO *a, a, EVP_PKEY *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) |
| 266 | DEFINEFUNC7(int, PEM_write_bio_PrivateKey_traditional, BIO *a, a, EVP_PKEY *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) |
| 267 | DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PUBKEY, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 268 | DEFINEFUNC2(int, PEM_write_bio_PUBKEY, BIO *a, a, EVP_PKEY *b, b, return 0, return) |
| 269 | DEFINEFUNC2(void, RAND_seed, const void *a, a, int b, b, return, DUMMYARG) |
| 270 | DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return) |
| 271 | DEFINEFUNC2(int, RAND_bytes, unsigned char *b, b, int n, n, return 0, return) |
| 272 | DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return) |
| 273 | DEFINEFUNC(int, SSL_clear, SSL *a, a, return -1, return) |
| 274 | DEFINEFUNC3(char *, SSL_CIPHER_description, const SSL_CIPHER *a, a, char *b, b, int c, c, return nullptr, return) |
| 275 | DEFINEFUNC2(int, SSL_CIPHER_get_bits, const SSL_CIPHER *a, a, int *b, b, return 0, return) |
| 276 | DEFINEFUNC(BIO *, SSL_get_rbio, const SSL *s, s, return nullptr, return) |
| 277 | DEFINEFUNC(int, SSL_connect, SSL *a, a, return -1, return) |
| 278 | DEFINEFUNC(int, SSL_CTX_check_private_key, const SSL_CTX *a, a, return -1, return) |
| 279 | DEFINEFUNC4(long, SSL_CTX_ctrl, SSL_CTX *a, a, int b, b, long c, c, void *d, d, return -1, return) |
| 280 | DEFINEFUNC(void, SSL_CTX_free, SSL_CTX *a, a, return, DUMMYARG) |
| 281 | DEFINEFUNC(SSL_CTX *, SSL_CTX_new, const SSL_METHOD *a, a, return nullptr, return) |
| 282 | DEFINEFUNC2(int, SSL_CTX_set_cipher_list, SSL_CTX *a, a, const char *b, b, return -1, return) |
| 283 | DEFINEFUNC3(long, SSL_CTX_callback_ctrl, SSL_CTX *ctx, ctx, int dst, dst, GenericCallbackType cb, cb, return 0, return) |
| 284 | DEFINEFUNC(int, SSL_CTX_set_default_verify_paths, SSL_CTX *a, a, return -1, return) |
| 285 | DEFINEFUNC3(void, SSL_CTX_set_verify, SSL_CTX *a, a, int b, b, int (*c)(int, X509_STORE_CTX *), c, return, DUMMYARG) |
| 286 | DEFINEFUNC2(void, SSL_CTX_set_verify_depth, SSL_CTX *a, a, int b, b, return, DUMMYARG) |
| 287 | DEFINEFUNC2(int, SSL_CTX_use_certificate, SSL_CTX *a, a, X509 *b, b, return -1, return) |
| 288 | DEFINEFUNC3(int, SSL_CTX_use_certificate_file, SSL_CTX *a, a, const char *b, b, int c, c, return -1, return) |
| 289 | DEFINEFUNC2(int, SSL_CTX_use_PrivateKey, SSL_CTX *a, a, EVP_PKEY *b, b, return -1, return) |
| 290 | DEFINEFUNC3(int, SSL_CTX_use_PrivateKey_file, SSL_CTX *a, a, const char *b, b, int c, c, return -1, return) |
| 291 | DEFINEFUNC(X509_STORE *, SSL_CTX_get_cert_store, const SSL_CTX *a, a, return nullptr, return) |
| 292 | DEFINEFUNC(SSL_CONF_CTX *, SSL_CONF_CTX_new, DUMMYARG, DUMMYARG, return nullptr, return); |
| 293 | DEFINEFUNC(void, SSL_CONF_CTX_free, SSL_CONF_CTX *a, a, return ,return); |
| 294 | DEFINEFUNC2(void, SSL_CONF_CTX_set_ssl_ctx, SSL_CONF_CTX *a, a, SSL_CTX *b, b, return, return); |
| 295 | DEFINEFUNC2(unsigned int, SSL_CONF_CTX_set_flags, SSL_CONF_CTX *a, a, unsigned int b, b, return 0, return); |
| 296 | DEFINEFUNC(int, SSL_CONF_CTX_finish, SSL_CONF_CTX *a, a, return 0, return); |
| 297 | DEFINEFUNC3(int, SSL_CONF_cmd, SSL_CONF_CTX *a, a, const char *b, b, const char *c, c, return 0, return); |
| 298 | DEFINEFUNC(void, SSL_free, SSL *a, a, return, DUMMYARG) |
| 299 | DEFINEFUNC(STACK_OF(SSL_CIPHER) *, SSL_get_ciphers, const SSL *a, a, return nullptr, return) |
| 300 | DEFINEFUNC(const SSL_CIPHER *, SSL_get_current_cipher, SSL *a, a, return nullptr, return) |
| 301 | DEFINEFUNC(int, SSL_version, const SSL *a, a, return 0, return) |
| 302 | DEFINEFUNC2(int, SSL_get_error, SSL *a, a, int b, b, return -1, return) |
| 303 | DEFINEFUNC(STACK_OF(X509) *, SSL_get_peer_cert_chain, SSL *a, a, return nullptr, return) |
| 304 | |
| 305 | #if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3 |
| 306 | DEFINEFUNC(X509 *, SSL_get1_peer_certificate, SSL *a, a, return nullptr, return) |
| 307 | DEFINEFUNC(int, EVP_PKEY_get_bits, const EVP_PKEY *pkey, pkey, return -1, return) |
| 308 | DEFINEFUNC(int, EVP_PKEY_get_base_id, const EVP_PKEY *pkey, pkey, return -1, return) |
| 309 | #else |
| 310 | DEFINEFUNC(X509 *, SSL_get_peer_certificate, SSL *a, a, return nullptr, return) |
| 311 | DEFINEFUNC(int, EVP_PKEY_base_id, EVP_PKEY *a, a, return NID_undef, return) |
| 312 | #endif // OPENSSL_VERSION_MAJOR >= 3 |
| 313 | |
| 314 | DEFINEFUNC(long, SSL_get_verify_result, const SSL *a, a, return -1, return) |
| 315 | DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return nullptr, return) |
| 316 | DEFINEFUNC(SSL_CTX *, SSL_get_SSL_CTX, SSL *a, a, return nullptr, return) |
| 317 | DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, void *parg, parg, return -1, return) |
| 318 | DEFINEFUNC3(int, SSL_read, SSL *a, a, void *b, b, int c, c, return -1, return) |
| 319 | DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG) |
| 320 | DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG) |
| 321 | DEFINEFUNC(void, SSL_set_connect_state, SSL *a, a, return, DUMMYARG) |
| 322 | DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, return) |
| 323 | DEFINEFUNC(int, SSL_in_init, const SSL *a, a, return 0, return) |
| 324 | DEFINEFUNC(int, SSL_get_shutdown, const SSL *ssl, ssl, return 0, return) |
| 325 | DEFINEFUNC2(int, SSL_set_session, SSL* to, to, SSL_SESSION *session, session, return -1, return) |
| 326 | DEFINEFUNC(void, SSL_SESSION_free, SSL_SESSION *ses, ses, return, DUMMYARG) |
| 327 | DEFINEFUNC(SSL_SESSION*, SSL_get1_session, SSL *ssl, ssl, return nullptr, return) |
| 328 | DEFINEFUNC(SSL_SESSION*, SSL_get_session, const SSL *ssl, ssl, return nullptr, return) |
| 329 | DEFINEFUNC3(int, SSL_set_ex_data, SSL *ssl, ssl, int idx, idx, void *arg, arg, return 0, return) |
| 330 | DEFINEFUNC2(void *, SSL_get_ex_data, const SSL *ssl, ssl, int idx, idx, return nullptr, return) |
| 331 | |
| 332 | #ifndef OPENSSL_NO_PSK |
| 333 | DEFINEFUNC2(void, SSL_set_psk_client_callback, SSL* ssl, ssl, q_psk_client_callback_t callback, callback, return, DUMMYARG) |
| 334 | DEFINEFUNC2(void, SSL_set_psk_server_callback, SSL* ssl, ssl, q_psk_server_callback_t callback, callback, return, DUMMYARG) |
| 335 | DEFINEFUNC2(int, SSL_CTX_use_psk_identity_hint, SSL_CTX* ctx, ctx, const char *hint, hint, return 0, return) |
| 336 | #endif // !OPENSSL_NO_PSK |
| 337 | |
| 338 | DEFINEFUNC3(int, SSL_write, SSL *a, a, const void *b, b, int c, c, return -1, return) |
| 339 | DEFINEFUNC2(int, X509_cmp, X509 *a, a, X509 *b, b, return -1, return) |
| 340 | DEFINEFUNC4(int, X509_digest, const X509 *x509, x509, const EVP_MD *type, type, unsigned char *md, md, unsigned int *len, len, return -1, return) |
| 341 | DEFINEFUNC(X509 *, X509_dup, X509 *a, a, return nullptr, return) |
| 342 | DEFINEFUNC2(void, X509_print, BIO *a, a, X509 *b, b, return, DUMMYARG); |
| 343 | DEFINEFUNC(ASN1_OBJECT *, X509_EXTENSION_get_object, X509_EXTENSION *a, a, return nullptr, return) |
| 344 | DEFINEFUNC(void, X509_free, X509 *a, a, return, DUMMYARG) |
| 345 | //Q_AUTOTEST_EXPORT ASN1_TIME *q_X509_gmtime_adj(ASN1_TIME *s, long adj); |
| 346 | DEFINEFUNC2(ASN1_TIME *, X509_gmtime_adj, ASN1_TIME *s, s, long adj, adj, return nullptr, return) |
| 347 | DEFINEFUNC(void, ASN1_TIME_free, ASN1_TIME *t, t, return, DUMMYARG) |
| 348 | DEFINEFUNC2(X509_EXTENSION *, X509_get_ext, X509 *a, a, int b, b, return nullptr, return) |
| 349 | DEFINEFUNC(int, X509_get_ext_count, X509 *a, a, return 0, return) |
| 350 | DEFINEFUNC4(void *, X509_get_ext_d2i, X509 *a, a, int b, b, int *c, c, int *d, d, return nullptr, return) |
| 351 | DEFINEFUNC(const X509V3_EXT_METHOD *, X509V3_EXT_get, X509_EXTENSION *a, a, return nullptr, return) |
| 352 | DEFINEFUNC(void *, X509V3_EXT_d2i, X509_EXTENSION *a, a, return nullptr, return) |
| 353 | DEFINEFUNC(int, X509_EXTENSION_get_critical, X509_EXTENSION *a, a, return 0, return) |
| 354 | DEFINEFUNC(ASN1_OCTET_STRING *, X509_EXTENSION_get_data, X509_EXTENSION *a, a, return nullptr, return) |
| 355 | DEFINEFUNC(void, BASIC_CONSTRAINTS_free, BASIC_CONSTRAINTS *a, a, return, DUMMYARG) |
| 356 | DEFINEFUNC(void, AUTHORITY_KEYID_free, AUTHORITY_KEYID *a, a, return, DUMMYARG) |
| 357 | DEFINEFUNC(void, GENERAL_NAME_free, GENERAL_NAME *a, a, return, DUMMYARG) |
| 358 | DEFINEFUNC2(int, ASN1_STRING_print, BIO *a, a, const ASN1_STRING *b, b, return 0, return) |
| 359 | DEFINEFUNC2(int, X509_check_issued, X509 *a, a, X509 *b, b, return -1, return) |
| 360 | DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return nullptr, return) |
| 361 | DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return nullptr, return) |
| 362 | DEFINEFUNC(ASN1_INTEGER *, X509_get_serialNumber, X509 *a, a, return nullptr, return) |
| 363 | DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return) |
| 364 | DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return) |
| 365 | DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return nullptr, return) |
| 366 | DEFINEFUNC(ASN1_STRING *, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY *a, a, return nullptr, return) |
| 367 | DEFINEFUNC(ASN1_OBJECT *, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY *a, a, return nullptr, return) |
| 368 | DEFINEFUNC(EVP_PKEY *, X509_PUBKEY_get, X509_PUBKEY *a, a, return nullptr, return) |
| 369 | DEFINEFUNC(void, X509_STORE_free, X509_STORE *a, a, return, DUMMYARG) |
| 370 | DEFINEFUNC(X509_STORE *, X509_STORE_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 371 | DEFINEFUNC2(int, X509_STORE_add_cert, X509_STORE *a, a, X509 *b, b, return 0, return) |
| 372 | DEFINEFUNC(void, X509_STORE_CTX_free, X509_STORE_CTX *a, a, return, DUMMYARG) |
| 373 | DEFINEFUNC4(int, X509_STORE_CTX_init, X509_STORE_CTX *a, a, X509_STORE *b, b, X509 *c, c, STACK_OF(X509) *d, d, return -1, return) |
| 374 | DEFINEFUNC2(int, X509_STORE_CTX_set_purpose, X509_STORE_CTX *a, a, int b, b, return -1, return) |
| 375 | DEFINEFUNC(int, X509_STORE_CTX_get_error, X509_STORE_CTX *a, a, return -1, return) |
| 376 | DEFINEFUNC(int, X509_STORE_CTX_get_error_depth, X509_STORE_CTX *a, a, return -1, return) |
| 377 | DEFINEFUNC(X509 *, X509_STORE_CTX_get_current_cert, X509_STORE_CTX *a, a, return nullptr, return) |
| 378 | DEFINEFUNC(X509_STORE *, X509_STORE_CTX_get0_store, X509_STORE_CTX *ctx, ctx, return nullptr, return) |
| 379 | DEFINEFUNC(X509_STORE_CTX *, X509_STORE_CTX_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 380 | DEFINEFUNC2(void *, X509_STORE_CTX_get_ex_data, X509_STORE_CTX *ctx, ctx, int idx, idx, return nullptr, return) |
| 381 | DEFINEFUNC(int, SSL_get_ex_data_X509_STORE_CTX_idx, DUMMYARG, DUMMYARG, return -1, return) |
| 382 | |
| 383 | #if OPENSSL_VERSION_MAJOR < 3 |
| 384 | DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return) |
| 385 | #else |
| 386 | DEFINEFUNC2(int, SSL_CTX_load_verify_dir, SSL_CTX *ctx, ctx, const char *CApath, CApath, return 0, return) |
| 387 | #endif // OPENSSL_VERSION_MAJOR |
| 388 | |
| 389 | DEFINEFUNC2(int, i2d_SSL_SESSION, SSL_SESSION *in, in, unsigned char **pp, pp, return 0, return) |
| 390 | DEFINEFUNC3(SSL_SESSION *, d2i_SSL_SESSION, SSL_SESSION **a, a, const unsigned char **pp, pp, long length, length, return nullptr, return) |
| 391 | |
| 392 | #ifndef OPENSSL_NO_NEXTPROTONEG |
| 393 | DEFINEFUNC6(int, SSL_select_next_proto, unsigned char **out, out, unsigned char *outlen, outlen, |
| 394 | const unsigned char *in, in, unsigned int inlen, inlen, |
| 395 | const unsigned char *client, client, unsigned int client_len, client_len, |
| 396 | return -1, return) |
| 397 | DEFINEFUNC3(void, SSL_CTX_set_next_proto_select_cb, SSL_CTX *s, s, |
| 398 | int (*cb) (SSL *ssl, unsigned char **out, |
| 399 | unsigned char *outlen, |
| 400 | const unsigned char *in, |
| 401 | unsigned int inlen, void *arg), cb, |
| 402 | void *arg, arg, return, DUMMYARG) |
| 403 | DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s, |
| 404 | const unsigned char **data, data, unsigned *len, len, return, DUMMYARG) |
| 405 | DEFINEFUNC3(int, SSL_set_alpn_protos, SSL *s, s, const unsigned char *protos, protos, |
| 406 | unsigned protos_len, protos_len, return -1, return) |
| 407 | DEFINEFUNC3(void, SSL_CTX_set_alpn_select_cb, SSL_CTX *s, s, |
| 408 | int (*cb) (SSL *ssl, const unsigned char **out, |
| 409 | unsigned char *outlen, |
| 410 | const unsigned char *in, |
| 411 | unsigned int inlen, void *arg), cb, |
| 412 | void *arg, arg, return, DUMMYARG) |
| 413 | DEFINEFUNC3(void, SSL_get0_alpn_selected, const SSL *s, s, const unsigned char **data, data, |
| 414 | unsigned *len, len, return, DUMMYARG) |
| 415 | #endif // !OPENSSL_NO_NEXTPROTONEG |
| 416 | |
| 417 | // DTLS: |
| 418 | #if QT_CONFIG(dtls) |
| 419 | DEFINEFUNC2(void, SSL_CTX_set_cookie_generate_cb, SSL_CTX *ctx, ctx, CookieGenerateCallback cb, cb, return, DUMMYARG) |
| 420 | DEFINEFUNC2(void, SSL_CTX_set_cookie_verify_cb, SSL_CTX *ctx, ctx, CookieVerifyCallback cb, cb, return, DUMMYARG) |
| 421 | DEFINEFUNC(const SSL_METHOD *, DTLS_server_method, DUMMYARG, DUMMYARG, return nullptr, return) |
| 422 | DEFINEFUNC(const SSL_METHOD *, DTLS_client_method, DUMMYARG, DUMMYARG, return nullptr, return) |
| 423 | #endif // dtls |
| 424 | DEFINEFUNC2(void, BIO_set_flags, BIO *b, b, int flags, flags, return, DUMMYARG) |
| 425 | DEFINEFUNC2(void, BIO_clear_flags, BIO *b, b, int flags, flags, return, DUMMYARG) |
| 426 | DEFINEFUNC2(void *, BIO_get_ex_data, BIO *b, b, int idx, idx, return nullptr, return) |
| 427 | DEFINEFUNC3(int, BIO_set_ex_data, BIO *b, b, int idx, idx, void *data, data, return -1, return) |
| 428 | |
| 429 | DEFINEFUNC3(void *, CRYPTO_malloc, size_t num, num, const char *file, file, int line, line, return nullptr, return) |
| 430 | |
| 431 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 432 | DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 433 | DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG) |
| 434 | DEFINEFUNC2(int, DH_check, DH *dh, dh, int *codes, codes, return 0, return) |
| 435 | DEFINEFUNC4(void, DH_get0_pqg, const DH *dh, dh, const BIGNUM **p, p, const BIGNUM **q, q, const BIGNUM **g, g, return, DUMMYARG) |
| 436 | |
| 437 | DEFINEFUNC3(DH *, d2i_DHparams, DH**a, a, const unsigned char **pp, pp, long length, length, return nullptr, return) |
| 438 | DEFINEFUNC2(int, i2d_DHparams, DH *a, a, unsigned char **p, p, return -1, return) |
| 439 | |
| 440 | DEFINEFUNC4(DH *, PEM_read_bio_DHparams, BIO *a, a, DH **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 441 | #endif |
| 442 | DEFINEFUNC3(BIGNUM *, BN_bin2bn, const unsigned char *s, s, int len, len, BIGNUM *ret, ret, return nullptr, return) |
| 443 | |
| 444 | |
| 445 | #ifndef OPENSSL_NO_EC |
| 446 | DEFINEFUNC2(size_t, EC_get_builtin_curves, EC_builtin_curve * r, r, size_t nitems, nitems, return 0, return) |
| 447 | DEFINEFUNC(int, EC_curve_nist2nid, const char *name, name, return 0, return) |
| 448 | #endif // OPENSSL_NO_EC |
| 449 | |
| 450 | DEFINEFUNC5(int, PKCS12_parse, PKCS12 *p12, p12, const char *pass, pass, EVP_PKEY **pkey, pkey, \ |
| 451 | X509 **cert, cert, STACK_OF(X509) **ca, ca, return 1, return); |
| 452 | DEFINEFUNC2(PKCS12 *, d2i_PKCS12_bio, BIO *bio, bio, PKCS12 **pkcs12, pkcs12, return nullptr, return); |
| 453 | DEFINEFUNC(void, PKCS12_free, PKCS12 *pkcs12, pkcs12, return, DUMMYARG) |
| 454 | |
| 455 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 456 | |
| 457 | DEFINEFUNC4(DSA *, PEM_read_bio_DSA_PUBKEY, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 458 | DEFINEFUNC4(RSA *, PEM_read_bio_RSA_PUBKEY, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 459 | DEFINEFUNC4(DSA *, PEM_read_bio_DSAPrivateKey, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 460 | DEFINEFUNC4(RSA *, PEM_read_bio_RSAPrivateKey, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 461 | |
| 462 | DEFINEFUNC2(int, PEM_write_bio_DSA_PUBKEY, BIO *a, a, DSA *b, b, return 0, return) |
| 463 | DEFINEFUNC2(int, PEM_write_bio_RSA_PUBKEY, BIO *a, a, RSA *b, b, return 0, return) |
| 464 | DEFINEFUNC7(int, PEM_write_bio_DSAPrivateKey, BIO *a, a, DSA *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) |
| 465 | DEFINEFUNC7(int, PEM_write_bio_RSAPrivateKey, BIO *a, a, RSA *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) |
| 466 | |
| 467 | DEFINEFUNC2(int, SSL_CTX_use_RSAPrivateKey, SSL_CTX *a, a, RSA *b, b, return -1, return) |
| 468 | |
| 469 | DEFINEFUNC(DSA *, DSA_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 470 | DEFINEFUNC(void, DSA_free, DSA *a, a, return, DUMMYARG) |
| 471 | |
| 472 | DEFINEFUNC(RSA *, RSA_new, DUMMYARG, DUMMYARG, return nullptr, return) |
| 473 | DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG) |
| 474 | |
| 475 | DEFINEFUNC(int, RSA_bits, RSA *a, a, return 0, return) |
| 476 | DEFINEFUNC(int, DSA_bits, DSA *a, a, return 0, return) |
| 477 | DEFINEFUNC(int, DH_bits, DH *dh, dh, return 0, return) |
| 478 | |
| 479 | DEFINEFUNC(DSA *, EVP_PKEY_get1_DSA, EVP_PKEY *a, a, return nullptr, return) |
| 480 | DEFINEFUNC(RSA *, EVP_PKEY_get1_RSA, EVP_PKEY *a, a, return nullptr, return) |
| 481 | DEFINEFUNC(DH *, EVP_PKEY_get1_DH, EVP_PKEY *a, a, return nullptr, return) |
| 482 | |
| 483 | DEFINEFUNC2(int, EVP_PKEY_cmp, const EVP_PKEY *a, a, const EVP_PKEY *b, b, return -1, return) |
| 484 | DEFINEFUNC3(int, EVP_PKEY_assign, EVP_PKEY *a, a, int b, b, void *r, r, return -1, return) |
| 485 | |
| 486 | DEFINEFUNC2(int, EVP_PKEY_set1_RSA, EVP_PKEY *a, a, RSA *b, b, return -1, return) |
| 487 | DEFINEFUNC2(int, EVP_PKEY_set1_DSA, EVP_PKEY *a, a, DSA *b, b, return -1, return) |
| 488 | DEFINEFUNC2(int, EVP_PKEY_set1_DH, EVP_PKEY *a, a, DH *b, b, return -1, return) |
| 489 | |
| 490 | #ifndef OPENSSL_NO_EC |
| 491 | |
| 492 | DEFINEFUNC4(EC_KEY *, PEM_read_bio_EC_PUBKEY, BIO *a, a, EC_KEY **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 493 | DEFINEFUNC4(EC_KEY *, PEM_read_bio_ECPrivateKey, BIO *a, a, EC_KEY **b, b, pem_password_cb *c, c, void *d, d, return nullptr, return) |
| 494 | |
| 495 | DEFINEFUNC2(int, PEM_write_bio_EC_PUBKEY, BIO *a, a, EC_KEY *b, b, return 0, return) |
| 496 | DEFINEFUNC7(int, PEM_write_bio_ECPrivateKey, BIO *a, a, EC_KEY *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return) |
| 497 | |
| 498 | DEFINEFUNC(const EC_GROUP*, EC_KEY_get0_group, const EC_KEY* k, k, return nullptr, return) |
| 499 | DEFINEFUNC(int, EC_GROUP_get_degree, const EC_GROUP* g, g, return 0, return) |
| 500 | |
| 501 | DEFINEFUNC2(int, EVP_PKEY_set1_EC_KEY, EVP_PKEY *a, a, EC_KEY *b, b, return -1, return) |
| 502 | DEFINEFUNC(EC_KEY *, EVP_PKEY_get1_EC_KEY, EVP_PKEY *a, a, return nullptr, return) |
| 503 | |
| 504 | DEFINEFUNC(EC_KEY *, EC_KEY_dup, const EC_KEY *ec, ec, return nullptr, return) |
| 505 | DEFINEFUNC(EC_KEY *, EC_KEY_new_by_curve_name, int nid, nid, return nullptr, return) |
| 506 | DEFINEFUNC(void, EC_KEY_free, EC_KEY *ecdh, ecdh, return, DUMMYARG) |
| 507 | |
| 508 | #endif // OPENSSL_NO_EC |
| 509 | |
| 510 | |
| 511 | |
| 512 | #endif |
| 513 | |
| 514 | #define RESOLVEFUNC(func) \ |
| 515 | if (!(_q_##func = _q_PTR_##func(libs.ssl->resolve(#func))) \ |
| 516 | && !(_q_##func = _q_PTR_##func(libs.crypto->resolve(#func)))) \ |
| 517 | qsslSocketCannotResolveSymbolWarning(#func); |
| 518 | |
| 519 | #if !defined QT_LINKED_OPENSSL |
| 520 | |
| 521 | #if !QT_CONFIG(library) |
| 522 | bool q_resolveOpenSslSymbols() |
| 523 | { |
| 524 | qCWarning(lcTlsBackend, "QSslSocket: unable to resolve symbols. Qt is configured without the " |
| 525 | "'library' feature, which means runtime resolving of libraries won't work." ); |
| 526 | qCWarning(lcTlsBackend, "Either compile Qt statically or with support for runtime resolving " |
| 527 | "of libraries." ); |
| 528 | return false; |
| 529 | } |
| 530 | #else |
| 531 | |
| 532 | # ifdef Q_OS_UNIX |
| 533 | struct NumericallyLess |
| 534 | { |
| 535 | typedef bool result_type; |
| 536 | result_type operator()(QStringView lhs, QStringView rhs) const |
| 537 | { |
| 538 | bool ok = false; |
| 539 | int b = 0; |
| 540 | int a = lhs.toInt(ok: &ok); |
| 541 | if (ok) |
| 542 | b = rhs.toInt(ok: &ok); |
| 543 | if (ok) { |
| 544 | // both toInt succeeded |
| 545 | return a < b; |
| 546 | } else { |
| 547 | // compare as strings; |
| 548 | return lhs < rhs; |
| 549 | } |
| 550 | } |
| 551 | }; |
| 552 | |
| 553 | struct LibGreaterThan |
| 554 | { |
| 555 | typedef bool result_type; |
| 556 | result_type operator()(QStringView lhs, QStringView rhs) const |
| 557 | { |
| 558 | const auto lhsparts = lhs.split(sep: u'.'); |
| 559 | const auto rhsparts = rhs.split(sep: u'.'); |
| 560 | Q_ASSERT(lhsparts.size() > 1 && rhsparts.size() > 1); |
| 561 | |
| 562 | // note: checking rhs < lhs, the same as lhs > rhs |
| 563 | return std::lexicographical_compare(first1: rhsparts.begin() + 1, last1: rhsparts.end(), |
| 564 | first2: lhsparts.begin() + 1, last2: lhsparts.end(), |
| 565 | comp: NumericallyLess()); |
| 566 | } |
| 567 | }; |
| 568 | |
| 569 | #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) |
| 570 | static int dlIterateCallback(struct dl_phdr_info *info, size_t size, void *data) |
| 571 | { |
| 572 | if (size < sizeof (info->dlpi_addr) + sizeof (info->dlpi_name)) |
| 573 | return 1; |
| 574 | QDuplicateTracker<QString> *paths = (QDuplicateTracker<QString> *)data; |
| 575 | QString path = QString::fromLocal8Bit(ba: info->dlpi_name); |
| 576 | if (!path.isEmpty()) { |
| 577 | QFileInfo fi(path); |
| 578 | path = fi.absolutePath(); |
| 579 | if (!path.isEmpty()) |
| 580 | (void)paths->hasSeen(s: std::move(path)); |
| 581 | } |
| 582 | return 0; |
| 583 | } |
| 584 | #endif |
| 585 | |
| 586 | static QStringList libraryPathList() |
| 587 | { |
| 588 | QStringList paths; |
| 589 | # ifdef Q_OS_DARWIN |
| 590 | paths = QString::fromLatin1(qgetenv("DYLD_LIBRARY_PATH" )).split(u':', Qt::SkipEmptyParts); |
| 591 | |
| 592 | // search in .app/Contents/Frameworks |
| 593 | UInt32 packageType; |
| 594 | CFBundleGetPackageInfo(CFBundleGetMainBundle(), &packageType, nullptr); |
| 595 | if (packageType == FOUR_CHAR_CODE('APPL')) { |
| 596 | QUrl bundleUrl = QUrl::fromCFURL(QCFType<CFURLRef>(CFBundleCopyBundleURL(CFBundleGetMainBundle()))); |
| 597 | QUrl frameworksUrl = QUrl::fromCFURL(QCFType<CFURLRef>(CFBundleCopyPrivateFrameworksURL(CFBundleGetMainBundle()))); |
| 598 | paths << bundleUrl.resolved(frameworksUrl).path(); |
| 599 | } |
| 600 | # else |
| 601 | paths = QString::fromLatin1(ba: qgetenv(varName: "LD_LIBRARY_PATH" )).split(sep: u':', behavior: Qt::SkipEmptyParts); |
| 602 | # endif |
| 603 | paths << "/lib"_L1 << "/usr/lib"_L1 << "/usr/local/lib"_L1 ; |
| 604 | paths << "/lib64"_L1 << "/usr/lib64"_L1 << "/usr/local/lib64"_L1 ; |
| 605 | paths << "/lib32"_L1 << "/usr/lib32"_L1 << "/usr/local/lib32"_L1 ; |
| 606 | |
| 607 | #if defined(Q_OS_ANDROID) |
| 608 | paths << "/system/lib"_L1 ; |
| 609 | #elif defined(Q_OS_LINUX) |
| 610 | // discover paths of already loaded libraries |
| 611 | QDuplicateTracker<QString> loadedPaths; |
| 612 | dl_iterate_phdr(callback: dlIterateCallback, data: &loadedPaths); |
| 613 | std::move(loadedPaths).appendTo(c&: paths); |
| 614 | #endif |
| 615 | |
| 616 | return paths; |
| 617 | } |
| 618 | |
| 619 | Q_NEVER_INLINE |
| 620 | static QStringList findAllLibs(QLatin1StringView filter) |
| 621 | { |
| 622 | const QStringList paths = libraryPathList(); |
| 623 | QStringList found; |
| 624 | const QStringList filters((QString(filter))); |
| 625 | |
| 626 | for (const QString &path : paths) { |
| 627 | QDir dir(path); |
| 628 | QStringList entryList = dir.entryList(nameFilters: filters, filters: QDir::Files); |
| 629 | |
| 630 | std::sort(first: entryList.begin(), last: entryList.end(), comp: LibGreaterThan()); |
| 631 | for (const QString &entry : std::as_const(t&: entryList)) |
| 632 | found << path + u'/' + entry; |
| 633 | } |
| 634 | |
| 635 | return found; |
| 636 | } |
| 637 | |
| 638 | static QStringList findAllLibSsl() |
| 639 | { |
| 640 | return findAllLibs(filter: "libssl.*"_L1 ); |
| 641 | } |
| 642 | |
| 643 | static QStringList findAllLibCrypto() |
| 644 | { |
| 645 | return findAllLibs(filter: "libcrypto.*"_L1 ); |
| 646 | } |
| 647 | # endif |
| 648 | |
| 649 | #if (OPENSSL_VERSION_NUMBER >> 28) < 3 |
| 650 | #define QT_OPENSSL_VERSION "1_1" |
| 651 | #elif OPENSSL_VERSION_MAJOR == 3 // Starting with 3.0 this define is available |
| 652 | #define QT_OPENSSL_VERSION "3" |
| 653 | #endif // > 3 intentionally left undefined |
| 654 | |
| 655 | #ifdef Q_OS_WIN |
| 656 | |
| 657 | struct LoadedOpenSsl { |
| 658 | std::unique_ptr<QSystemLibrary> ssl, crypto; |
| 659 | }; |
| 660 | |
| 661 | static bool tryToLoadOpenSslWin32Library(QLatin1StringView ssleay32LibName, QLatin1StringView libeay32LibName, LoadedOpenSsl &result) |
| 662 | { |
| 663 | auto ssleay32 = std::make_unique<QSystemLibrary>(ssleay32LibName); |
| 664 | if (!ssleay32->load(false)) { |
| 665 | return FALSE; |
| 666 | } |
| 667 | |
| 668 | auto libeay32 = std::make_unique<QSystemLibrary>(libeay32LibName); |
| 669 | if (!libeay32->load(false)) { |
| 670 | return FALSE; |
| 671 | } |
| 672 | |
| 673 | result.ssl = std::move(ssleay32); |
| 674 | result.crypto = std::move(libeay32); |
| 675 | return TRUE; |
| 676 | } |
| 677 | |
| 678 | static LoadedOpenSsl loadOpenSsl() |
| 679 | { |
| 680 | LoadedOpenSsl result; |
| 681 | |
| 682 | // With OpenSSL 1.1 the names have changed to libssl-1_1 and libcrypto-1_1 for builds using |
| 683 | // MSVC and GCC. For 3.0 the version suffix changed again, to just '3'. |
| 684 | // For non-x86 builds, an architecture suffix is also appended. |
| 685 | |
| 686 | #if defined(Q_PROCESSOR_X86_64) |
| 687 | #define QT_SSL_SUFFIX "-x64" |
| 688 | #elif defined(Q_PROCESSOR_ARM_64) |
| 689 | #define QT_SSL_SUFFIX "-arm64" |
| 690 | #elif defined(Q_PROCESSOR_ARM_32) |
| 691 | #define QT_SSL_SUFFIX "-arm" |
| 692 | #else |
| 693 | #define QT_SSL_SUFFIX |
| 694 | #endif |
| 695 | |
| 696 | tryToLoadOpenSslWin32Library("libssl-" QT_OPENSSL_VERSION QT_SSL_SUFFIX ""_L1 , |
| 697 | "libcrypto-" QT_OPENSSL_VERSION QT_SSL_SUFFIX ""_L1 , result); |
| 698 | |
| 699 | #undef QT_SSL_SUFFIX |
| 700 | return result; |
| 701 | } |
| 702 | #else // !Q_OS_WIN: |
| 703 | |
| 704 | struct LoadedOpenSsl { |
| 705 | std::unique_ptr<QLibrary> ssl, crypto; |
| 706 | }; |
| 707 | |
| 708 | static LoadedOpenSsl loadOpenSsl() |
| 709 | { |
| 710 | LoadedOpenSsl result = { .ssl: std::make_unique<QLibrary>(), .crypto: std::make_unique<QLibrary>() }; |
| 711 | |
| 712 | # if defined(Q_OS_UNIX) |
| 713 | QLibrary * const libssl = result.ssl.get(); |
| 714 | QLibrary * const libcrypto = result.crypto.get(); |
| 715 | |
| 716 | // Try to find the libssl library on the system. |
| 717 | // |
| 718 | // Up until Qt 4.3, this only searched for the "ssl" library at version -1, that |
| 719 | // is, libssl.so on most Unix systems. However, the .so file isn't present in |
| 720 | // user installations because it's considered a development file. |
| 721 | // |
| 722 | // The right thing to do is to load the library at the major version we know how |
| 723 | // to work with: the SHLIB_VERSION_NUMBER version (macro defined in opensslv.h) |
| 724 | // |
| 725 | // However, OpenSSL is a well-known case of binary-compatibility breakage. To |
| 726 | // avoid such problems, many system integrators and Linux distributions change |
| 727 | // the soname of the binary, letting the full version number be the soname. So |
| 728 | // we'll find libssl.so.0.9.7, libssl.so.0.9.8, etc. in the system. For that |
| 729 | // reason, we will search a few common paths (see findAllLibSsl() above) in hopes |
| 730 | // we find one that works. |
| 731 | // |
| 732 | // If that fails, for OpenSSL 1.0 we also try some fallbacks -- look up |
| 733 | // libssl.so with a hardcoded soname. The reason is QTBUG-68156: the binary |
| 734 | // builds of Qt happen (at the time of this writing) on RHEL machines, |
| 735 | // which change SHLIB_VERSION_NUMBER to a non-portable string. When running |
| 736 | // those binaries on the target systems, this code won't pick up |
| 737 | // libssl.so.MODIFIED_SHLIB_VERSION_NUMBER because it doesn't exist there. |
| 738 | // Given that the only 1.0 supported release (at the time of this writing) |
| 739 | // is 1.0.2, with soname "1.0.0", give that a try too. Note that we mandate |
| 740 | // OpenSSL >= 1.0.0 with a configure-time check, and OpenSSL has kept binary |
| 741 | // compatibility between 1.0.0 and 1.0.2. |
| 742 | // |
| 743 | // It is important, however, to try the canonical name and the unversioned name |
| 744 | // without going through the loop. By not specifying a path, we let the system |
| 745 | // dlopen(3) function determine it for us. This will include any DT_RUNPATH or |
| 746 | // DT_RPATH tags on our library header as well as other system-specific search |
| 747 | // paths. See the man page for dlopen(3) on your system for more information. |
| 748 | |
| 749 | #ifdef Q_OS_OPENBSD |
| 750 | libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint); |
| 751 | #endif |
| 752 | |
| 753 | #if !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so |
| 754 | |
| 755 | #if defined(OPENSSL_SHLIB_VERSION) |
| 756 | // OpenSSL v.3 does not have SLIB_VERSION_NUMBER but has OPENSSL_SHLIB_VERSION. |
| 757 | // The comment about OPENSSL_SHLIB_VERSION in opensslv.h is a bit troublesome: |
| 758 | // "This is defined in free form." |
| 759 | auto shlibVersion = QString("%1"_L1 ).arg(OPENSSL_SHLIB_VERSION); |
| 760 | libssl->setFileNameAndVersion(fileName: "ssl"_L1 , version: shlibVersion); |
| 761 | libcrypto->setFileNameAndVersion(fileName: "crypto"_L1 , version: shlibVersion); |
| 762 | #elif defined(SHLIB_VERSION_NUMBER) |
| 763 | // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER> |
| 764 | libssl->setFileNameAndVersion("ssl"_L1 , SHLIB_VERSION_NUMBER ""_L1 ); |
| 765 | libcrypto->setFileNameAndVersion("crypto"_L1 , SHLIB_VERSION_NUMBER ""_L1 ); |
| 766 | #endif // OPENSSL_SHLIB_VERSION |
| 767 | |
| 768 | if (libcrypto->load() && libssl->load()) { |
| 769 | // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found |
| 770 | return result; |
| 771 | } else { |
| 772 | libssl->unload(); |
| 773 | libcrypto->unload(); |
| 774 | } |
| 775 | #endif // !defined(Q_OS_QNX) |
| 776 | |
| 777 | #ifndef Q_OS_DARWIN |
| 778 | // second attempt: find the development files libssl.so and libcrypto.so |
| 779 | // |
| 780 | // disabled on macOS/iOS: |
| 781 | // macOS's /usr/lib/libssl.dylib, /usr/lib/libcrypto.dylib will be picked up in the third |
| 782 | // attempt, _after_ <bundle>/Contents/Frameworks has been searched. |
| 783 | // iOS does not ship a system libssl.dylib, libcrypto.dylib in the first place. |
| 784 | # if defined(Q_OS_ANDROID) |
| 785 | // OpenSSL 1.1.x must be suffixed otherwise it will use the system libcrypto.so libssl.so which on API-21 are OpenSSL 1.0 not 1.1 |
| 786 | auto openSSLSuffix = [](const QByteArray &defaultSuffix = {}) { |
| 787 | auto suffix = qgetenv("ANDROID_OPENSSL_SUFFIX" ); |
| 788 | if (suffix.isEmpty()) |
| 789 | return defaultSuffix; |
| 790 | return suffix; |
| 791 | }; |
| 792 | |
| 793 | static QString suffix = QString::fromLatin1(openSSLSuffix("_" QT_OPENSSL_VERSION)); |
| 794 | |
| 795 | libssl->setFileNameAndVersion("ssl"_L1 + suffix, -1); |
| 796 | libcrypto->setFileNameAndVersion("crypto"_L1 + suffix, -1); |
| 797 | # else |
| 798 | libssl->setFileNameAndVersion(fileName: "ssl"_L1 , verNum: -1); |
| 799 | libcrypto->setFileNameAndVersion(fileName: "crypto"_L1 , verNum: -1); |
| 800 | # endif |
| 801 | if (libcrypto->load() && libssl->load()) { |
| 802 | // libssl.so.0 and libcrypto.so.0 found |
| 803 | return result; |
| 804 | } else { |
| 805 | libssl->unload(); |
| 806 | libcrypto->unload(); |
| 807 | } |
| 808 | #endif |
| 809 | |
| 810 | // third attempt: loop on the most common library paths and find libssl |
| 811 | const QStringList sslList = findAllLibSsl(); |
| 812 | const QStringList cryptoList = findAllLibCrypto(); |
| 813 | |
| 814 | for (const QString &crypto : cryptoList) { |
| 815 | #ifdef Q_OS_DARWIN |
| 816 | // Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI |
| 817 | if (crypto.endsWith("libcrypto.dylib" )) |
| 818 | continue; |
| 819 | #endif |
| 820 | libcrypto->setFileNameAndVersion(fileName: crypto, verNum: -1); |
| 821 | if (libcrypto->load()) { |
| 822 | QFileInfo fi(crypto); |
| 823 | QString version = fi.completeSuffix(); |
| 824 | |
| 825 | for (const QString &ssl : sslList) { |
| 826 | if (!ssl.endsWith(s: version)) |
| 827 | continue; |
| 828 | |
| 829 | libssl->setFileNameAndVersion(fileName: ssl, verNum: -1); |
| 830 | |
| 831 | if (libssl->load()) { |
| 832 | // libssl.so.x and libcrypto.so.x found |
| 833 | return result; |
| 834 | } else { |
| 835 | libssl->unload(); |
| 836 | } |
| 837 | } |
| 838 | } |
| 839 | libcrypto->unload(); |
| 840 | } |
| 841 | |
| 842 | // failed to load anything |
| 843 | result = {}; |
| 844 | return result; |
| 845 | |
| 846 | # else |
| 847 | // not implemented for this platform yet |
| 848 | return result; |
| 849 | # endif |
| 850 | } |
| 851 | #endif |
| 852 | |
| 853 | bool q_resolveOpenSslSymbols() |
| 854 | { |
| 855 | static bool symbolsResolved = []() { |
| 856 | LoadedOpenSsl libs = loadOpenSsl(); |
| 857 | if (!libs.ssl || !libs.crypto) { |
| 858 | qCWarning(lcTlsBackend, "Failed to load libssl/libcrypto." ); |
| 859 | return false; |
| 860 | } |
| 861 | |
| 862 | RESOLVEFUNC(OPENSSL_init_ssl) |
| 863 | RESOLVEFUNC(OPENSSL_init_crypto) |
| 864 | RESOLVEFUNC(ASN1_STRING_get0_data) |
| 865 | RESOLVEFUNC(EVP_CIPHER_CTX_reset) |
| 866 | RESOLVEFUNC(AUTHORITY_INFO_ACCESS_free) |
| 867 | RESOLVEFUNC(EVP_PKEY_up_ref) |
| 868 | RESOLVEFUNC(EVP_PKEY_CTX_new) |
| 869 | RESOLVEFUNC(EVP_PKEY_param_check) |
| 870 | RESOLVEFUNC(EVP_PKEY_CTX_free) |
| 871 | RESOLVEFUNC(OPENSSL_sk_new_null) |
| 872 | RESOLVEFUNC(OPENSSL_sk_push) |
| 873 | RESOLVEFUNC(OPENSSL_sk_free) |
| 874 | RESOLVEFUNC(OPENSSL_sk_num) |
| 875 | RESOLVEFUNC(OPENSSL_sk_pop_free) |
| 876 | RESOLVEFUNC(OPENSSL_sk_value) |
| 877 | RESOLVEFUNC(SSL_CTX_set_options) |
| 878 | RESOLVEFUNC(SSL_set_info_callback) |
| 879 | RESOLVEFUNC(SSL_alert_type_string) |
| 880 | RESOLVEFUNC(SSL_alert_desc_string_long) |
| 881 | RESOLVEFUNC(SSL_CTX_get_security_level) |
| 882 | RESOLVEFUNC(SSL_CTX_set_security_level) |
| 883 | #ifdef TLS1_3_VERSION |
| 884 | RESOLVEFUNC(SSL_CTX_set_ciphersuites) |
| 885 | RESOLVEFUNC(SSL_set_psk_use_session_callback) |
| 886 | RESOLVEFUNC(SSL_CTX_sess_set_new_cb) |
| 887 | RESOLVEFUNC(SSL_SESSION_is_resumable) |
| 888 | #endif // TLS 1.3 or OpenSSL > 1.1.1 |
| 889 | |
| 890 | RESOLVEFUNC(SSL_get_client_random) |
| 891 | RESOLVEFUNC(SSL_SESSION_get_master_key) |
| 892 | RESOLVEFUNC(SSL_session_reused) |
| 893 | RESOLVEFUNC(SSL_get_session) |
| 894 | RESOLVEFUNC(SSL_set_options) |
| 895 | RESOLVEFUNC(CRYPTO_get_ex_new_index) |
| 896 | RESOLVEFUNC(TLS_method) |
| 897 | RESOLVEFUNC(TLS_client_method) |
| 898 | RESOLVEFUNC(TLS_server_method) |
| 899 | RESOLVEFUNC(X509_up_ref) |
| 900 | RESOLVEFUNC(X509_STORE_CTX_get0_chain) |
| 901 | RESOLVEFUNC(X509_getm_notBefore) |
| 902 | RESOLVEFUNC(X509_getm_notAfter) |
| 903 | RESOLVEFUNC(ASN1_item_free) |
| 904 | RESOLVEFUNC(X509V3_conf_free) |
| 905 | RESOLVEFUNC(X509_get_version) |
| 906 | RESOLVEFUNC(X509_get_pubkey) |
| 907 | RESOLVEFUNC(X509_STORE_set_verify_cb) |
| 908 | RESOLVEFUNC(X509_STORE_set_ex_data) |
| 909 | RESOLVEFUNC(X509_STORE_get_ex_data) |
| 910 | RESOLVEFUNC(CRYPTO_free) |
| 911 | RESOLVEFUNC(CRYPTO_memcmp) |
| 912 | RESOLVEFUNC(OpenSSL_version_num) |
| 913 | RESOLVEFUNC(OpenSSL_version) |
| 914 | |
| 915 | if (!_q_OpenSSL_version || !_q_OpenSSL_version_num) { |
| 916 | // Apparently, we were built with OpenSSL 1.1 enabled but are now using |
| 917 | // a wrong library. |
| 918 | qCWarning(lcTlsBackend, "Incompatible version of OpenSSL" ); |
| 919 | return false; |
| 920 | } |
| 921 | |
| 922 | #if OPENSSL_VERSION_NUMBER >= 0x30000000 |
| 923 | if (q_OpenSSL_version_num() < 0x30000000) { |
| 924 | qCWarning(lcTlsBackend, "Incompatible version of OpenSSL (built with OpenSSL >= 3.x, runtime version is < 3.x)" ); |
| 925 | return false; |
| 926 | } |
| 927 | #else |
| 928 | if (q_OpenSSL_version_num() >= 0x30000000) { |
| 929 | qCWarning(lcTlsBackend, "Incompatible version of OpenSSL (built with OpenSSL 1.x, runtime version is >= 3.x)" ); |
| 930 | return false; |
| 931 | } |
| 932 | #endif // OPENSSL_VERSION_NUMBER |
| 933 | |
| 934 | RESOLVEFUNC(SSL_SESSION_get_ticket_lifetime_hint) |
| 935 | |
| 936 | #if QT_CONFIG(dtls) |
| 937 | RESOLVEFUNC(DTLSv1_listen) |
| 938 | RESOLVEFUNC(BIO_ADDR_new) |
| 939 | RESOLVEFUNC(BIO_ADDR_free) |
| 940 | RESOLVEFUNC(BIO_meth_new) |
| 941 | RESOLVEFUNC(BIO_meth_free) |
| 942 | RESOLVEFUNC(BIO_meth_set_write) |
| 943 | RESOLVEFUNC(BIO_meth_set_read) |
| 944 | RESOLVEFUNC(BIO_meth_set_puts) |
| 945 | RESOLVEFUNC(BIO_meth_set_ctrl) |
| 946 | RESOLVEFUNC(BIO_meth_set_create) |
| 947 | RESOLVEFUNC(BIO_meth_set_destroy) |
| 948 | #endif // dtls |
| 949 | |
| 950 | #if QT_CONFIG(ocsp) |
| 951 | RESOLVEFUNC(OCSP_SINGLERESP_get0_id) |
| 952 | RESOLVEFUNC(d2i_OCSP_RESPONSE) |
| 953 | RESOLVEFUNC(OCSP_RESPONSE_free) |
| 954 | RESOLVEFUNC(OCSP_response_status) |
| 955 | RESOLVEFUNC(OCSP_response_get1_basic) |
| 956 | RESOLVEFUNC(OCSP_BASICRESP_free) |
| 957 | RESOLVEFUNC(OCSP_basic_verify) |
| 958 | RESOLVEFUNC(OCSP_resp_count) |
| 959 | RESOLVEFUNC(OCSP_resp_get0) |
| 960 | RESOLVEFUNC(OCSP_single_get0_status) |
| 961 | RESOLVEFUNC(OCSP_check_validity) |
| 962 | RESOLVEFUNC(OCSP_cert_to_id) |
| 963 | RESOLVEFUNC(OCSP_id_get0_info) |
| 964 | RESOLVEFUNC(OCSP_resp_get0_certs) |
| 965 | RESOLVEFUNC(OCSP_basic_sign) |
| 966 | RESOLVEFUNC(OCSP_response_create) |
| 967 | RESOLVEFUNC(i2d_OCSP_RESPONSE) |
| 968 | RESOLVEFUNC(OCSP_basic_add1_status) |
| 969 | RESOLVEFUNC(OCSP_BASICRESP_new) |
| 970 | RESOLVEFUNC(OCSP_CERTID_free) |
| 971 | RESOLVEFUNC(OCSP_cert_to_id) |
| 972 | RESOLVEFUNC(OCSP_id_cmp) |
| 973 | #endif // ocsp |
| 974 | |
| 975 | RESOLVEFUNC(BIO_set_data) |
| 976 | RESOLVEFUNC(BIO_get_data) |
| 977 | RESOLVEFUNC(BIO_set_init) |
| 978 | RESOLVEFUNC(BIO_get_shutdown) |
| 979 | RESOLVEFUNC(BIO_set_shutdown) |
| 980 | RESOLVEFUNC(ASN1_INTEGER_get) |
| 981 | RESOLVEFUNC(ASN1_INTEGER_cmp) |
| 982 | RESOLVEFUNC(ASN1_STRING_length) |
| 983 | RESOLVEFUNC(ASN1_STRING_to_UTF8) |
| 984 | RESOLVEFUNC(ASN1_TIME_to_tm) |
| 985 | RESOLVEFUNC(BIO_ctrl) |
| 986 | RESOLVEFUNC(BIO_free) |
| 987 | RESOLVEFUNC(BIO_new) |
| 988 | RESOLVEFUNC(BIO_new_mem_buf) |
| 989 | RESOLVEFUNC(BIO_read) |
| 990 | RESOLVEFUNC(BIO_s_mem) |
| 991 | RESOLVEFUNC(BIO_write) |
| 992 | RESOLVEFUNC(BIO_set_flags) |
| 993 | RESOLVEFUNC(BIO_clear_flags) |
| 994 | RESOLVEFUNC(BIO_set_ex_data) |
| 995 | RESOLVEFUNC(BIO_get_ex_data) |
| 996 | RESOLVEFUNC(BN_num_bits) |
| 997 | RESOLVEFUNC(BN_is_word) |
| 998 | RESOLVEFUNC(BN_mod_word) |
| 999 | RESOLVEFUNC(ERR_error_string) |
| 1000 | RESOLVEFUNC(ERR_error_string_n) |
| 1001 | RESOLVEFUNC(ERR_get_error) |
| 1002 | RESOLVEFUNC(EVP_CIPHER_CTX_new) |
| 1003 | RESOLVEFUNC(EVP_CIPHER_CTX_free) |
| 1004 | RESOLVEFUNC(EVP_CIPHER_CTX_ctrl) |
| 1005 | RESOLVEFUNC(EVP_CIPHER_CTX_set_key_length) |
| 1006 | RESOLVEFUNC(EVP_CipherInit) |
| 1007 | RESOLVEFUNC(EVP_CipherInit_ex) |
| 1008 | RESOLVEFUNC(EVP_CipherUpdate) |
| 1009 | RESOLVEFUNC(EVP_CipherFinal) |
| 1010 | RESOLVEFUNC(EVP_get_digestbyname) |
| 1011 | #ifndef OPENSSL_NO_DES |
| 1012 | RESOLVEFUNC(EVP_des_cbc) |
| 1013 | RESOLVEFUNC(EVP_des_ede3_cbc) |
| 1014 | #endif |
| 1015 | #ifndef OPENSSL_NO_RC2 |
| 1016 | RESOLVEFUNC(EVP_rc2_cbc) |
| 1017 | #endif |
| 1018 | #ifndef OPENSSL_NO_AES |
| 1019 | RESOLVEFUNC(EVP_aes_128_cbc) |
| 1020 | RESOLVEFUNC(EVP_aes_192_cbc) |
| 1021 | RESOLVEFUNC(EVP_aes_256_cbc) |
| 1022 | #endif |
| 1023 | RESOLVEFUNC(EVP_sha1) |
| 1024 | RESOLVEFUNC(EVP_PKEY_free) |
| 1025 | RESOLVEFUNC(EVP_PKEY_new) |
| 1026 | RESOLVEFUNC(EVP_PKEY_type) |
| 1027 | RESOLVEFUNC(OBJ_nid2sn) |
| 1028 | RESOLVEFUNC(OBJ_nid2ln) |
| 1029 | RESOLVEFUNC(OBJ_sn2nid) |
| 1030 | RESOLVEFUNC(OBJ_ln2nid) |
| 1031 | RESOLVEFUNC(i2t_ASN1_OBJECT) |
| 1032 | RESOLVEFUNC(OBJ_obj2txt) |
| 1033 | RESOLVEFUNC(OBJ_obj2nid) |
| 1034 | RESOLVEFUNC(PEM_read_bio_PrivateKey) |
| 1035 | RESOLVEFUNC(PEM_write_bio_PrivateKey) |
| 1036 | RESOLVEFUNC(PEM_write_bio_PrivateKey_traditional) |
| 1037 | RESOLVEFUNC(PEM_read_bio_PUBKEY) |
| 1038 | RESOLVEFUNC(PEM_write_bio_PUBKEY) |
| 1039 | RESOLVEFUNC(RAND_seed) |
| 1040 | RESOLVEFUNC(RAND_status) |
| 1041 | RESOLVEFUNC(RAND_bytes) |
| 1042 | RESOLVEFUNC(SSL_CIPHER_description) |
| 1043 | RESOLVEFUNC(SSL_CIPHER_get_bits) |
| 1044 | RESOLVEFUNC(SSL_get_rbio) |
| 1045 | RESOLVEFUNC(SSL_CTX_check_private_key) |
| 1046 | RESOLVEFUNC(SSL_CTX_ctrl) |
| 1047 | RESOLVEFUNC(SSL_CTX_free) |
| 1048 | RESOLVEFUNC(SSL_CTX_new) |
| 1049 | RESOLVEFUNC(SSL_CTX_set_cipher_list) |
| 1050 | RESOLVEFUNC(SSL_CTX_callback_ctrl) |
| 1051 | RESOLVEFUNC(SSL_CTX_set_default_verify_paths) |
| 1052 | RESOLVEFUNC(SSL_CTX_set_verify) |
| 1053 | RESOLVEFUNC(SSL_CTX_set_verify_depth) |
| 1054 | RESOLVEFUNC(SSL_CTX_use_certificate) |
| 1055 | RESOLVEFUNC(SSL_CTX_use_certificate_file) |
| 1056 | RESOLVEFUNC(SSL_CTX_use_PrivateKey) |
| 1057 | RESOLVEFUNC(SSL_CTX_use_PrivateKey_file) |
| 1058 | RESOLVEFUNC(SSL_CTX_get_cert_store); |
| 1059 | RESOLVEFUNC(SSL_CONF_CTX_new); |
| 1060 | RESOLVEFUNC(SSL_CONF_CTX_free); |
| 1061 | RESOLVEFUNC(SSL_CONF_CTX_set_ssl_ctx); |
| 1062 | RESOLVEFUNC(SSL_CONF_CTX_set_flags); |
| 1063 | RESOLVEFUNC(SSL_CONF_CTX_finish); |
| 1064 | RESOLVEFUNC(SSL_CONF_cmd); |
| 1065 | RESOLVEFUNC(SSL_accept) |
| 1066 | RESOLVEFUNC(SSL_clear) |
| 1067 | RESOLVEFUNC(SSL_connect) |
| 1068 | RESOLVEFUNC(SSL_free) |
| 1069 | RESOLVEFUNC(SSL_get_ciphers) |
| 1070 | RESOLVEFUNC(SSL_get_current_cipher) |
| 1071 | RESOLVEFUNC(SSL_version) |
| 1072 | RESOLVEFUNC(SSL_get_error) |
| 1073 | RESOLVEFUNC(SSL_get_peer_cert_chain) |
| 1074 | |
| 1075 | #if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3 |
| 1076 | RESOLVEFUNC(SSL_get1_peer_certificate) |
| 1077 | RESOLVEFUNC(EVP_PKEY_get_bits) |
| 1078 | RESOLVEFUNC(EVP_PKEY_get_base_id) |
| 1079 | #else |
| 1080 | RESOLVEFUNC(SSL_get_peer_certificate) |
| 1081 | RESOLVEFUNC(EVP_PKEY_base_id) |
| 1082 | #endif // OPENSSL_VERSION_MAJOR >= 3 |
| 1083 | |
| 1084 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
| 1085 | RESOLVEFUNC(DH_new) |
| 1086 | RESOLVEFUNC(DH_free) |
| 1087 | RESOLVEFUNC(DH_check) |
| 1088 | RESOLVEFUNC(DH_get0_pqg) |
| 1089 | |
| 1090 | RESOLVEFUNC(d2i_DHparams) |
| 1091 | RESOLVEFUNC(i2d_DHparams) |
| 1092 | |
| 1093 | RESOLVEFUNC(PEM_read_bio_DHparams) |
| 1094 | |
| 1095 | RESOLVEFUNC(EVP_PKEY_assign) |
| 1096 | RESOLVEFUNC(EVP_PKEY_cmp) |
| 1097 | |
| 1098 | RESOLVEFUNC(EVP_PKEY_set1_RSA) |
| 1099 | RESOLVEFUNC(EVP_PKEY_set1_DSA) |
| 1100 | RESOLVEFUNC(EVP_PKEY_set1_DH) |
| 1101 | |
| 1102 | RESOLVEFUNC(EVP_PKEY_get1_DSA) |
| 1103 | RESOLVEFUNC(EVP_PKEY_get1_RSA) |
| 1104 | RESOLVEFUNC(EVP_PKEY_get1_DH) |
| 1105 | |
| 1106 | RESOLVEFUNC(PEM_read_bio_DSA_PUBKEY) |
| 1107 | RESOLVEFUNC(PEM_read_bio_RSA_PUBKEY) |
| 1108 | RESOLVEFUNC(PEM_read_bio_DSAPrivateKey) |
| 1109 | RESOLVEFUNC(PEM_read_bio_RSAPrivateKey) |
| 1110 | |
| 1111 | RESOLVEFUNC(PEM_write_bio_DSA_PUBKEY) |
| 1112 | RESOLVEFUNC(PEM_write_bio_RSA_PUBKEY) |
| 1113 | RESOLVEFUNC(PEM_write_bio_DSAPrivateKey) |
| 1114 | RESOLVEFUNC(PEM_write_bio_RSAPrivateKey) |
| 1115 | RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey) |
| 1116 | |
| 1117 | RESOLVEFUNC(DSA_new) |
| 1118 | RESOLVEFUNC(DSA_free) |
| 1119 | |
| 1120 | RESOLVEFUNC(RSA_new) |
| 1121 | RESOLVEFUNC(RSA_free) |
| 1122 | |
| 1123 | RESOLVEFUNC(DH_bits) |
| 1124 | RESOLVEFUNC(DSA_bits) |
| 1125 | RESOLVEFUNC(RSA_bits) |
| 1126 | |
| 1127 | #ifndef OPENSSL_NO_EC |
| 1128 | |
| 1129 | RESOLVEFUNC(EVP_PKEY_set1_EC_KEY) |
| 1130 | RESOLVEFUNC(EVP_PKEY_get1_EC_KEY) |
| 1131 | RESOLVEFUNC(PEM_read_bio_EC_PUBKEY) |
| 1132 | RESOLVEFUNC(PEM_read_bio_ECPrivateKey) |
| 1133 | RESOLVEFUNC(PEM_write_bio_EC_PUBKEY) |
| 1134 | RESOLVEFUNC(PEM_write_bio_ECPrivateKey) |
| 1135 | RESOLVEFUNC(EC_KEY_get0_group) |
| 1136 | RESOLVEFUNC(EC_GROUP_get_degree) |
| 1137 | RESOLVEFUNC(EC_KEY_dup) |
| 1138 | RESOLVEFUNC(EC_KEY_new_by_curve_name) |
| 1139 | RESOLVEFUNC(EC_KEY_free) |
| 1140 | |
| 1141 | #endif // OPENSSL_NO_EC |
| 1142 | |
| 1143 | #endif // OPENSSL_NO_DEPRECATED_3_0 |
| 1144 | |
| 1145 | RESOLVEFUNC(SSL_get_verify_result) |
| 1146 | RESOLVEFUNC(SSL_new) |
| 1147 | RESOLVEFUNC(SSL_get_SSL_CTX) |
| 1148 | RESOLVEFUNC(SSL_ctrl) |
| 1149 | RESOLVEFUNC(SSL_read) |
| 1150 | RESOLVEFUNC(SSL_set_accept_state) |
| 1151 | RESOLVEFUNC(SSL_set_bio) |
| 1152 | RESOLVEFUNC(SSL_set_connect_state) |
| 1153 | RESOLVEFUNC(SSL_shutdown) |
| 1154 | RESOLVEFUNC(SSL_in_init) |
| 1155 | RESOLVEFUNC(SSL_get_shutdown) |
| 1156 | RESOLVEFUNC(SSL_set_session) |
| 1157 | RESOLVEFUNC(SSL_SESSION_free) |
| 1158 | RESOLVEFUNC(SSL_get1_session) |
| 1159 | RESOLVEFUNC(SSL_get_session) |
| 1160 | RESOLVEFUNC(SSL_set_ex_data) |
| 1161 | RESOLVEFUNC(SSL_get_ex_data) |
| 1162 | RESOLVEFUNC(SSL_get_ex_data_X509_STORE_CTX_idx) |
| 1163 | |
| 1164 | #ifndef OPENSSL_NO_PSK |
| 1165 | RESOLVEFUNC(SSL_set_psk_client_callback) |
| 1166 | RESOLVEFUNC(SSL_set_psk_server_callback) |
| 1167 | RESOLVEFUNC(SSL_CTX_use_psk_identity_hint) |
| 1168 | #endif // !OPENSSL_NO_PSK |
| 1169 | |
| 1170 | RESOLVEFUNC(SSL_write) |
| 1171 | RESOLVEFUNC(X509_NAME_entry_count) |
| 1172 | RESOLVEFUNC(X509_NAME_get_entry) |
| 1173 | RESOLVEFUNC(X509_NAME_ENTRY_get_data) |
| 1174 | RESOLVEFUNC(X509_NAME_ENTRY_get_object) |
| 1175 | RESOLVEFUNC(X509_PUBKEY_get) |
| 1176 | RESOLVEFUNC(X509_STORE_free) |
| 1177 | RESOLVEFUNC(X509_STORE_new) |
| 1178 | RESOLVEFUNC(X509_STORE_add_cert) |
| 1179 | RESOLVEFUNC(X509_STORE_CTX_free) |
| 1180 | RESOLVEFUNC(X509_STORE_CTX_init) |
| 1181 | RESOLVEFUNC(X509_STORE_CTX_new) |
| 1182 | RESOLVEFUNC(X509_STORE_CTX_set_purpose) |
| 1183 | RESOLVEFUNC(X509_STORE_CTX_get_error) |
| 1184 | RESOLVEFUNC(X509_STORE_CTX_get_error_depth) |
| 1185 | RESOLVEFUNC(X509_STORE_CTX_get_current_cert) |
| 1186 | RESOLVEFUNC(X509_STORE_CTX_get0_store) |
| 1187 | RESOLVEFUNC(X509_cmp) |
| 1188 | RESOLVEFUNC(X509_STORE_CTX_get_ex_data) |
| 1189 | RESOLVEFUNC(X509_dup) |
| 1190 | RESOLVEFUNC(X509_print) |
| 1191 | RESOLVEFUNC(X509_digest) |
| 1192 | RESOLVEFUNC(X509_EXTENSION_get_object) |
| 1193 | RESOLVEFUNC(X509_free) |
| 1194 | RESOLVEFUNC(X509_gmtime_adj) |
| 1195 | RESOLVEFUNC(ASN1_TIME_free) |
| 1196 | RESOLVEFUNC(X509_get_ext) |
| 1197 | RESOLVEFUNC(X509_get_ext_count) |
| 1198 | RESOLVEFUNC(X509_get_ext_d2i) |
| 1199 | RESOLVEFUNC(X509V3_EXT_get) |
| 1200 | RESOLVEFUNC(X509V3_EXT_d2i) |
| 1201 | RESOLVEFUNC(X509_EXTENSION_get_critical) |
| 1202 | RESOLVEFUNC(X509_EXTENSION_get_data) |
| 1203 | RESOLVEFUNC(BASIC_CONSTRAINTS_free) |
| 1204 | RESOLVEFUNC(AUTHORITY_KEYID_free) |
| 1205 | RESOLVEFUNC(GENERAL_NAME_free) |
| 1206 | RESOLVEFUNC(ASN1_STRING_print) |
| 1207 | RESOLVEFUNC(X509_check_issued) |
| 1208 | RESOLVEFUNC(X509_get_issuer_name) |
| 1209 | RESOLVEFUNC(X509_get_subject_name) |
| 1210 | RESOLVEFUNC(X509_get_serialNumber) |
| 1211 | RESOLVEFUNC(X509_verify_cert) |
| 1212 | RESOLVEFUNC(d2i_X509) |
| 1213 | RESOLVEFUNC(i2d_X509) |
| 1214 | #if OPENSSL_VERSION_MAJOR < 3 |
| 1215 | RESOLVEFUNC(SSL_CTX_load_verify_locations) |
| 1216 | #else |
| 1217 | RESOLVEFUNC(SSL_CTX_load_verify_dir) |
| 1218 | #endif // OPENSSL_VERSION_MAJOR |
| 1219 | RESOLVEFUNC(i2d_SSL_SESSION) |
| 1220 | RESOLVEFUNC(d2i_SSL_SESSION) |
| 1221 | |
| 1222 | #ifndef OPENSSL_NO_NEXTPROTONEG |
| 1223 | RESOLVEFUNC(SSL_select_next_proto) |
| 1224 | RESOLVEFUNC(SSL_CTX_set_next_proto_select_cb) |
| 1225 | RESOLVEFUNC(SSL_get0_next_proto_negotiated) |
| 1226 | RESOLVEFUNC(SSL_set_alpn_protos) |
| 1227 | RESOLVEFUNC(SSL_CTX_set_alpn_select_cb) |
| 1228 | RESOLVEFUNC(SSL_get0_alpn_selected) |
| 1229 | #endif // !OPENSSL_NO_NEXTPROTONEG |
| 1230 | |
| 1231 | #if QT_CONFIG(dtls) |
| 1232 | RESOLVEFUNC(SSL_CTX_set_cookie_generate_cb) |
| 1233 | RESOLVEFUNC(SSL_CTX_set_cookie_verify_cb) |
| 1234 | RESOLVEFUNC(DTLS_server_method) |
| 1235 | RESOLVEFUNC(DTLS_client_method) |
| 1236 | #endif // dtls |
| 1237 | |
| 1238 | RESOLVEFUNC(CRYPTO_malloc) |
| 1239 | RESOLVEFUNC(BN_bin2bn) |
| 1240 | |
| 1241 | #ifndef OPENSSL_NO_EC |
| 1242 | RESOLVEFUNC(EC_get_builtin_curves) |
| 1243 | #endif // OPENSSL_NO_EC |
| 1244 | |
| 1245 | RESOLVEFUNC(PKCS12_parse) |
| 1246 | RESOLVEFUNC(d2i_PKCS12_bio) |
| 1247 | RESOLVEFUNC(PKCS12_free) |
| 1248 | return true; |
| 1249 | }(); |
| 1250 | |
| 1251 | return symbolsResolved; |
| 1252 | } |
| 1253 | #endif // QT_CONFIG(library) |
| 1254 | |
| 1255 | #else // !defined QT_LINKED_OPENSSL |
| 1256 | |
| 1257 | bool q_resolveOpenSslSymbols() |
| 1258 | { |
| 1259 | #ifdef QT_NO_OPENSSL |
| 1260 | return false; |
| 1261 | #endif |
| 1262 | return true; |
| 1263 | } |
| 1264 | #endif // !defined QT_LINKED_OPENSSL |
| 1265 | |
| 1266 | QT_END_NAMESPACE |
| 1267 | |