本文整理汇总了C++中ERR_free_strings函数的典型用法代码示例。如果您正苦于以下问题:C++ ERR_free_strings函数的具体用法?C++ ERR_free_strings怎么用?C++ ERR_free_strings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ERR_free_strings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
EVP_cleanup();
#endif
#ifdef WINPR_OPENSSL_LOCKING_REQUIRED
flags |= WINPR_SSL_CLEANUP_THREAD;
#endif
}
#ifdef WINPR_OPENSSL_LOCKING_REQUIRED
if (flags & WINPR_SSL_CLEANUP_THREAD)
{
#if (OPENSSL_VERSION_NUMBER < 0x10000000L) || defined(LIBRESSL_VERSION_NUMBER)
ERR_remove_state(0);
#else
ERR_remove_thread_state(NULL);
#endif
}
#endif
return TRUE;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:38,代码来源:ssl.c
示例2: MS_TRACE
void OpenSSL::ClassDestroy() {
MS_TRACE();
MS_DEBUG("unloading openssl");
// FAQ: https://www.openssl.org/support/faq.html#PROG13
// Thread-local cleanup functions.
ERR_remove_thread_state(nullptr);
// Application-global cleanup functions that are aware of usage (and
// therefore thread-safe).
ENGINE_cleanup();
// "Brutal" (thread-unsafe) Application-global cleanup functions.
ERR_free_strings();
EVP_cleanup(); // Removes all ciphers and digests.
CRYPTO_cleanup_all_ex_data();
// https://bugs.launchpad.net/percona-server/+bug/1341067.
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
// Free mutexes.
for (int i=0; i<OpenSSL::numMutexes; i++) {
int err = pthread_mutex_destroy(&OpenSSL::mutexes[i]);
if (err)
MS_ERROR("pthread_mutex_destroy() failed with return code %d\n", err);
}
if (OpenSSL::mutexes)
delete[] OpenSSL::mutexes;
// Reset callbacks.
CRYPTO_THREADID_set_callback(nullptr);
CRYPTO_set_locking_callback(nullptr);
CRYPTO_set_dynlock_create_callback(nullptr);
CRYPTO_set_dynlock_lock_callback(nullptr);
CRYPTO_set_dynlock_destroy_callback(nullptr);
}
开发者ID:haskellove,项目名称:MediaSoup,代码行数:38,代码来源:OpenSSL.cpp
示例3: SSL_CTX_free
void OpenSSLSession::Stop()
{
if(!m_bStarted)
{
return;
}
if(m_ConnectionCtx)
{
SSL_CTX_free(m_ConnectionCtx);
m_ConnectionCtx = 0;
}
ERR_remove_state(0);
ENGINE_cleanup();
CONF_modules_unload(1);
ERR_free_strings();
EVP_cleanup();
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
CRYPTO_cleanup_all_ex_data();
m_bStarted = false;
}
开发者ID:palaniyappanBala,项目名称:ServerClient,代码行数:23,代码来源:SocketSession.cpp
示例4: stop_ssl
/**
* Stop SSL support library
* @return TRUE, or FALSE if an error has occured.
*/
int stop_ssl() {
#ifdef HAVE_OPENSSL
if ( ssl_initilized ) {
ssl_initilized=FALSE;
ERR_free_strings();
return (ssl_thread_stop() && ssl_entropy_stop());
} else {
return TRUE;
}
#else
return FALSE;
#endif
}
开发者ID:jiejiuzhang1579,项目名称:nicad,代码行数:27,代码来源:ssl.c
示例5: tls_deinit
void
tls_deinit(void)
{
if (tls_initialised) {
tls_compat_cleanup();
tls_config_free(tls_config_default);
tls_config_default = NULL;
#ifdef USE_LIBSSL_INTERNALS
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
BIO_sock_cleanup();
ERR_clear_error();
ERR_remove_thread_state(NULL);
ERR_free_strings();
#else
OPENSSL_cleanup();
#endif
tls_initialised = 0;
}
}
开发者ID:markokr,项目名称:libusual,代码行数:23,代码来源:tls.c
示例6: defined
UtlBoolean OsEncryption::openSslError(void)
{
#if defined(OSENCRYPTION)
unsigned long err = ERR_get_error();
if (err != 0)
{
ERR_load_crypto_strings();
ERR_load_ERR_strings();
char errbuff[256];
errbuff[0] = 0;
ERR_error_string_n(err, errbuff, sizeof(errbuff));
osPrintf("OpenSLL ERROR:\n\tlib:%s\n\tfunction:%s\n\treason:%s\n",
ERR_lib_error_string(err),
ERR_func_error_string(err),
ERR_reason_error_string(err));
ERR_free_strings();
return TRUE;
}
#endif
return FALSE;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:23,代码来源:OsEncryption.cpp
示例7: sign_deinit
/**
* @brief Deinitialize the signing subsystem
*
* @param none
*
* @returns Nothing
*/
void sign_deinit(void) {
if (rsa) {
RSA_free(rsa);
rsa = NULL;
}
if (crypto_initialized) {
/* (From: https://wiki.openssl.org/index.php/Libcrypto_API) */
/* Removes all digests and ciphers */
EVP_cleanup();
/**
* if you omit the next, a small leak may be left when you make use
* of the BIO (low level API) for e.g. base64 transformations
*/
CRYPTO_cleanup_all_ex_data();
/* Remove error strings */
ERR_free_strings();
crypto_initialized = false;
}
}
开发者ID:JoshKaufman,项目名称:bootrom-tools,代码行数:30,代码来源:sign.c
示例8: Curl_SSL_cleanup
/* Global cleanup */
void Curl_SSL_cleanup(void)
{
#ifdef USE_SSLEAY
if(init_ssl) {
/* only cleanup if we did a previous init */
/* Free the SSL error strings */
ERR_free_strings();
/* EVP_cleanup() removes all ciphers and digests from the
table. */
EVP_cleanup();
#ifdef HAVE_ENGINE_cleanup
ENGINE_cleanup();
#endif
init_ssl=0; /* not inited any more */
}
#else
/* SSL disabled, do nothing */
#endif
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:24,代码来源:ssluse.c
示例9: ssl_cleanup_pre_config
/*
* the various processing hooks
*/
static apr_status_t ssl_cleanup_pre_config(void *data)
{
/*
* Try to kill the internals of the SSL library.
*/
/* Corresponds to OPENSSL_load_builtin_modules():
* XXX: borrowed from apps.h, but why not CONF_modules_free()
* which also invokes CONF_modules_finish()?
*/
CONF_modules_unload(1);
/* Corresponds to SSL_library_init: */
EVP_cleanup();
#if HAVE_ENGINE_LOAD_BUILTIN_ENGINES
ENGINE_cleanup();
#endif
ERR_remove_state(0);
/* Don't call ERR_free_strings in earlier versions, ERR_load_*_strings only
* actually loaded the error strings once per process due to static
* variable abuse in OpenSSL. */
#if (OPENSSL_VERSION_NUMBER >= 0x00090805f)
ERR_free_strings();
#endif
/* Also don't call CRYPTO_cleanup_all_ex_data here; any registered
* ex_data indices may have been cached in static variables in
* OpenSSL; removing them may cause havoc. Notably, with OpenSSL
* versions >= 0.9.8f, COMP_CTX cleanups would not be run, which
* could result in a per-connection memory leak (!). */
/*
* TODO: determine somewhere we can safely shove out diagnostics
* (when enabled) at this late stage in the game:
* CRYPTO_mem_leaks_fp(stderr);
*/
return APR_SUCCESS;
}
开发者ID:Summyhaha,项目名称:Tomcat,代码行数:40,代码来源:mod_ssl.c
示例10: _cckit_destroy_http_request
bool_t CC_CALL _cckit_destroy_http_request(cckit_http_t **h)
{
if (h == NULL || *h == NULL) {
return FALSE;
}
#ifdef CC_OPENSSL_HTTPS
if ((*h)->address->scheme == CC_SCHEME_HTTPS) {
if ((*h)->ssl) {
SSL_shutdown((*h)->ssl);
SSL_free((*h)->ssl);
SSL_CTX_free((*h)->ssl_ctx);
}
/*SSL*/
if(cc_atomic_dec_ref(_SSL_init_refcount)) {
ERR_free_strings();
}
}
#endif
if ((*h)->response) {
_cckit_destroy_http_response(&(*h)->response);
}
if ((*h)->address) {
cc_destroy_url(&(*h)->address);
}
if ((*h)->sock_event) {
cckit_data_buffer_pop((cckit_data_buffer_t**)&(*h)->sock_event->args[2]);
cckit_tcp_close((*h)->sock_event);
(*h)->sock_event = NULL;
}
cc_free((*h));
*h = NULL;
return TRUE;
}
开发者ID:CCQIU,项目名称:CC,代码行数:37,代码来源:http_request.c
示例11: mysql_server_end
/*
Release SSL and free resources
Will be automatically executed by
mysql_server_end() function
SYNOPSIS
my_ssl_end()
void
RETURN VALUES
void
*/
void ma_tls_end()
{
if (ma_tls_initialized)
{
int i;
pthread_mutex_lock(&LOCK_openssl_config);
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_id_callback(NULL);
for (i=0; i < CRYPTO_num_locks(); i++)
pthread_mutex_destroy(&LOCK_crypto[i]);
ma_free((gptr)LOCK_crypto);
LOCK_crypto= NULL;
if (SSL_context)
{
SSL_CTX_free(SSL_context);
SSL_context= NULL;
}
if (mariadb_deinitialize_ssl)
{
ERR_remove_state(0);
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
CONF_modules_free();
CONF_modules_unload(1);
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
}
ma_tls_initialized= FALSE;
pthread_mutex_unlock(&LOCK_openssl_config);
pthread_mutex_destroy(&LOCK_openssl_config);
}
return;
}
开发者ID:Torndeco,项目名称:mariadb-connector-c,代码行数:48,代码来源:openssl.c
示例12: _free
static ret_t
_free (cherokee_cryptor_libssl_t *cryp)
{
/* DH Parameters
*/
if (dh_param_512 != NULL) {
DH_free (dh_param_512);
dh_param_512 = NULL;
}
if (dh_param_1024 != NULL) {
DH_free (dh_param_1024);
dh_param_1024 = NULL;
}
if (dh_param_2048 != NULL) {
DH_free (dh_param_2048);
dh_param_2048 = NULL;
}
if (dh_param_4096 != NULL) {
DH_free (dh_param_4096);
dh_param_4096 = NULL;
}
/* Free loaded error strings
*/
ERR_free_strings();
/* Free all ciphers and digests
*/
EVP_cleanup();
cherokee_cryptor_free_base (CRYPTOR(cryp));
return ret_ok;
}
开发者ID:Daniel15,项目名称:webserver,代码行数:36,代码来源:cryptor_libssl.c
示例13: 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 < 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
}
开发者ID:hhool,项目名称:libwebsockets,代码行数:36,代码来源:ssl.c
示例14: DllMain
bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, void* lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
module = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
#ifndef USE_CURL
SSL_library_init();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
#else
curl_global_init(CURL_GLOBAL_ALL);
#endif
break;
case DLL_PROCESS_DETACH:
#ifndef USE_CURL
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#else
curl_global_cleanup();
#endif
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return true;
}
开发者ID:Brandon-T,项目名称:ProSocks,代码行数:36,代码来源:main.c
示例15: 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 < 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
}
开发者ID:335920284,项目名称:libwebsockets,代码行数:24,代码来源:ssl.c
示例16: tor_cleanup
void
tor_cleanup (void)
{
if (!initialized) {
return;
}
EVP_cleanup();
ERR_remove_state(0);
ERR_free_strings();
ENGINE_cleanup();
CONF_modules_unload(1);
CRYPTO_cleanup_all_ex_data();
// cleanup multithreading
for (size_t i = 0; i < locks.length; i++) {
uv_mutex_destroy(&locks.item[i]);
}
free(locks.item);
locks.length = 0;
}
开发者ID:postfix,项目名称:libtor,代码行数:24,代码来源:tor.c
示例17: main
//.........这里部分代码省略.........
tvhftrace("main", service_done);
tvhftrace("main", channel_done);
tvhftrace("main", bouquet_done);
tvhftrace("main", dvr_done);
tvhftrace("main", subscription_done);
tvhftrace("main", access_done);
tvhftrace("main", epg_done);
tvhftrace("main", avahi_done);
tvhftrace("main", bonjour_done);
tvhftrace("main", imagecache_done);
tvhftrace("main", lang_code_done);
tvhftrace("main", api_done);
tvhtrace("main", "tasklet enter");
pthread_cond_signal(&tasklet_cond);
pthread_join(tasklet_tid, NULL);
tvhtrace("main", "tasklet thread end");
tasklet_flush();
tvhtrace("main", "tasklet leave");
tvhftrace("main", hts_settings_done);
tvhftrace("main", dvb_done);
tvhftrace("main", lang_str_done);
tvhftrace("main", esfilter_done);
tvhftrace("main", profile_done);
tvhftrace("main", intlconv_done);
tvhftrace("main", urlparse_done);
tvhftrace("main", idnode_done);
tvhftrace("main", notify_done);
tvhftrace("main", spawn_done);
tvhlog(LOG_NOTICE, "STOP", "Exiting HTS Tvheadend");
tvhlog_end();
tvhftrace("main", config_done);
if(opt_fork)
unlink(opt_pidpath);
#if ENABLE_TSFILE
free(opt_tsfile.str);
#endif
free(opt_satip_xml.str);
/* OpenSSL - welcome to the "cleanup" hell */
ENGINE_cleanup();
RAND_cleanup();
CRYPTO_cleanup_all_ex_data();
EVP_cleanup();
CONF_modules_free();
#ifndef OPENSSL_NO_COMP
COMP_zlib_cleanup();
#endif
ERR_remove_state(0);
ERR_free_strings();
#ifndef OPENSSL_NO_COMP
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
#endif
/* end of OpenSSL cleanup code */
#if ENABLE_DBUS_1
extern void dbus_shutdown(void);
if (opt_dbus) dbus_shutdown();
#endif
return 0;
}
/**
*
*/
void
tvh_str_set(char **strp, const char *src)
{
free(*strp);
*strp = src ? strdup(src) : NULL;
}
/**
*
*/
int
tvh_str_update(char **strp, const char *src)
{
if(src == NULL)
return 0;
free(*strp);
*strp = strdup(src);
return 1;
}
/**
*
*/
void
scopedunlock(pthread_mutex_t **mtxp)
{
pthread_mutex_unlock(*mtxp);
}
开发者ID:bigbig6,项目名称:tvheadend,代码行数:101,代码来源:main.c
示例18: Init_openssl
//.........这里部分代码省略.........
*
*/
void
Init_openssl()
{
/*
* Init timezone info
*/
#if 0
tzset();
#endif
/*
* Init all digests, ciphers
*/
/* CRYPTO_malloc_init(); */
/* ENGINE_load_builtin_engines(); */
OpenSSL_add_ssl_algorithms();
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
SSL_load_error_strings();
/*
* FIXME:
* On unload do:
*/
#if 0
CONF_modules_unload(1);
destroy_ui_method();
EVP_cleanup();
ENGINE_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_remove_state(0);
ERR_free_strings();
#endif
/*
* Init main module
*/
mOSSL = rb_define_module("OpenSSL");
rb_global_variable(&mOSSL);
/*
* OpenSSL ruby extension version
*/
rb_define_const(mOSSL, "VERSION", rb_str_new2(OSSL_VERSION));
/*
* Version of OpenSSL the ruby OpenSSL extension was built with
*/
rb_define_const(mOSSL, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
/*
* Version number of OpenSSL the ruby OpenSSL extension was built with
* (base 16)
*/
rb_define_const(mOSSL, "OPENSSL_VERSION_NUMBER", INT2NUM(OPENSSL_VERSION_NUMBER));
/*
* Boolean indicating whether OpenSSL is FIPS-enabled or not
*/
#ifdef HAVE_OPENSSL_FIPS
rb_define_const(mOSSL, "OPENSSL_FIPS", Qtrue);
#else
rb_define_const(mOSSL, "OPENSSL_FIPS", Qfalse);
#endif
开发者ID:Danylyuk,项目名称:first_app,代码行数:67,代码来源:ossl.c
示例19: main
//.........这里部分代码省略.........
/* Should still be off even after ALL Protocols on */
if (!checksslv2(currtest, SSLV2OFF)) {
BIO_printf(err, "SSLv2 CONF Test: Off after config #1 FAIL\n");
goto end;
}
if (SSL_CONF_cmd(confctx, "Protocol", "SSLv2") != 2
|| !SSL_CONF_CTX_finish(confctx)) {
BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");
goto end;
}
/* Should still be off even if explicitly asked for */
if (!checksslv2(currtest, SSLV2OFF)) {
BIO_printf(err, "SSLv2 CONF Test: Off after config #2 FAIL\n");
goto end;
}
if (SSL_CONF_cmd(confctx, "Protocol", "-SSLv2") != 2
|| !SSL_CONF_CTX_finish(confctx)) {
BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");;
goto end;
}
if (!checksslv2(currtest, SSLV2OFF)) {
BIO_printf(err, "SSLv2 CONF Test: Off after config #3 FAIL\n");
goto end;
}
if (currtest == TEST_SSL_CTX)
SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv2);
else
SSL_clear_options(ssl, SSL_OP_NO_SSLv2);
if (!checksslv2(currtest, SSLV2ON)) {
BIO_printf(err, "SSLv2 CONF Test: On after clear FAIL\n");
goto end;
}
if (SSL_CONF_cmd(confctx, "Protocol", "ALL") != 2
|| !SSL_CONF_CTX_finish(confctx)) {
BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");
goto end;
}
/* Option has been cleared and config says have SSLv2 so should be on */
if (!checksslv2(currtest, SSLV2ON)) {
BIO_printf(err, "SSLv2 CONF Test: On after config #1 FAIL\n");
goto end;
}
if (SSL_CONF_cmd(confctx, "Protocol", "SSLv2") != 2
|| !SSL_CONF_CTX_finish(confctx)) {
BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");
goto end;
}
/* Option has been cleared and config says have SSLv2 so should be on */
if (!checksslv2(currtest, SSLV2ON)) {
BIO_printf(err, "SSLv2 CONF Test: On after config #2 FAIL\n");
goto end;
}
if (SSL_CONF_cmd(confctx, "Protocol", "-SSLv2") != 2
|| !SSL_CONF_CTX_finish(confctx)) {
BIO_printf(err, "SSLv2 CONF Test: SSL_CONF command FAIL\n");
goto end;
}
/* Option has been cleared but config says no SSLv2 so should be off */
if (!checksslv2(currtest, SSLV2OFF)) {
BIO_printf(err, "SSLv2 CONF Test: Off after config #4 FAIL\n");
goto end;
}
}
testresult = 1;
end:
SSL_free(ssl);
SSL_CTX_free(ctx);
SSL_CONF_CTX_free(confctx);
if (!testresult) {
printf("SSLv2 CONF test: FAILED (Test %d)\n", currtest);
ERR_print_errors(err);
} else {
printf("SSLv2 CONF test: PASSED\n");
}
ERR_free_strings();
ERR_remove_thread_state(NULL);
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
CRYPTO_mem_leaks(err);
BIO_free(err);
return testresult ? EXIT_SUCCESS : EXIT_FAILURE;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:101,代码来源:sslv2conftest.c
示例20: main
//.........这里部分代码省略.........
/* Load up the software EVP_CIPHER and EVP_MD definitions */
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
/* Load all compiled-in ENGINEs */
ENGINE_load_builtin_engines();
#endif
#if 0
OPENSSL_config();
#endif
#ifndef OPENSSL_NO_ENGINE
/* Register all available ENGINE implementations of ciphers and digests.
* This could perhaps be changed to "ENGINE_register_all_complete()"? */
ENGINE_register_all_ciphers();
ENGINE_register_all_digests();
/* If we add command-line options, this statement should be switchable.
* It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if
* they weren't already initialised. */
/* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
#endif
for( ; ; )
{
char line[4096];
char *p;
char *cipher;
unsigned char *iv,*key,*plaintext,*ciphertext;
int encdec;
int kn,in,pn,cn;
if(!fgets((char *)line,sizeof line,f))
break;
if(line[0] == '#' || line[0] == '\n')
continue;
p=line;
cipher=sstrsep(&p,":");
key=ustrsep(&p,":");
iv=ustrsep(&p,":");
plaintext=ustrsep(&p,":");
ciphertext=ustrsep(&p,":");
if (p[-1] == '\n') {
p[-1] = '\0';
encdec = -1;
} else {
encdec = atoi(sstrsep(&p,"\n"));
}
kn=convert(key);
in=convert(iv);
pn=convert(plaintext);
cn=convert(ciphertext);
if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec)
&& !test_digest(cipher,plaintext,pn,ciphertext,cn))
{
#ifdef OPENSSL_NO_AES
if (strstr(cipher, "AES") == cipher)
{
fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
continue;
}
#endif
#ifdef OPENSSL_NO_DES
if (strstr(cipher, "DES") == cipher)
{
fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
continue;
}
#endif
#ifdef OPENSSL_NO_RC4
if (strstr(cipher, "RC4") == cipher)
{
fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
continue;
}
#endif
#ifdef OPENSSL_NO_CAMELLIA
if (strstr(cipher, "CAMELLIA") == cipher)
{
fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
continue;
}
#endif
fprintf(stderr,"Can't find %s\n",cipher);
EXIT(3);
}
}
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_remove_state(0);
ERR_free_strings();
CRYPTO_mem_leaks_fp(stderr);
return 0;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:101,代码来源:evp_test.c
注:本文中的ERR_free_strings函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论