Browse Source

Merge pull request #1281 from neheb/b

Fix compilation without deprecated OpenSSL APIs
pull/1285/head
orignal 6 years ago committed by GitHub
parent
commit
8f909b051f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      daemon/I2PControl.cpp
  2. 2
      libi2pd/Crypto.cpp
  3. 2
      libi2pd/Crypto.h
  4. 1
      libi2pd/Gost.cpp

4
daemon/I2PControl.cpp

@ -569,8 +569,8 @@ namespace client @@ -569,8 +569,8 @@ namespace client
EVP_PKEY_assign_RSA (pkey, rsa);
X509 * x509 = X509_new ();
ASN1_INTEGER_set (X509_get_serialNumber (x509), 1);
X509_gmtime_adj (X509_get_notBefore (x509), 0);
X509_gmtime_adj (X509_get_notAfter (x509), I2P_CONTROL_CERTIFICATE_VALIDITY*24*60*60); // expiration
X509_gmtime_adj (X509_getm_notBefore (x509), 0);
X509_gmtime_adj (X509_getm_notAfter (x509), I2P_CONTROL_CERTIFICATE_VALIDITY*24*60*60); // expiration
X509_set_pubkey (x509, pkey); // public key
X509_NAME * name = X509_get_subject_name (x509);
X509_NAME_add_entry_by_txt (name, "C", MBSTRING_ASC, (unsigned char *)"A1", -1, -1, 0); // country (Anonymous proxy)

2
libi2pd/Crypto.cpp

@ -1246,7 +1246,9 @@ namespace crypto @@ -1246,7 +1246,9 @@ namespace crypto
void InitCrypto (bool precomputation)
{
i2p::cpu::Detect ();
#if LEGACY_OPENSSL
SSL_library_init ();
#endif
/* auto numLocks = CRYPTO_num_locks();
for (int i = 0; i < numLocks; i++)
m_OpenSSLMutexes.emplace_back (new std::mutex);

2
libi2pd/Crypto.h

@ -23,6 +23,8 @@ @@ -23,6 +23,8 @@
// recognize openssl version and features
#if ((OPENSSL_VERSION_NUMBER < 0x010100000) || defined(LIBRESSL_VERSION_NUMBER)) // 1.0.2 and below or LibreSSL
# define LEGACY_OPENSSL 1
# define X509_getm_notBefore X509_get_notBefore
# define X509_getm_notAfter X509_get_notAfter
#else
# define LEGACY_OPENSSL 0
# if (OPENSSL_VERSION_NUMBER >= 0x010101000) // 1.1.1

1
libi2pd/Gost.cpp

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
#include <string.h>
#include <array>
#include <openssl/bn.h>
#include <openssl/sha.h>
#include <openssl/evp.h>
#include "I2PEndian.h"

Loading…
Cancel
Save