Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/net/LoadSSLLibs.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2019, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
#ifndef LOAD_SSL_LIBS_H
23
#define LOAD_SSL_LIBS_H
24
25
#include <stdint.h>
26
#include <openssl/ssl.h>
27
#include <openssl/evp.h>
28
29
typedef const char * OOpenSSL_version_t(int);
30
31
typedef void OSSL_load_error_strings_t(void);
32
typedef int OSSL_library_init_t(void);
33
typedef int OOPENSSL_init_ssl_t(uint64_t opts, const void * settings);
34
35
typedef const SSL_METHOD * OSSLv23_server_method_t(void);
36
typedef const SSL_METHOD * OSSLv23_client_method_t(void);
37
38
typedef long OSSL_CTX_set_ecdh_auto_t(SSL_CTX *ctx, int onoff);
39
typedef long OSSL_CTX_ctrl_t(SSL_CTX *ctx, int cmd, long larg, void *parg);
40
41
typedef long OBIO_ctrl_t(BIO *bp, int cmd, long larg, void *parg);
42
43
typedef const char * OSSL_CIPHER_get_name_t(const SSL_CIPHER *c);
44
typedef const SSL_CIPHER * OSSL_get_current_cipher_t(const SSL *s);
45
typedef const char * OSSL_get_cipher_t(const SSL *s);
46
47
typedef void OEVP_cleanup_t(void);
48
49
typedef int Osk_num_t(const _STACK *);
50
typedef void * Osk_value_t(const _STACK *, int);
51
typedef void * Osk_pop_free_t(_STACK *st, void (*func) (void *));
52
53
typedef void OX509_INFO_free_t(X509_INFO *a);
54
typedef int Osk_X509_INFO_num_t(const STACK_OF(X509_INFO) *st);
55
typedef X509_INFO * Osk_X509_INFO_value_t(const STACK_OF(X509_INFO) *st, int i);
56
typedef void Osk_X509_INFO_pop_free_t(STACK_OF(X509_INFO) *st, OX509_INFO_free_t* X509InfoFreeFunc);
57
58
typedef SSL * OSSL_new_t(SSL_CTX *ctx);
59
typedef void OSSL_free_t(SSL *ssl);
60
typedef void OSSL_set_connect_state_t(SSL *ssl);
61
typedef void OSSL_set_accept_state_t(SSL *ssl);
62
typedef int OSSL_set_fd_t(SSL *ssl, int fd);
63
typedef const char * OSSL_get_version_t(const SSL *ssl);
64
typedef int OSSL_accept_t(SSL *ssl);
65
typedef int OSSL_connect_t(SSL *ssl);
66
typedef X509 * OSSL_get_peer_certificate_t(const SSL *ssl);
67
typedef long OSSL_get_verify_result_t(const SSL *ssl);
68
69
typedef SSL_CTX * OSSL_CTX_new_t(const SSL_METHOD *method);
70
typedef int OSSL_CTX_set_session_id_context_t(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len);
71
typedef int OSSL_CTX_use_PrivateKey_t(SSL_CTX *ctx, EVP_PKEY *pkey);
72
typedef int OSSL_CTX_use_certificate_t(SSL_CTX *ctx, X509 *x);
73
typedef int OSSL_CTX_check_private_key_t(const SSL_CTX *ctx);
74
typedef void OSSL_CTX_set_verify_t(SSL_CTX *ctx, int mode, int (*verify_callback)(int, X509_STORE_CTX *));
75
typedef void OSSL_CTX_free_t(SSL_CTX *ctx);
76
typedef X509_STORE * OSSL_CTX_get_cert_store_t(const SSL_CTX *ctx);
77
78
typedef BIO * OBIO_new_mem_buf_t(const void *buf, int len);
79
typedef void OBIO_free_all_t(BIO *a);
80
typedef BIO * OBIO_new_ssl_t(SSL_CTX *ctx, int client);
81
typedef int OBIO_write_t(BIO *b, const void *data, int dlen);
82
typedef int OBIO_read_t(BIO *b, void *data, int dlen);
83
84
typedef EVP_PKEY * OPEM_read_bio_PrivateKey_t(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
85
typedef X509 * OPEM_read_bio_X509_t(BIO *bp, X509 **x, pem_password_cb *cb, void *u);
86
typedef STACK_OF(X509_INFO) *OPEM_X509_INFO_read_bio_t(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
87
88
typedef int OX509_STORE_add_cert_t(X509_STORE *ctx, X509 *x);
89
typedef int OX509_STORE_add_crl_t(X509_STORE *ctx, X509_CRL *x);
90
typedef void OX509_free_t(X509 *a);
91
92
typedef EVP_MD_CTX * OEVP_MD_CTX_new_t(void);
93
typedef void OEVP_MD_CTX_free_t(EVP_MD_CTX *ctx);
94
typedef int OEVP_DigestInit_ex_t(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
95
typedef int OEVP_DigestUpdate_t(EVP_MD_CTX *ctx, const void *d, size_t cnt);
96
typedef int OEVP_DigestFinal_ex_t(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
97
typedef const EVP_MD * OEVP_sha256_t(void);
98
99
typedef void OERR_print_errors_fp_t(FILE *fp);
100
101
extern "C" OOpenSSL_version_t * OOpenSSL_version;
102
103
extern "C" OSSL_load_error_strings_t * OSSL_load_error_strings;
104
extern "C" OSSL_library_init_t * OSSL_library_init;
105
106
extern "C" OSSLv23_server_method_t * OSSLv23_server_method;
107
extern "C" OSSLv23_client_method_t * OSSLv23_client_method;
108
109
extern "C" OSSL_CTX_set_ecdh_auto_t * OSSL_CTX_set_ecdh_auto;
110
111
extern "C" OBIO_ctrl_t * OBIO_ctrl;
112
113
extern "C" OSSL_get_cipher_t * OSSL_get_cipher;
114
115
extern "C" OEVP_cleanup_t * OEVP_cleanup;
116
117
extern "C" OX509_INFO_free_t * OX509_INFO_free;
118
extern "C" Osk_X509_INFO_num_t * Osk_X509_INFO_num;
119
extern "C" Osk_X509_INFO_value_t * Osk_X509_INFO_value;
120
extern "C" Osk_X509_INFO_pop_free_t * Osk_X509_INFO_pop_free;
121
122
extern "C" OSSL_new_t * OSSL_new;
123
extern "C" OSSL_free_t * OSSL_free;
124
extern "C" OSSL_set_connect_state_t * OSSL_set_connect_state;
125
extern "C" OSSL_set_accept_state_t * OSSL_set_accept_state;
126
extern "C" OSSL_set_fd_t * OSSL_set_fd;
127
extern "C" OSSL_get_version_t * OSSL_get_version;
128
extern "C" OSSL_accept_t * OSSL_accept;
129
extern "C" OSSL_connect_t * OSSL_connect;
130
extern "C" OSSL_get_peer_certificate_t * OSSL_get_peer_certificate;
131
extern "C" OSSL_get_verify_result_t * OSSL_get_verify_result;
132
133
extern "C" OSSLv23_server_method_t * OSSLv23_server_method;
134
extern "C" OSSLv23_client_method_t * OSSLv23_client_method;
135
136
extern "C" OSSL_CTX_new_t * OSSL_CTX_new;
137
extern "C" OSSL_CTX_set_session_id_context_t * OSSL_CTX_set_session_id_context;
138
extern "C" OSSL_CTX_use_PrivateKey_t * OSSL_CTX_use_PrivateKey;
139
extern "C" OSSL_CTX_use_certificate_t * OSSL_CTX_use_certificate;
140
extern "C" OSSL_CTX_check_private_key_t * OSSL_CTX_check_private_key;
141
extern "C" OSSL_CTX_set_verify_t * OSSL_CTX_set_verify;
142
extern "C" OSSL_CTX_free_t * OSSL_CTX_free;
143
extern "C" OSSL_CTX_get_cert_store_t * OSSL_CTX_get_cert_store;
144
145
extern "C" OBIO_new_mem_buf_t * OBIO_new_mem_buf;
146
extern "C" OBIO_free_all_t * OBIO_free_all;
147
extern "C" OBIO_new_ssl_t * OBIO_new_ssl;
148
extern "C" OBIO_write_t * OBIO_write;
149
extern "C" OBIO_read_t * OBIO_read;
150
151
extern "C" OPEM_read_bio_PrivateKey_t * OPEM_read_bio_PrivateKey;
152
extern "C" OPEM_read_bio_X509_t * OPEM_read_bio_X509;
153
extern "C" OPEM_X509_INFO_read_bio_t * OPEM_X509_INFO_read_bio;
154
155
extern "C" OX509_STORE_add_cert_t * OX509_STORE_add_cert;
156
extern "C" OX509_STORE_add_crl_t * OX509_STORE_add_crl;
157
extern "C" OX509_free_t * OX509_free;
158
159
extern "C" OEVP_MD_CTX_new_t * OEVP_MD_CTX_new;
160
extern "C" OEVP_MD_CTX_free_t * OEVP_MD_CTX_free;
161
extern "C" OEVP_DigestInit_ex_t * OEVP_DigestInit_ex;
162
extern "C" OEVP_DigestUpdate_t * OEVP_DigestUpdate;
163
extern "C" OEVP_DigestFinal_ex_t * OEVP_DigestFinal_ex;
164
extern "C" OEVP_sha256_t * OEVP_sha256;
165
166
extern "C" OERR_print_errors_fp_t * OERR_print_errors_fp;
167
168
namespace JITServer
169
{
170
void * loadLibssl();
171
void unloadLibssl(void * handle);
172
void * findLibsslSymbol(void * handle, const char * symName);
173
174
bool loadLibsslAndFindSymbols();
175
};
176
#endif // LOAD_SSL_LIBS_H
177
178