mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Add support for openssl built with "no-deprecated".
Patch from Andrew John Hughes; partial fix for 19981.
This commit is contained in:
parent
8e562874a4
commit
a15b2c57e1
@ -116,7 +116,11 @@ aes_cipher_free_(aes_cnt_cipher_t *cipher_)
|
|||||||
if (!cipher_)
|
if (!cipher_)
|
||||||
return;
|
return;
|
||||||
EVP_CIPHER_CTX *cipher = (EVP_CIPHER_CTX *) cipher_;
|
EVP_CIPHER_CTX *cipher = (EVP_CIPHER_CTX *) cipher_;
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
|
||||||
|
EVP_CIPHER_CTX_reset(cipher);
|
||||||
|
#else
|
||||||
EVP_CIPHER_CTX_cleanup(cipher);
|
EVP_CIPHER_CTX_cleanup(cipher);
|
||||||
|
#endif
|
||||||
EVP_CIPHER_CTX_free(cipher);
|
EVP_CIPHER_CTX_free(cipher);
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -43,6 +43,7 @@ DISABLE_GCC_WARNING(redundant-decls)
|
|||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/conf.h>
|
#include <openssl/conf.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
ENABLE_GCC_WARNING(redundant-decls)
|
ENABLE_GCC_WARNING(redundant-decls)
|
||||||
|
|
||||||
@ -204,8 +205,15 @@ crypto_early_init(void)
|
|||||||
|
|
||||||
crypto_early_initialized_ = 1;
|
crypto_early_initialized_ = 1;
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
|
||||||
|
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS |
|
||||||
|
OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
|
||||||
|
OPENSSL_INIT_ADD_ALL_CIPHERS |
|
||||||
|
OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
|
||||||
|
#else
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
|
#endif
|
||||||
|
|
||||||
setup_openssl_threading();
|
setup_openssl_threading();
|
||||||
|
|
||||||
@ -1660,11 +1668,15 @@ memwipe(void *mem, uint8_t byte, size_t sz)
|
|||||||
int
|
int
|
||||||
crypto_global_cleanup(void)
|
crypto_global_cleanup(void)
|
||||||
{
|
{
|
||||||
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
|
||||||
EVP_cleanup();
|
EVP_cleanup();
|
||||||
|
#endif
|
||||||
#ifndef NEW_THREAD_API
|
#ifndef NEW_THREAD_API
|
||||||
ERR_remove_thread_state(NULL);
|
ERR_remove_thread_state(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
|
||||||
ERR_free_strings();
|
ERR_free_strings();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dh_param_p)
|
if (dh_param_p)
|
||||||
BN_clear_free(dh_param_p);
|
BN_clear_free(dh_param_p);
|
||||||
@ -1676,11 +1688,15 @@ crypto_global_cleanup(void)
|
|||||||
dh_param_p = dh_param_p_tls = dh_param_g = NULL;
|
dh_param_p = dh_param_p_tls = dh_param_g = NULL;
|
||||||
|
|
||||||
#ifndef DISABLE_ENGINES
|
#ifndef DISABLE_ENGINES
|
||||||
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
|
||||||
ENGINE_cleanup();
|
ENGINE_cleanup();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CONF_modules_unload(1);
|
CONF_modules_unload(1);
|
||||||
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,1,0)
|
||||||
CRYPTO_cleanup_all_ex_data();
|
CRYPTO_cleanup_all_ex_data();
|
||||||
|
#endif
|
||||||
|
|
||||||
crypto_openssl_free_all();
|
crypto_openssl_free_all();
|
||||||
|
|
||||||
|
@ -56,10 +56,21 @@ ENABLE_GCC_WARNING(redundant-decls)
|
|||||||
#include "container.h"
|
#include "container.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
|
||||||
|
#define X509_get_notBefore_const(cert) \
|
||||||
|
X509_get0_notBefore(cert)
|
||||||
|
#define X509_get_notAfter_const(cert) \
|
||||||
|
X509_get0_notAfter(cert)
|
||||||
|
#define X509_get_notBefore(cert) \
|
||||||
|
X509_getm_notBefore(cert)
|
||||||
|
#define X509_get_notAfter(cert) \
|
||||||
|
X509_getm_notAfter(cert)
|
||||||
|
#else
|
||||||
#define X509_get_notBefore_const(cert) \
|
#define X509_get_notBefore_const(cert) \
|
||||||
((const ASN1_TIME*) X509_get_notBefore((X509 *)cert))
|
((const ASN1_TIME*) X509_get_notBefore((X509 *)cert))
|
||||||
#define X509_get_notAfter_const(cert) \
|
#define X509_get_notAfter_const(cert) \
|
||||||
((const ASN1_TIME*) X509_get_notAfter((X509 *)cert))
|
((const ASN1_TIME*) X509_get_notAfter((X509 *)cert))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Copied from or.h */
|
/* Copied from or.h */
|
||||||
#define LEGAL_NICKNAME_CHARACTERS \
|
#define LEGAL_NICKNAME_CHARACTERS \
|
||||||
@ -355,8 +366,12 @@ tor_tls_init(void)
|
|||||||
check_no_tls_errors();
|
check_no_tls_errors();
|
||||||
|
|
||||||
if (!tls_library_is_initialized) {
|
if (!tls_library_is_initialized) {
|
||||||
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0)
|
||||||
|
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
|
||||||
|
#else
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (SIZEOF_VOID_P >= 8 && \
|
#if (SIZEOF_VOID_P >= 8 && \
|
||||||
OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,1))
|
OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,1))
|
||||||
|
Loading…
Reference in New Issue
Block a user