1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the QtNetwork module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 /****************************************************************************
42 **
43 ** In addition, as a special exception, the copyright holders listed above give
44 ** permission to link the code of its release of Qt with the OpenSSL project's
45 ** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the
46 ** same license as the original version), and distribute the linked executables.
47 **
48 ** You must comply with the GNU General Public License version 2 in all
49 ** respects for all of the code used other than the "OpenSSL" code.  If you
50 ** modify this file, you may extend this exception to your version of the file,
51 ** but you are not obligated to do so.  If you do not wish to do so, delete
52 ** this exception statement from your version of this file.
53 **
54 ****************************************************************************/
55 
56 #ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H
57 #define QSSLSOCKET_OPENSSL_SYMBOLS_P_H
58 
59 
60 //
61 //  W A R N I N G
62 //  -------------
63 //
64 // This file is not part of the Qt API. It exists purely as an
65 // implementation detail. This header file may change from version to
66 // version without notice, or even be removed.
67 //
68 // We mean it.
69 //
70 
71 #include <QtNetwork/private/qtnetworkglobal_p.h>
72 #include "qsslsocket_openssl_p.h"
73 #include <QtCore/qglobal.h>
74 
75 #if QT_CONFIG(ocsp)
76 #include "qocsp_p.h"
77 #endif
78 
79 QT_BEGIN_NAMESPACE
80 
81 #define DUMMYARG
82 
83 #if !defined QT_LINKED_OPENSSL
84 // **************** Shared declarations ******************
85 // ret func(arg)
86 
87 #  define DEFINEFUNC(ret, func, arg, a, err, funcret) \
88     typedef ret (*_q_PTR_##func)(arg); \
89     static _q_PTR_##func _q_##func = 0; \
90     ret q_##func(arg) { \
91         if (Q_UNLIKELY(!_q_##func)) { \
92             qsslSocketUnresolvedSymbolWarning(#func); \
93             err; \
94         } \
95         funcret _q_##func(a); \
96     }
97 
98 // ret func(arg1, arg2)
99 #  define DEFINEFUNC2(ret, func, arg1, a, arg2, b, err, funcret) \
100     typedef ret (*_q_PTR_##func)(arg1, arg2);         \
101     static _q_PTR_##func _q_##func = 0;               \
102     ret q_##func(arg1, arg2) { \
103         if (Q_UNLIKELY(!_q_##func)) { \
104             qsslSocketUnresolvedSymbolWarning(#func);\
105             err; \
106         } \
107         funcret _q_##func(a, b); \
108     }
109 
110 // ret func(arg1, arg2, arg3)
111 #  define DEFINEFUNC3(ret, func, arg1, a, arg2, b, arg3, c, err, funcret) \
112     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3);            \
113     static _q_PTR_##func _q_##func = 0;                        \
114     ret q_##func(arg1, arg2, arg3) { \
115         if (Q_UNLIKELY(!_q_##func)) { \
116             qsslSocketUnresolvedSymbolWarning(#func); \
117             err; \
118         } \
119         funcret _q_##func(a, b, c); \
120     }
121 
122 // ret func(arg1, arg2, arg3, arg4)
123 #  define DEFINEFUNC4(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, err, funcret) \
124     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4);               \
125     static _q_PTR_##func _q_##func = 0;                                 \
126     ret q_##func(arg1, arg2, arg3, arg4) { \
127          if (Q_UNLIKELY(!_q_##func)) { \
128              qsslSocketUnresolvedSymbolWarning(#func); \
129              err; \
130          } \
131          funcret _q_##func(a, b, c, d); \
132     }
133 
134 // ret func(arg1, arg2, arg3, arg4, arg5)
135 #  define DEFINEFUNC5(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, err, funcret) \
136     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5);         \
137     static _q_PTR_##func _q_##func = 0;                                 \
138     ret q_##func(arg1, arg2, arg3, arg4, arg5) { \
139         if (Q_UNLIKELY(!_q_##func)) { \
140             qsslSocketUnresolvedSymbolWarning(#func); \
141             err; \
142         } \
143         funcret _q_##func(a, b, c, d, e); \
144     }
145 
146 // ret func(arg1, arg2, arg3, arg4, arg6)
147 #  define DEFINEFUNC6(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, err, funcret) \
148     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6);   \
149     static _q_PTR_##func _q_##func = 0;                                 \
150     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \
151         if (Q_UNLIKELY(!_q_##func)) { \
152             qsslSocketUnresolvedSymbolWarning(#func); \
153             err; \
154         } \
155         funcret _q_##func(a, b, c, d, e, f); \
156     }
157 
158 // ret func(arg1, arg2, arg3, arg4, arg6, arg7)
159 #  define DEFINEFUNC7(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, err, funcret) \
160     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);   \
161     static _q_PTR_##func _q_##func = 0;                                       \
162     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
163         if (Q_UNLIKELY(!_q_##func)) { \
164             qsslSocketUnresolvedSymbolWarning(#func); \
165             err; \
166         } \
167         funcret _q_##func(a, b, c, d, e, f, g); \
168     }
169 
170 // ret func(arg1, arg2, arg3, arg4, arg6, arg7, arg8, arg9)
171 #  define DEFINEFUNC9(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, arg8, h, arg9, i, err, funcret) \
172     typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);   \
173     static _q_PTR_##func _q_##func = 0;                                                   \
174     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
175         if (Q_UNLIKELY(!_q_##func)) { \
176             qsslSocketUnresolvedSymbolWarning(#func); \
177             err; \
178         }   \
179         funcret _q_##func(a, b, c, d, e, f, g, h, i); \
180     }
181 // **************** Shared declarations ******************
182 
183 #else // !defined QT_LINKED_OPENSSL
184 
185 // **************** Static declarations ******************
186 
187 // ret func(arg)
188 #  define DEFINEFUNC(ret, func, arg, a, err, funcret) \
189     ret q_##func(arg) { funcret func(a); }
190 
191 // ret func(arg1, arg2)
192 #  define DEFINEFUNC2(ret, func, arg1, a, arg2, b, err, funcret) \
193     ret q_##func(arg1, arg2) { funcret func(a, b); }
194 
195 // ret func(arg1, arg2, arg3)
196 #  define DEFINEFUNC3(ret, func, arg1, a, arg2, b, arg3, c, err, funcret) \
197     ret q_##func(arg1, arg2, arg3) { funcret func(a, b, c); }
198 
199 // ret func(arg1, arg2, arg3, arg4)
200 #  define DEFINEFUNC4(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, err, funcret) \
201     ret q_##func(arg1, arg2, arg3, arg4) { funcret func(a, b, c, d); }
202 
203 // ret func(arg1, arg2, arg3, arg4, arg5)
204 #  define DEFINEFUNC5(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, err, funcret) \
205     ret q_##func(arg1, arg2, arg3, arg4, arg5) { funcret func(a, b, c, d, e); }
206 
207 // ret func(arg1, arg2, arg3, arg4, arg6)
208 #  define DEFINEFUNC6(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, err, funcret) \
209     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { funcret func(a, b, c, d, e, f); }
210 
211 // ret func(arg1, arg2, arg3, arg4, arg6, arg7)
212 #  define DEFINEFUNC7(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, err, funcret) \
213     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { funcret func(a, b, c, d, e, f, g); }
214 
215 // ret func(arg1, arg2, arg3, arg4, arg6, arg7, arg8, arg9)
216 #  define DEFINEFUNC9(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, arg8, h, arg9, i, err, funcret) \
217     ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { funcret func(a, b, c, d, e, f, g, h, i); }
218 
219 // **************** Static declarations ******************
220 
221 #endif // !defined QT_LINKED_OPENSSL
222 
223 // TODO: the following lines previously were a part of 1.1 - specific header.
224 // To reduce the amount of the change, I'm directly copying and pasting the
225 // content of the header here. Later, can be better sorted/split into groups,
226 // depending on the functionality.
227 
228 const unsigned char * q_ASN1_STRING_get0_data(const ASN1_STRING *x);
229 
230 Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a);
231 Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem();
232 
233 int q_DSA_bits(DSA *a);
234 int q_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c);
235 Q_AUTOTEST_EXPORT int q_EVP_PKEY_up_ref(EVP_PKEY *a);
236 EVP_PKEY_CTX *q_EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
237 void q_EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
238 int q_EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);
239 int q_EVP_PKEY_base_id(EVP_PKEY *a);
240 int q_RSA_bits(RSA *a);
241 Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a);
242 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *));
243 Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null();
244 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data);
245 Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a);
246 Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b);
247 int q_SSL_session_reused(SSL *a);
248 unsigned long q_SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op);
249 int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
250 size_t q_SSL_get_client_random(SSL *a, unsigned char *out, size_t outlen);
251 size_t q_SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, size_t outlen);
252 int q_CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
253 const SSL_METHOD *q_TLS_method();
254 const SSL_METHOD *q_TLS_client_method();
255 const SSL_METHOD *q_TLS_server_method();
256 ASN1_TIME *q_X509_getm_notBefore(X509 *a);
257 ASN1_TIME *q_X509_getm_notAfter(X509 *a);
258 
259 Q_AUTOTEST_EXPORT void q_X509_up_ref(X509 *a);
260 long q_X509_get_version(X509 *a);
261 EVP_PKEY *q_X509_get_pubkey(X509 *a);
262 void q_X509_STORE_set_verify_cb(X509_STORE *ctx, X509_STORE_CTX_verify_cb verify_cb);
263 int q_X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data);
264 void *q_X509_STORE_get_ex_data(X509_STORE *r, int idx);
265 STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx);
266 void q_DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
267 int q_DH_bits(DH *dh);
268 
269 # define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
270                                                        | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
271 
272 #define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_OPENSSL_sk_num)(st)
273 #define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_OPENSSL_sk_value)(st, i)
274 
275 #define q_OPENSSL_add_all_algorithms_conf()  q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
276                                                                    | OPENSSL_INIT_ADD_ALL_DIGESTS \
277                                                                    | OPENSSL_INIT_LOAD_CONFIG, NULL)
278 #define  q_OPENSSL_add_all_algorithms_noconf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
279                                                                     | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
280 
281 int q_OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
282 void q_CRYPTO_free(void *str, const char *file, int line);
283 
284 long q_OpenSSL_version_num();
285 const char *q_OpenSSL_version(int type);
286 
287 unsigned long q_SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session);
288 unsigned long q_SSL_set_options(SSL *s, unsigned long op);
289 
290 #ifdef TLS1_3_VERSION
291 int q_SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
292 
293 // The functions below do not really have to be ifdefed like this, but for now
294 // they only used in TLS 1.3 handshake (and probably future versions).
295 // Plus, 'is resumalbe' is OpenSSL 1.1.1-only (and again we need it for
296 // TLS 1.3-specific session management).
297 
298 extern "C"
299 {
300 using NewSessionCallback = int (*)(SSL *, SSL_SESSION *);
301 }
302 
303 void q_SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, NewSessionCallback cb);
304 int q_SSL_SESSION_is_resumable(const SSL_SESSION *s);
305 
306 #define q_SSL_CTX_set_session_cache_mode(ctx,m) \
307     q_SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
308 
309 #endif
310 
311 #if QT_CONFIG(dtls)
312 // Functions and types required for DTLS support:
313 extern "C"
314 {
315 
316 typedef int (*CookieVerifyCallback)(SSL *, const unsigned char *, unsigned);
317 typedef int (*DgramWriteCallback) (BIO *, const char *, int);
318 typedef int (*DgramReadCallback) (BIO *, char *, int);
319 typedef int (*DgramPutsCallback) (BIO *, const char *);
320 typedef long (*DgramCtrlCallback) (BIO *, int, long, void *);
321 typedef int (*DgramCreateCallback) (BIO *);
322 typedef int (*DgramDestroyCallback) (BIO *);
323 
324 }
325 
326 int q_DTLSv1_listen(SSL *s, BIO_ADDR *client);
327 BIO_ADDR *q_BIO_ADDR_new();
328 void q_BIO_ADDR_free(BIO_ADDR *ap);
329 
330 // API we need for a custom dgram BIO:
331 
332 BIO_METHOD *q_BIO_meth_new(int type, const char *name);
333 void q_BIO_meth_free(BIO_METHOD *biom);
334 int q_BIO_meth_set_write(BIO_METHOD *biom, DgramWriteCallback);
335 int q_BIO_meth_set_read(BIO_METHOD *biom, DgramReadCallback);
336 int q_BIO_meth_set_puts(BIO_METHOD *biom, DgramPutsCallback);
337 int q_BIO_meth_set_ctrl(BIO_METHOD *biom, DgramCtrlCallback);
338 int q_BIO_meth_set_create(BIO_METHOD *biom, DgramCreateCallback);
339 int q_BIO_meth_set_destroy(BIO_METHOD *biom, DgramDestroyCallback);
340 
341 #endif // dtls
342 
343 void q_BIO_set_data(BIO *a, void *ptr);
344 void *q_BIO_get_data(BIO *a);
345 void q_BIO_set_init(BIO *a, int init);
346 int q_BIO_get_shutdown(BIO *a);
347 void q_BIO_set_shutdown(BIO *a, int shut);
348 
349 #if QT_CONFIG(ocsp)
350 const OCSP_CERTID *q_OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x);
351 #endif // ocsp
352 
353 #define q_SSL_CTX_set_min_proto_version(ctx, version) \
354         q_SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, nullptr)
355 
356 #define q_SSL_CTX_set_max_proto_version(ctx, version) \
357         q_SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, nullptr)
358 
359 extern "C" {
360 typedef int (*q_SSL_psk_use_session_cb_func_t)(SSL *, const EVP_MD *, const unsigned char **, size_t *,
361                                                SSL_SESSION **);
362 }
363 void q_SSL_set_psk_use_session_callback(SSL *s, q_SSL_psk_use_session_cb_func_t);
364 // Here the content of the 1.1 header ends.
365 
366 bool q_resolveOpenSslSymbols();
367 long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
368 int q_ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
369 int q_ASN1_STRING_length(ASN1_STRING *a);
370 int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b);
371 long q_BIO_ctrl(BIO *a, int b, long c, void *d);
372 Q_AUTOTEST_EXPORT int q_BIO_free(BIO *a);
373 BIO *q_BIO_new_mem_buf(void *a, int b);
374 int q_BIO_read(BIO *a, void *b, int c);
375 Q_AUTOTEST_EXPORT int q_BIO_write(BIO *a, const void *b, int c);
376 int q_BN_num_bits(const BIGNUM *a);
377 int q_BN_is_word(BIGNUM *a, BN_ULONG w);
378 BN_ULONG q_BN_mod_word(const BIGNUM *a, BN_ULONG w);
379 
380 #ifndef OPENSSL_NO_EC
381 const EC_GROUP* q_EC_KEY_get0_group(const EC_KEY* k);
382 int q_EC_GROUP_get_degree(const EC_GROUP* g);
383 #endif // OPENSSL_NO_EC
384 
385 DSA *q_DSA_new();
386 void q_DSA_free(DSA *a);
387 X509 *q_d2i_X509(X509 **a, const unsigned char **b, long c);
388 char *q_ERR_error_string(unsigned long a, char *b);
389 void q_ERR_error_string_n(unsigned long e, char *buf, size_t len);
390 unsigned long q_ERR_get_error();
391 EVP_CIPHER_CTX *q_EVP_CIPHER_CTX_new();
392 void q_EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
393 int q_EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
394 int q_EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
395 int q_EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, const unsigned char *key, const unsigned char *iv, int enc);
396 int q_EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc);
397 int q_EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl);
398 int q_EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
399 const EVP_MD *q_EVP_get_digestbyname(const char *name);
400 
401 #ifndef OPENSSL_NO_DES
402 const EVP_CIPHER *q_EVP_des_cbc();
403 const EVP_CIPHER *q_EVP_des_ede3_cbc();
404 #endif // OPENSSL_NO_DES
405 
406 #ifndef OPENSSL_NO_RC2
407 const EVP_CIPHER *q_EVP_rc2_cbc();
408 #endif // OPENSSL_NO_RC2
409 
410 #ifndef OPENSSL_NO_AES
411 const EVP_CIPHER *q_EVP_aes_128_cbc();
412 const EVP_CIPHER *q_EVP_aes_192_cbc();
413 const EVP_CIPHER *q_EVP_aes_256_cbc();
414 #endif // OPENSSL_NO_AES
415 
416 Q_AUTOTEST_EXPORT const EVP_MD *q_EVP_sha1();
417 int q_EVP_PKEY_assign(EVP_PKEY *a, int b, char *c);
418 Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_RSA(EVP_PKEY *a, RSA *b);
419 Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_DSA(EVP_PKEY *a, DSA *b);
420 Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_DH(EVP_PKEY *a, DH *b);
421 
422 #ifndef OPENSSL_NO_EC
423 Q_AUTOTEST_EXPORT int q_EVP_PKEY_set1_EC_KEY(EVP_PKEY *a, EC_KEY *b);
424 #endif
425 
426 Q_AUTOTEST_EXPORT int q_EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
427 Q_AUTOTEST_EXPORT void q_EVP_PKEY_free(EVP_PKEY *a);
428 RSA *q_EVP_PKEY_get1_RSA(EVP_PKEY *a);
429 DSA *q_EVP_PKEY_get1_DSA(EVP_PKEY *a);
430 DH *q_EVP_PKEY_get1_DH(EVP_PKEY *a);
431 #ifndef OPENSSL_NO_EC
432 EC_KEY *q_EVP_PKEY_get1_EC_KEY(EVP_PKEY *a);
433 #endif
434 int q_EVP_PKEY_type(int a);
435 Q_AUTOTEST_EXPORT EVP_PKEY *q_EVP_PKEY_new();
436 int q_i2d_X509(X509 *a, unsigned char **b);
437 const char *q_OBJ_nid2sn(int a);
438 const char *q_OBJ_nid2ln(int a);
439 int q_OBJ_sn2nid(const char *s);
440 int q_OBJ_ln2nid(const char *s);
441 int q_i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *obj);
442 int q_OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *obj, int no_name);
443 int q_OBJ_obj2nid(const ASN1_OBJECT *a);
444 #define q_EVP_get_digestbynid(a) q_EVP_get_digestbyname(q_OBJ_nid2sn(a))
445 Q_AUTOTEST_EXPORT EVP_PKEY *q_PEM_read_bio_PrivateKey(BIO *a, EVP_PKEY **b, pem_password_cb *c, void *d);
446 DSA *q_PEM_read_bio_DSAPrivateKey(BIO *a, DSA **b, pem_password_cb *c, void *d);
447 RSA *q_PEM_read_bio_RSAPrivateKey(BIO *a, RSA **b, pem_password_cb *c, void *d);
448 
449 #ifndef OPENSSL_NO_EC
450 EC_KEY *q_PEM_read_bio_ECPrivateKey(BIO *a, EC_KEY **b, pem_password_cb *c, void *d);
451 int q_PEM_write_bio_ECPrivateKey(BIO *a, EC_KEY *b, const EVP_CIPHER *c, unsigned char *d,
452                                   int e, pem_password_cb *f, void *g);
453 EC_KEY *q_PEM_read_bio_EC_PUBKEY(BIO *a, EC_KEY **b, pem_password_cb *c, void *d);
454 int q_PEM_write_bio_EC_PUBKEY(BIO *a, EC_KEY *b);
455 #endif // OPENSSL_NO_EC
456 
457 DH *q_PEM_read_bio_DHparams(BIO *a, DH **b, pem_password_cb *c, void *d);
458 int q_PEM_write_bio_DSAPrivateKey(BIO *a, DSA *b, const EVP_CIPHER *c, unsigned char *d,
459                                   int e, pem_password_cb *f, void *g);
460 int q_PEM_write_bio_RSAPrivateKey(BIO *a, RSA *b, const EVP_CIPHER *c, unsigned char *d,
461                                   int e, pem_password_cb *f, void *g);
462 int q_PEM_write_bio_PrivateKey(BIO *a, EVP_PKEY *b, const EVP_CIPHER *c, unsigned char *d,
463                                int e, pem_password_cb *f, void *g);
464 Q_AUTOTEST_EXPORT EVP_PKEY *q_PEM_read_bio_PUBKEY(BIO *a, EVP_PKEY **b, pem_password_cb *c, void *d);
465 DSA *q_PEM_read_bio_DSA_PUBKEY(BIO *a, DSA **b, pem_password_cb *c, void *d);
466 RSA *q_PEM_read_bio_RSA_PUBKEY(BIO *a, RSA **b, pem_password_cb *c, void *d);
467 int q_PEM_write_bio_DSA_PUBKEY(BIO *a, DSA *b);
468 int q_PEM_write_bio_RSA_PUBKEY(BIO *a, RSA *b);
469 int q_PEM_write_bio_PUBKEY(BIO *a, EVP_PKEY *b);
470 
471 void q_RAND_seed(const void *a, int b);
472 int q_RAND_status();
473 int q_RAND_bytes(unsigned char *b, int n);
474 RSA *q_RSA_new();
475 void q_RSA_free(RSA *a);
476 int q_SSL_accept(SSL *a);
477 int q_SSL_clear(SSL *a);
478 char *q_SSL_CIPHER_description(const SSL_CIPHER *a, char *b, int c);
479 int q_SSL_CIPHER_get_bits(const SSL_CIPHER *a, int *b);
480 BIO *q_SSL_get_rbio(const SSL *s);
481 int q_SSL_connect(SSL *a);
482 int q_SSL_CTX_check_private_key(const SSL_CTX *a);
483 long q_SSL_CTX_ctrl(SSL_CTX *a, int b, long c, void *d);
484 void q_SSL_CTX_free(SSL_CTX *a);
485 SSL_CTX *q_SSL_CTX_new(const SSL_METHOD *a);
486 int q_SSL_CTX_set_cipher_list(SSL_CTX *a, const char *b);
487 int q_SSL_CTX_set_default_verify_paths(SSL_CTX *a);
488 void q_SSL_CTX_set_verify(SSL_CTX *a, int b, int (*c)(int, X509_STORE_CTX *));
489 void q_SSL_CTX_set_verify_depth(SSL_CTX *a, int b);
490 extern "C" {
491 typedef void (*GenericCallbackType)();
492 }
493 long q_SSL_CTX_callback_ctrl(SSL_CTX *, int, GenericCallbackType);
494 int q_SSL_CTX_use_certificate(SSL_CTX *a, X509 *b);
495 int q_SSL_CTX_use_certificate_file(SSL_CTX *a, const char *b, int c);
496 int q_SSL_CTX_use_PrivateKey(SSL_CTX *a, EVP_PKEY *b);
497 int q_SSL_CTX_use_RSAPrivateKey(SSL_CTX *a, RSA *b);
498 int q_SSL_CTX_use_PrivateKey_file(SSL_CTX *a, const char *b, int c);
499 X509_STORE *q_SSL_CTX_get_cert_store(const SSL_CTX *a);
500 SSL_CONF_CTX *q_SSL_CONF_CTX_new();
501 void q_SSL_CONF_CTX_free(SSL_CONF_CTX *a);
502 void q_SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *a, SSL_CTX *b);
503 unsigned int q_SSL_CONF_CTX_set_flags(SSL_CONF_CTX *a, unsigned int b);
504 int q_SSL_CONF_CTX_finish(SSL_CONF_CTX *a);
505 int q_SSL_CONF_cmd(SSL_CONF_CTX *a, const char *b, const char *c);
506 void q_SSL_free(SSL *a);
507 STACK_OF(SSL_CIPHER) *q_SSL_get_ciphers(const SSL *a);
508 const SSL_CIPHER *q_SSL_get_current_cipher(SSL *a);
509 int q_SSL_version(const SSL *a);
510 int q_SSL_get_error(SSL *a, int b);
511 STACK_OF(X509) *q_SSL_get_peer_cert_chain(SSL *a);
512 X509 *q_SSL_get_peer_certificate(SSL *a);
513 long q_SSL_get_verify_result(const SSL *a);
514 SSL *q_SSL_new(SSL_CTX *a);
515 SSL_CTX *q_SSL_get_SSL_CTX(SSL *a);
516 long q_SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
517 int q_SSL_read(SSL *a, void *b, int c);
518 void q_SSL_set_bio(SSL *a, BIO *b, BIO *c);
519 void q_SSL_set_accept_state(SSL *a);
520 void q_SSL_set_connect_state(SSL *a);
521 int q_SSL_shutdown(SSL *a);
522 int q_SSL_in_init(const SSL *s);
523 int q_SSL_get_shutdown(const SSL *ssl);
524 int q_SSL_set_session(SSL *to, SSL_SESSION *session);
525 void q_SSL_SESSION_free(SSL_SESSION *ses);
526 SSL_SESSION *q_SSL_get1_session(SSL *ssl);
527 SSL_SESSION *q_SSL_get_session(const SSL *ssl);
528 int q_SSL_set_ex_data(SSL *ssl, int idx, void *arg);
529 void *q_SSL_get_ex_data(const SSL *ssl, int idx);
530 #ifndef OPENSSL_NO_PSK
531 typedef unsigned int (*q_psk_client_callback_t)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len);
532 void q_SSL_set_psk_client_callback(SSL *ssl, q_psk_client_callback_t callback);
533 typedef unsigned int (*q_psk_server_callback_t)(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len);
534 void q_SSL_set_psk_server_callback(SSL *ssl, q_psk_server_callback_t callback);
535 int q_SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
536 #endif // !OPENSSL_NO_PSK
537 int q_SSL_write(SSL *a, const void *b, int c);
538 int q_X509_cmp(X509 *a, X509 *b);
539 X509 *q_X509_dup(X509 *a);
540 void q_X509_print(BIO *a, X509*b);
541 int q_X509_digest(const X509 *x509, const EVP_MD *type, unsigned char *md, unsigned int *len);
542 ASN1_OBJECT *q_X509_EXTENSION_get_object(X509_EXTENSION *a);
543 Q_AUTOTEST_EXPORT void q_X509_free(X509 *a);
544 Q_AUTOTEST_EXPORT ASN1_TIME *q_X509_gmtime_adj(ASN1_TIME *s, long adj);
545 Q_AUTOTEST_EXPORT void q_ASN1_TIME_free(ASN1_TIME *t);
546 X509_EXTENSION *q_X509_get_ext(X509 *a, int b);
547 int q_X509_get_ext_count(X509 *a);
548 void *q_X509_get_ext_d2i(X509 *a, int b, int *c, int *d);
549 const X509V3_EXT_METHOD *q_X509V3_EXT_get(X509_EXTENSION *a);
550 void *q_X509V3_EXT_d2i(X509_EXTENSION *a);
551 int q_X509_EXTENSION_get_critical(X509_EXTENSION *a);
552 ASN1_OCTET_STRING *q_X509_EXTENSION_get_data(X509_EXTENSION *a);
553 void q_BASIC_CONSTRAINTS_free(BASIC_CONSTRAINTS *a);
554 void q_AUTHORITY_KEYID_free(AUTHORITY_KEYID *a);
555 int q_ASN1_STRING_print(BIO *a, const ASN1_STRING *b);
556 int q_X509_check_issued(X509 *a, X509 *b);
557 X509_NAME *q_X509_get_issuer_name(X509 *a);
558 X509_NAME *q_X509_get_subject_name(X509 *a);
559 ASN1_INTEGER *q_X509_get_serialNumber(X509 *a);
560 int q_X509_verify_cert(X509_STORE_CTX *ctx);
561 int q_X509_NAME_entry_count(X509_NAME *a);
562 X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b);
563 ASN1_STRING *q_X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *a);
564 ASN1_OBJECT *q_X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *a);
565 EVP_PKEY *q_X509_PUBKEY_get(X509_PUBKEY *a);
566 void q_X509_STORE_free(X509_STORE *store);
567 X509_STORE *q_X509_STORE_new();
568 int q_X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
569 void q_X509_STORE_CTX_free(X509_STORE_CTX *storeCtx);
570 int q_X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
571                           X509 *x509, STACK_OF(X509) *chain);
572 X509_STORE_CTX *q_X509_STORE_CTX_new();
573 int q_X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
574 int q_X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
575 int q_X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
576 X509 *q_X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
577 X509_STORE *q_X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
578 
579 // Diffie-Hellman support
580 DH *q_DH_new();
581 void q_DH_free(DH *dh);
582 DH *q_d2i_DHparams(DH **a, const unsigned char **pp, long length);
583 int q_i2d_DHparams(DH *a, unsigned char **p);
584 
585 #ifndef OPENSSL_NO_DEPRECATED_3_0
586 int q_DH_check(DH *dh, int *codes);
587 #endif // OPENSSL_NO_DEPRECATED_3_0
588 
589 BIGNUM *q_BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
590 #define q_SSL_CTX_set_tmp_dh(ctx, dh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_DH, 0, (char *)dh)
591 
592 #ifndef OPENSSL_NO_EC
593 // EC Diffie-Hellman support
594 EC_KEY *q_EC_KEY_dup(const EC_KEY *src);
595 EC_KEY *q_EC_KEY_new_by_curve_name(int nid);
596 void q_EC_KEY_free(EC_KEY *ecdh);
597 #define q_SSL_CTX_set_tmp_ecdh(ctx, ecdh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_ECDH, 0, (char *)ecdh)
598 
599 // EC curves management
600 size_t q_EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
601 int q_EC_curve_nist2nid(const char *name);
602 #endif // OPENSSL_NO_EC
603 
604 #define q_SSL_get_server_tmp_key(ssl, key) q_SSL_ctrl((ssl), SSL_CTRL_GET_SERVER_TMP_KEY, 0, (char *)key)
605 
606 // PKCS#12 support
607 int q_PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);
608 PKCS12 *q_d2i_PKCS12_bio(BIO *bio, PKCS12 **pkcs12);
609 void q_PKCS12_free(PKCS12 *pkcs12);
610 
611 #define q_BIO_get_mem_data(b, pp) (int)q_BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
612 #define q_BIO_pending(b) (int)q_BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
613 #define q_SSL_CTX_set_mode(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
614 #define q_sk_GENERAL_NAME_num(st) q_SKM_sk_num(GENERAL_NAME, (st))
615 #define q_sk_GENERAL_NAME_value(st, i) q_SKM_sk_value(GENERAL_NAME, (st), (i))
616 
617 void q_GENERAL_NAME_free(GENERAL_NAME *a);
618 
619 #define q_sk_X509_num(st) q_SKM_sk_num(X509, (st))
620 #define q_sk_X509_value(st, i) q_SKM_sk_value(X509, (st), (i))
621 #define q_sk_SSL_CIPHER_num(st) q_SKM_sk_num(SSL_CIPHER, (st))
622 #define q_sk_SSL_CIPHER_value(st, i) q_SKM_sk_value(SSL_CIPHER, (st), (i))
623 #define q_SSL_CTX_add_extra_chain_cert(ctx,x509) \
624         q_SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
625 #define q_EVP_PKEY_assign_RSA(pkey,rsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
626                                         (char *)(rsa))
627 #define q_EVP_PKEY_assign_DSA(pkey,dsa) q_EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
628                                         (char *)(dsa))
629 #define q_OpenSSL_add_all_algorithms() q_OPENSSL_add_all_algorithms_conf()
630 
631 #if OPENSSL_VERSION_MAJOR < 3
632 int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath);
633 #else
634 int q_SSL_CTX_load_verify_dir(SSL_CTX *ctx, const char *CApath);
635 #endif // OPENSSL_VERSION_MAJOR
636 
637 int q_i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
638 SSL_SESSION *q_d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length);
639 
640 #ifndef OPENSSL_NO_NEXTPROTONEG
641 int q_SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
642                             const unsigned char *in, unsigned int inlen,
643                             const unsigned char *client, unsigned int client_len);
644 void q_SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
645                                         int (*cb) (SSL *ssl, unsigned char **out,
646                                                    unsigned char *outlen,
647                                                    const unsigned char *in,
648                                                    unsigned int inlen, void *arg),
649                                         void *arg);
650 void q_SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
651                                       unsigned *len);
652 int q_SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
653                           unsigned protos_len);
654 void q_SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
655                                   int (*cb) (SSL *ssl,
656                                              const unsigned char **out,
657                                              unsigned char *outlen,
658                                              const unsigned char *in,
659                                              unsigned int inlen,
660                                              void *arg), void *arg);
661 void q_SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
662                               unsigned *len);
663 #endif // !OPENSSL_NO_NEXTPROTONEG
664 
665 
666 #if QT_CONFIG(dtls)
667 
668 extern "C"
669 {
670 typedef int (*CookieGenerateCallback)(SSL *, unsigned char *, unsigned *);
671 }
672 
673 void q_SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, CookieGenerateCallback cb);
674 void q_SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, CookieVerifyCallback cb);
675 const SSL_METHOD *q_DTLS_server_method();
676 const SSL_METHOD *q_DTLS_client_method();
677 
678 #endif // dtls
679 
680 void *q_X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx);
681 int q_SSL_get_ex_data_X509_STORE_CTX_idx();
682 
683 #if QT_CONFIG(dtls)
684 #define q_DTLS_set_link_mtu(ssl, mtu) q_SSL_ctrl((ssl), DTLS_CTRL_SET_LINK_MTU, (mtu), nullptr)
685 #define q_DTLSv1_get_timeout(ssl, arg) q_SSL_ctrl(ssl, DTLS_CTRL_GET_TIMEOUT, 0, arg)
686 #define q_DTLSv1_handle_timeout(ssl) q_SSL_ctrl(ssl, DTLS_CTRL_HANDLE_TIMEOUT, 0, nullptr)
687 #endif // dtls
688 
689 void q_BIO_set_flags(BIO *b, int flags);
690 void q_BIO_clear_flags(BIO *b, int flags);
691 void *q_BIO_get_ex_data(BIO *b, int idx);
692 int q_BIO_set_ex_data(BIO *b, int idx, void *data);
693 
694 #define q_BIO_set_retry_read(b) q_BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
695 #define q_BIO_set_retry_write(b) q_BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
696 #define q_BIO_clear_retry_flags(b) q_BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
697 #define q_BIO_set_app_data(s,arg) q_BIO_set_ex_data(s,0,arg)
698 #define q_BIO_get_app_data(s) q_BIO_get_ex_data(s,0)
699 
700 // Helper function
701 class QDateTime;
702 QDateTime q_getTimeFromASN1(const ASN1_TIME *aTime);
703 
704 #define q_SSL_set_tlsext_status_type(ssl, type) \
705     q_SSL_ctrl((ssl), SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE, (type), nullptr)
706 
707 #if QT_CONFIG(ocsp)
708 
709 OCSP_RESPONSE *q_d2i_OCSP_RESPONSE(OCSP_RESPONSE **a, const unsigned char **in, long len);
710 Q_AUTOTEST_EXPORT int q_i2d_OCSP_RESPONSE(OCSP_RESPONSE *r, unsigned char **ppout);
711 Q_AUTOTEST_EXPORT OCSP_RESPONSE *q_OCSP_response_create(int status, OCSP_BASICRESP *bs);
712 Q_AUTOTEST_EXPORT void q_OCSP_RESPONSE_free(OCSP_RESPONSE *rs);
713 int q_OCSP_response_status(OCSP_RESPONSE *resp);
714 OCSP_BASICRESP *q_OCSP_response_get1_basic(OCSP_RESPONSE *resp);
715 Q_AUTOTEST_EXPORT OCSP_SINGLERESP *q_OCSP_basic_add1_status(OCSP_BASICRESP *rsp, OCSP_CERTID *cid,
716                                                             int status, int reason, ASN1_TIME *revtime,
717                                                             ASN1_TIME *thisupd, ASN1_TIME *nextupd);
718 Q_AUTOTEST_EXPORT int q_OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
719                                         STACK_OF(X509) *certs, unsigned long flags);
720 Q_AUTOTEST_EXPORT OCSP_BASICRESP *q_OCSP_BASICRESP_new();
721 Q_AUTOTEST_EXPORT void q_OCSP_BASICRESP_free(OCSP_BASICRESP *bs);
722 int q_OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, X509_STORE *st, unsigned long flags);
723 int q_OCSP_resp_count(OCSP_BASICRESP *bs);
724 OCSP_SINGLERESP *q_OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
725 int q_OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, ASN1_GENERALIZEDTIME **revtime,
726                               ASN1_GENERALIZEDTIME **thisupd, ASN1_GENERALIZEDTIME **nextupd);
727 int q_OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, ASN1_GENERALIZEDTIME *nextupd, long nsec, long maxsec);
728 int q_OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, ASN1_OCTET_STRING **pikeyHash,
729                         ASN1_INTEGER **pserial, OCSP_CERTID *cid);
730 
731 const STACK_OF(X509) *q_OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
732 Q_AUTOTEST_EXPORT OCSP_CERTID *q_OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
733 Q_AUTOTEST_EXPORT void q_OCSP_CERTID_free(OCSP_CERTID *cid);
734 int q_OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
735 
736 #define q_SSL_get_tlsext_status_ocsp_resp(ssl, arg) \
737     q_SSL_ctrl(ssl, SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP, 0, arg)
738 
739 #define q_SSL_CTX_set_tlsext_status_cb(ssl, cb) \
740     q_SSL_CTX_callback_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB, GenericCallbackType(cb))
741 
742 # define q_SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \
743     q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP, arglen, arg)
744 
745 #endif // ocsp
746 
747 
748 void *q_CRYPTO_malloc(size_t num, const char *file, int line);
749 #define q_OPENSSL_malloc(num) q_CRYPTO_malloc(num, "", 0)
750 
751 int q_SSL_CTX_get_security_level(const SSL_CTX *ctx);
752 void q_SSL_CTX_set_security_level(SSL_CTX *ctx, int level);
753 
754 QT_END_NAMESPACE
755 
756 #endif
757