Path: blob/master/runtime/compiler/net/LoadSSLLibs.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2019, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/21#ifndef LOAD_SSL_LIBS_H22#define LOAD_SSL_LIBS_H2324#include <stdint.h>25#include <openssl/ssl.h>26#include <openssl/evp.h>2728typedef const char * OOpenSSL_version_t(int);2930typedef void OSSL_load_error_strings_t(void);31typedef int OSSL_library_init_t(void);32typedef int OOPENSSL_init_ssl_t(uint64_t opts, const void * settings);3334typedef const SSL_METHOD * OSSLv23_server_method_t(void);35typedef const SSL_METHOD * OSSLv23_client_method_t(void);3637typedef long OSSL_CTX_set_ecdh_auto_t(SSL_CTX *ctx, int onoff);38typedef long OSSL_CTX_ctrl_t(SSL_CTX *ctx, int cmd, long larg, void *parg);3940typedef long OBIO_ctrl_t(BIO *bp, int cmd, long larg, void *parg);4142typedef const char * OSSL_CIPHER_get_name_t(const SSL_CIPHER *c);43typedef const SSL_CIPHER * OSSL_get_current_cipher_t(const SSL *s);44typedef const char * OSSL_get_cipher_t(const SSL *s);4546typedef void OEVP_cleanup_t(void);4748typedef int Osk_num_t(const _STACK *);49typedef void * Osk_value_t(const _STACK *, int);50typedef void * Osk_pop_free_t(_STACK *st, void (*func) (void *));5152typedef void OX509_INFO_free_t(X509_INFO *a);53typedef int Osk_X509_INFO_num_t(const STACK_OF(X509_INFO) *st);54typedef X509_INFO * Osk_X509_INFO_value_t(const STACK_OF(X509_INFO) *st, int i);55typedef void Osk_X509_INFO_pop_free_t(STACK_OF(X509_INFO) *st, OX509_INFO_free_t* X509InfoFreeFunc);5657typedef SSL * OSSL_new_t(SSL_CTX *ctx);58typedef void OSSL_free_t(SSL *ssl);59typedef void OSSL_set_connect_state_t(SSL *ssl);60typedef void OSSL_set_accept_state_t(SSL *ssl);61typedef int OSSL_set_fd_t(SSL *ssl, int fd);62typedef const char * OSSL_get_version_t(const SSL *ssl);63typedef int OSSL_accept_t(SSL *ssl);64typedef int OSSL_connect_t(SSL *ssl);65typedef X509 * OSSL_get_peer_certificate_t(const SSL *ssl);66typedef long OSSL_get_verify_result_t(const SSL *ssl);6768typedef SSL_CTX * OSSL_CTX_new_t(const SSL_METHOD *method);69typedef int OSSL_CTX_set_session_id_context_t(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len);70typedef int OSSL_CTX_use_PrivateKey_t(SSL_CTX *ctx, EVP_PKEY *pkey);71typedef int OSSL_CTX_use_certificate_t(SSL_CTX *ctx, X509 *x);72typedef int OSSL_CTX_check_private_key_t(const SSL_CTX *ctx);73typedef void OSSL_CTX_set_verify_t(SSL_CTX *ctx, int mode, int (*verify_callback)(int, X509_STORE_CTX *));74typedef void OSSL_CTX_free_t(SSL_CTX *ctx);75typedef X509_STORE * OSSL_CTX_get_cert_store_t(const SSL_CTX *ctx);7677typedef BIO * OBIO_new_mem_buf_t(const void *buf, int len);78typedef void OBIO_free_all_t(BIO *a);79typedef BIO * OBIO_new_ssl_t(SSL_CTX *ctx, int client);80typedef int OBIO_write_t(BIO *b, const void *data, int dlen);81typedef int OBIO_read_t(BIO *b, void *data, int dlen);8283typedef EVP_PKEY * OPEM_read_bio_PrivateKey_t(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);84typedef X509 * OPEM_read_bio_X509_t(BIO *bp, X509 **x, pem_password_cb *cb, void *u);85typedef STACK_OF(X509_INFO) *OPEM_X509_INFO_read_bio_t(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);8687typedef int OX509_STORE_add_cert_t(X509_STORE *ctx, X509 *x);88typedef int OX509_STORE_add_crl_t(X509_STORE *ctx, X509_CRL *x);89typedef void OX509_free_t(X509 *a);9091typedef EVP_MD_CTX * OEVP_MD_CTX_new_t(void);92typedef void OEVP_MD_CTX_free_t(EVP_MD_CTX *ctx);93typedef int OEVP_DigestInit_ex_t(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);94typedef int OEVP_DigestUpdate_t(EVP_MD_CTX *ctx, const void *d, size_t cnt);95typedef int OEVP_DigestFinal_ex_t(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);96typedef const EVP_MD * OEVP_sha256_t(void);9798typedef void OERR_print_errors_fp_t(FILE *fp);99100extern "C" OOpenSSL_version_t * OOpenSSL_version;101102extern "C" OSSL_load_error_strings_t * OSSL_load_error_strings;103extern "C" OSSL_library_init_t * OSSL_library_init;104105extern "C" OSSLv23_server_method_t * OSSLv23_server_method;106extern "C" OSSLv23_client_method_t * OSSLv23_client_method;107108extern "C" OSSL_CTX_set_ecdh_auto_t * OSSL_CTX_set_ecdh_auto;109110extern "C" OBIO_ctrl_t * OBIO_ctrl;111112extern "C" OSSL_get_cipher_t * OSSL_get_cipher;113114extern "C" OEVP_cleanup_t * OEVP_cleanup;115116extern "C" OX509_INFO_free_t * OX509_INFO_free;117extern "C" Osk_X509_INFO_num_t * Osk_X509_INFO_num;118extern "C" Osk_X509_INFO_value_t * Osk_X509_INFO_value;119extern "C" Osk_X509_INFO_pop_free_t * Osk_X509_INFO_pop_free;120121extern "C" OSSL_new_t * OSSL_new;122extern "C" OSSL_free_t * OSSL_free;123extern "C" OSSL_set_connect_state_t * OSSL_set_connect_state;124extern "C" OSSL_set_accept_state_t * OSSL_set_accept_state;125extern "C" OSSL_set_fd_t * OSSL_set_fd;126extern "C" OSSL_get_version_t * OSSL_get_version;127extern "C" OSSL_accept_t * OSSL_accept;128extern "C" OSSL_connect_t * OSSL_connect;129extern "C" OSSL_get_peer_certificate_t * OSSL_get_peer_certificate;130extern "C" OSSL_get_verify_result_t * OSSL_get_verify_result;131132extern "C" OSSLv23_server_method_t * OSSLv23_server_method;133extern "C" OSSLv23_client_method_t * OSSLv23_client_method;134135extern "C" OSSL_CTX_new_t * OSSL_CTX_new;136extern "C" OSSL_CTX_set_session_id_context_t * OSSL_CTX_set_session_id_context;137extern "C" OSSL_CTX_use_PrivateKey_t * OSSL_CTX_use_PrivateKey;138extern "C" OSSL_CTX_use_certificate_t * OSSL_CTX_use_certificate;139extern "C" OSSL_CTX_check_private_key_t * OSSL_CTX_check_private_key;140extern "C" OSSL_CTX_set_verify_t * OSSL_CTX_set_verify;141extern "C" OSSL_CTX_free_t * OSSL_CTX_free;142extern "C" OSSL_CTX_get_cert_store_t * OSSL_CTX_get_cert_store;143144extern "C" OBIO_new_mem_buf_t * OBIO_new_mem_buf;145extern "C" OBIO_free_all_t * OBIO_free_all;146extern "C" OBIO_new_ssl_t * OBIO_new_ssl;147extern "C" OBIO_write_t * OBIO_write;148extern "C" OBIO_read_t * OBIO_read;149150extern "C" OPEM_read_bio_PrivateKey_t * OPEM_read_bio_PrivateKey;151extern "C" OPEM_read_bio_X509_t * OPEM_read_bio_X509;152extern "C" OPEM_X509_INFO_read_bio_t * OPEM_X509_INFO_read_bio;153154extern "C" OX509_STORE_add_cert_t * OX509_STORE_add_cert;155extern "C" OX509_STORE_add_crl_t * OX509_STORE_add_crl;156extern "C" OX509_free_t * OX509_free;157158extern "C" OEVP_MD_CTX_new_t * OEVP_MD_CTX_new;159extern "C" OEVP_MD_CTX_free_t * OEVP_MD_CTX_free;160extern "C" OEVP_DigestInit_ex_t * OEVP_DigestInit_ex;161extern "C" OEVP_DigestUpdate_t * OEVP_DigestUpdate;162extern "C" OEVP_DigestFinal_ex_t * OEVP_DigestFinal_ex;163extern "C" OEVP_sha256_t * OEVP_sha256;164165extern "C" OERR_print_errors_fp_t * OERR_print_errors_fp;166167namespace JITServer168{169void * loadLibssl();170void unloadLibssl(void * handle);171void * findLibsslSymbol(void * handle, const char * symName);172173bool loadLibsslAndFindSymbols();174};175#endif // LOAD_SSL_LIBS_H176177178