本文整理汇总了C++中ERR_remove_thread_state函数的典型用法代码示例。如果您正苦于以下问题:C++ ERR_remove_thread_state函数的具体用法?C++ ERR_remove_thread_state怎么用?C++ ERR_remove_thread_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ERR_remove_thread_state函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lws_ssl_destroy
LWS_VISIBLE void
lws_ssl_destroy(struct lws_vhost *vhost)
{
if (!lws_check_opt(vhost->context->options,
LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
return;
#if defined(LWS_USE_POLARSSL)
#else
#if defined(LWS_USE_MBEDTLS)
#else
if (vhost->ssl_ctx)
SSL_CTX_free(vhost->ssl_ctx);
if (!vhost->user_supplied_ssl_ctx && vhost->ssl_client_ctx)
SSL_CTX_free(vhost->ssl_client_ctx);
#if (OPENSSL_VERSION_NUMBER < 0x01000000) || defined(USE_WOLFSSL)
ERR_remove_state(0);
#else
#if (OPENSSL_VERSION_NUMBER >= 0x10100005L) && \
!defined(LIBRESSL_VERSION_NUMBER) && \
!defined(OPENSSL_IS_BORINGSSL)
ERR_remove_thread_state();
#else
ERR_remove_thread_state(NULL);
#endif
#endif
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#endif
#endif
}
示例2: lws_ssl_context_destroy
void
lws_ssl_context_destroy(struct lws_context *context)
{
#if defined(LWS_USE_POLARSSL)
#else
#if defined(LWS_USE_MBEDTLS)
#else
#if (OPENSSL_VERSION_NUMBER < 0x10100006L)
#if (OPENSSL_VERSION_NUMBER < 0x01000000) || defined(USE_WOLFSSL)
ERR_remove_state(0);
#else
#if (OPENSSL_VERSION_NUMBER >= 0x10100005L) && \
!defined(LIBRESSL_VERSION_NUMBER) && \
!defined(OPENSSL_IS_BORINGSSL)
ERR_remove_thread_state();
#else
ERR_remove_thread_state(NULL);
#endif
#endif
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#endif
#endif
#endif
}
示例3: lws_ssl_context_destroy
void
lws_ssl_context_destroy(struct lws_context *context)
{
#if !defined(LWS_WITH_MBEDTLS)
// after 1.1.0 no need
#if (OPENSSL_VERSION_NUMBER < 0x10100000)
// <= 1.0.1f = old api, 1.0.1g+ = new api
#if (OPENSSL_VERSION_NUMBER <= 0x1000106f) || defined(USE_WOLFSSL)
ERR_remove_state(0);
#else
#if OPENSSL_VERSION_NUMBER >= 0x1010005f && \
!defined(LIBRESSL_VERSION_NUMBER) && \
!defined(OPENSSL_IS_BORINGSSL)
ERR_remove_thread_state();
#else
ERR_remove_thread_state(NULL);
#endif
#endif
// after 1.1.0 no need
#if (OPENSSL_VERSION_NUMBER >= 0x10002000) && (OPENSSL_VERSION_NUMBER <= 0x10100000)
SSL_COMP_free_compression_methods();
#endif
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#endif
#endif
}
示例4: lws_ssl_destroy
LWS_VISIBLE void
lws_ssl_destroy(struct lws_vhost *vhost)
{
if (!lws_check_opt(vhost->context->options,
LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
return;
if (vhost->tls.ssl_ctx)
SSL_CTX_free(vhost->tls.ssl_ctx);
if (!vhost->tls.user_supplied_ssl_ctx && vhost->tls.ssl_client_ctx)
SSL_CTX_free(vhost->tls.ssl_client_ctx);
// after 1.1.0 no need
#if (OPENSSL_VERSION_NUMBER < 0x10100000)
// <= 1.0.1f = old api, 1.0.1g+ = new api
#if (OPENSSL_VERSION_NUMBER <= 0x1000106f) || defined(USE_WOLFSSL)
ERR_remove_state(0);
#else
#if OPENSSL_VERSION_NUMBER >= 0x1010005f && \
!defined(LIBRESSL_VERSION_NUMBER) && \
!defined(OPENSSL_IS_BORINGSSL)
ERR_remove_thread_state();
#else
ERR_remove_thread_state(NULL);
#endif
#endif
// after 1.1.0 no need
#if (OPENSSL_VERSION_NUMBER >= 0x10002000) && (OPENSSL_VERSION_NUMBER <= 0x10100000)
SSL_COMP_free_compression_methods();
#endif
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#endif
}
示例5: xmlSecOpenSSLAppShutdown
/**
* xmlSecOpenSSLAppShutdown:
*
* General crypto engine shutdown. This function is used
* by XMLSec command line utility and called after
* @xmlSecShutdown function.
*
* Returns: 0 on success or a negative value otherwise.
*/
int
xmlSecOpenSSLAppShutdown(void) {
xmlSecOpenSSLAppSaveRANDFile(NULL);
RAND_cleanup();
EVP_cleanup();
#ifndef XMLSEC_NO_X509
X509_TRUST_cleanup();
#endif /* XMLSEC_NO_X509 */
ENGINE_cleanup();
CONF_modules_unload(1);
CRYPTO_cleanup_all_ex_data();
/* finally cleanup errors */
#if defined(XMLSEC_OPENSSL_110)
ERR_remove_thread_state();
#elif defined(XMLSEC_OPENSSL_100)
ERR_remove_thread_state(NULL);
#else
ERR_remove_state(0);
#endif /* defined(XMLSEC_OPENSSL_100) || defined(XMLSEC_OPENSSL_110) */
ERR_free_strings();
/* done */
return(0);
}
示例6: sslCleanup
void sslCleanup()
{
// Various cleanup functions
// Maddeningly, 64 bytes still remains (see https://bugs.launchpad.net/percona-server/+bug/1205196)
//ENGINE_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ERR_remove_thread_state(NULL);
#else
ERR_remove_thread_state();
#endif
EVP_cleanup();
}
示例7: ossl_init_thread_stop
static void ossl_init_thread_stop(struct thread_local_inits_st *locals)
{
/* Can't do much about this */
if (locals == NULL)
return;
if (locals->async) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
"ASYNC_cleanup_thread()\n");
#endif
ASYNC_cleanup_thread();
}
if (locals->err_state) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
"ERR_remove_thread_state(NULL)\n");
#endif
ERR_remove_thread_state(NULL);
}
OPENSSL_free(locals);
ossl_init_thread_stop_cleanup();
}
示例8: winpr_CleanupSSL
BOOL winpr_CleanupSSL(DWORD flags)
{
if (flags & WINPR_SSL_CLEANUP_GLOBAL)
{
if (!g_winpr_openssl_initialized_by_winpr)
{
WLog_WARN(TAG, "ssl was not initialized by winpr");
return FALSE;
}
g_winpr_openssl_initialized_by_winpr = FALSE;
#ifdef WINPR_OPENSSL_LOCKING_REQUIRED
_winpr_openssl_cleanup_locking();
#endif
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
EVP_cleanup();
flags |= WINPR_SSL_CLEANUP_THREAD;
}
#ifdef WINPR_OPENSSL_LOCKING_REQUIRED
if (flags & WINPR_SSL_CLEANUP_THREAD)
{
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
ERR_remove_state(0);
#else
ERR_remove_thread_state(NULL);
#endif
}
#endif
return TRUE;
}
示例9: main
int main(int argc, char **argv)
{
CRYPTO_set_mem_debug(1);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
ERR_load_crypto_strings();
OpenSSL_add_all_digests();
if (argc != 4) {
fprintf(stderr, "usage: verify_extra_test roots.pem untrusted.pem bad.pem\n");
return 1;
}
if (!test_alt_chains_cert_forgery(argv[1], argv[2], argv[3])) {
fprintf(stderr, "Test alt chains cert forgery failed\n");
return 1;
}
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
ERR_free_strings();
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (CRYPTO_mem_leaks_fp(stderr) <= 0)
return 1;
#endif
printf("PASS\n");
return 0;
}
示例10: main
int main(int argc, char **argv)
{
BIO *bio_err;
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
CRYPTO_malloc_debug_init();
CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
ERR_load_crypto_strings();
/* "Negative" test, expect a mismatch */
if(run_srp("alice", "password1", "password2") == 0)
{
fprintf(stderr, "Mismatched SRP run failed\n");
return 1;
}
/* "Positive" test, should pass */
if(run_srp("alice", "password", "password") != 0)
{
fprintf(stderr, "Plain SRP run failed\n");
return 1;
}
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(bio_err);
return 0;
}
示例11: terminate_signature
/* Delete the memory used for string errors as well as memory allocated for
* certificates and private keys. */
void terminate_signature(void)
{
//TODO: once implemented, must free chain
//TODO: once implemented, must free crl
if (store) {
X509_STORE_free(store);
store = NULL;
}
if (x509_stack) {
sk_X509_pop_free(x509_stack, X509_free);
x509_stack = NULL;
}
ERR_free_strings();
if (pkey) {
EVP_PKEY_free(pkey);
pkey = NULL;
}
EVP_cleanup();
if (fp_pubkey) {
fclose(fp_pubkey);
}
if (cert) {
cert = NULL;
}
ERR_remove_thread_state(NULL);
CRYPTO_cleanup_all_ex_data();
}
示例12: main
int main(int argc, char **argv)
{
int i;
testdata *test = test_cases;
CRYPTO_malloc_debug_init();
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
OpenSSL_add_all_digests();
# ifndef OPENSSL_NO_ENGINE
ENGINE_load_builtin_engines();
ENGINE_register_all_digests();
# endif
printf("PKCS5_PBKDF2_HMAC() tests ");
for (i = 0; test->pass != NULL; i++, test++) {
test_p5_pbkdf2(i, "sha1", test, sha1_results[i]);
test_p5_pbkdf2(i, "sha256", test, sha256_results[i]);
test_p5_pbkdf2(i, "sha512", test, sha512_results[i]);
printf(".");
}
printf(" done\n");
# ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
# endif
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks_fp(stderr);
return 0;
}
示例13: internal_idevice_deinit
static void internal_idevice_deinit(void)
{
#ifdef HAVE_OPENSSL
int i;
if (mutex_buf) {
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < CRYPTO_num_locks(); i++)
mutex_destroy(&mutex_buf[i]);
free(mutex_buf);
mutex_buf = NULL;
}
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
#ifdef HAVE_ERR_REMOVE_THREAD_STATE
ERR_remove_thread_state(NULL);
#else
ERR_remove_state(0);
#endif
#else
gnutls_global_deinit();
#endif
}
示例14: tcptls_stream_close
/*!
* \internal
* \brief fopencookie()/funopen() stream close function.
*
* \param cookie Stream control data.
*
* \retval 0 on success.
* \retval -1 on error.
*/
static int tcptls_stream_close(void *cookie)
{
struct ast_tcptls_stream *stream = cookie;
if (!stream) {
errno = EBADF;
return -1;
}
if (stream->fd != -1) {
#if defined(DO_SSL)
if (stream->ssl) {
int res;
/*
* According to the TLS standard, it is acceptable for an
* application to only send its shutdown alert and then
* close the underlying connection without waiting for
* the peer's response (this way resources can be saved,
* as the process can already terminate or serve another
* connection).
*/
res = SSL_shutdown(stream->ssl);
if (res < 0) {
ast_log(LOG_ERROR, "SSL_shutdown() failed: %d\n",
SSL_get_error(stream->ssl, res));
}
if (!stream->ssl->server) {
/* For client threads, ensure that the error stack is cleared */
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
ERR_remove_thread_state(NULL);
#else
ERR_remove_state(0);
#endif /* OPENSSL_VERSION_NUMBER >= 0x10000000L */
}
SSL_free(stream->ssl);
stream->ssl = NULL;
}
#endif /* defined(DO_SSL) */
/*
* Issuing shutdown() is necessary here to avoid a race
* condition where the last data written may not appear
* in the TCP stream. See ASTERISK-23548
*/
shutdown(stream->fd, SHUT_RDWR);
if (close(stream->fd)) {
ast_log(LOG_ERROR, "close() failed: %s\n", strerror(errno));
}
stream->fd = -1;
}
ao2_t_ref(stream, -1, "Closed tcptls stream cookie");
return 0;
}
示例15: aes_cleanup
static void aes_cleanup(EVP_CIPHER_CTX* ctx)
{
EVP_CIPHER_CTX_free(ctx);
#if(OPENSSL_VERSION_NUMBER<0x10000000L)
ERR_remove_state(0);
#elif(OPENSSL_VERSION_NUMBER<0x10100000L)
ERR_remove_thread_state(NULL);
#endif
}