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 | #ifndef QSSLSOCKET_OPENSSL11_SYMBOLS_P_H |
22 | #define QSSLSOCKET_OPENSSL11_SYMBOLS_P_H |
23 | |
24 | // |
25 | // W A R N I N G |
26 | // ------------- |
27 | // |
28 | // This file is not part of the Qt API. It exists purely as an |
29 | // implementation detail. This header file may change from version to |
30 | // version without notice, or even be removed. |
31 | // |
32 | // We mean it. |
33 | // |
34 | |
35 | // Note: this file does not have QT_BEGIN_NAMESPACE/QT_END_NAMESPACE, it's done |
36 | // in qsslsocket_openssl_symbols_p.h. |
37 | |
38 | #ifndef OPENSSL_SYMBOLS_P_H |
39 | #error "You are not supposed to use this header file, include openssl_symbols_p.h instead" |
40 | #endif |
41 | |
42 | #include <openssl/x509.h> |
43 | |
44 | const unsigned char * q_ASN1_STRING_get0_data(const ASN1_STRING *x); |
45 | |
46 | Q_AUTOTEST_EXPORT BIO *q_BIO_new(const BIO_METHOD *a); |
47 | Q_AUTOTEST_EXPORT const BIO_METHOD *q_BIO_s_mem(); |
48 | |
49 | int q_DSA_bits(DSA *a); |
50 | int q_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); |
51 | int q_EVP_PKEY_base_id(EVP_PKEY *a); |
52 | int q_RSA_bits(RSA *a); |
53 | Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a); |
54 | Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *)); |
55 | Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null(); |
56 | Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data); |
57 | Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a); |
58 | Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b); |
59 | int q_SSL_session_reused(SSL *a); |
60 | unsigned long q_SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); |
61 | int q_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); |
62 | size_t q_SSL_get_client_random(SSL *a, unsigned char *out, size_t outlen); |
63 | size_t q_SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, size_t outlen); |
64 | 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); |
65 | const SSL_METHOD *q_TLS_method(); |
66 | const SSL_METHOD *q_TLS_client_method(); |
67 | const SSL_METHOD *q_TLS_server_method(); |
68 | ASN1_TIME *q_X509_getm_notBefore(X509 *a); |
69 | ASN1_TIME *q_X509_getm_notAfter(X509 *a); |
70 | |
71 | Q_AUTOTEST_EXPORT void q_X509_up_ref(X509 *a); |
72 | long q_X509_get_version(X509 *a); |
73 | EVP_PKEY *q_X509_get_pubkey(X509 *a); |
74 | void q_X509_STORE_set_verify_cb(X509_STORE *ctx, X509_STORE_CTX_verify_cb verify_cb); |
75 | STACK_OF(X509) *q_X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); |
76 | void q_DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); |
77 | int q_DH_bits(DH *dh); |
78 | |
79 | # define q_SSL_load_error_strings() q_OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ |
80 | | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) |
81 | |
82 | #define q_SKM_sk_num(type, st) ((int (*)(const STACK_OF(type) *))q_OPENSSL_sk_num)(st) |
83 | #define q_SKM_sk_value(type, st,i) ((type * (*)(const STACK_OF(type) *, int))q_OPENSSL_sk_value)(st, i) |
84 | |
85 | #define q_OPENSSL_add_all_algorithms_conf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ |
86 | | OPENSSL_INIT_ADD_ALL_DIGESTS \ |
87 | | OPENSSL_INIT_LOAD_CONFIG, NULL) |
88 | #define q_OPENSSL_add_all_algorithms_noconf() q_OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ |
89 | | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) |
90 | |
91 | // We resolve q_sk_ functions, but use q_OPENSSL_sk_ macros in code to reduce |
92 | // the amount of #ifdefs and for confusing developers. |
93 | OPENSSL_STACK *q_sk_new_null(); |
94 | #define q_OPENSSL_sk_new_null() q_sk_new_null() |
95 | #define q_sk_X509_EXTENSION_new_null() \ |
96 | ((OPENSSL_STACK *)q_sk_new_null()) |
97 | |
98 | void q_sk_push(OPENSSL_STACK *st, void *data); |
99 | |
100 | #define q_sk_X509_EXTENSION_push(st, val) \ |
101 | q_OPENSSL_sk_push((st), (val)) |
102 | #define q_sk_X509_EXTENSION_pop_free(st, free_func) \ |
103 | q_OPENSSL_sk_pop_free((st), (free_func)) |
104 | |
105 | |
106 | int q_OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); |
107 | void q_CRYPTO_free(void *str, const char *file, int line); |
108 | |
109 | long q_OpenSSL_version_num(); |
110 | const char *q_OpenSSL_version(int type); |
111 | |
112 | unsigned long q_SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session); |
113 | unsigned long q_SSL_set_options(SSL *s, unsigned long op); |
114 | |
115 | #ifdef TLS1_3_VERSION |
116 | int q_SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); |
117 | #endif |
118 | |
119 | void q_BIO_set_data(BIO *a, void *ptr); |
120 | void *q_BIO_get_data(BIO *a); |
121 | void q_BIO_set_init(BIO *a, int init); |
122 | int q_BIO_get_shutdown(BIO *a); |
123 | void q_BIO_set_shutdown(BIO *a, int shut); |
124 | |
125 | EVP_PKEY_CTX* q_EVP_PKEY_CTX_new_id(int id, ENGINE *e); |
126 | void q_EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); |
127 | int q_EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); |
128 | |
129 | int q_RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); |
130 | #define q_EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ |
131 | q_RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ |
132 | EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) |
133 | |
134 | int q_EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **pkey); |
135 | |
136 | #define q_SSL_CTX_set_min_proto_version(ctx, version) \ |
137 | q_SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, nullptr) |
138 | |
139 | #define q_SSL_CTX_set_max_proto_version(ctx, version) \ |
140 | q_SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, nullptr) |
141 | |
142 | #endif |
143 | |