mirror of
https://github.com/aria2/aria2.git
synced 2025-02-26 08:22:11 +00:00
Compile with openssl 1.1.0
We moved @CPPUNIT_LIBS@ to later position. This is because in my development environment, it adds linker search directory which contains system default openssl, while I'd like to use my custom openssl installation. This fix is not universal, since other libraries can do the same thing. It is a bit hard to fix this properly because we mix -L and -l in a same variable.
This commit is contained in:
parent
7a31f9bf29
commit
3cdde0f425
@ -38,10 +38,11 @@
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include "Adler32MessageDigestImpl.h"
|
||||
#include "libssl_compat.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100001L
|
||||
#if !OPENSSL_101_API
|
||||
namespace {
|
||||
EVP_MD_CTX* EVP_MD_CTX_new() { return EVP_MD_CTX_create(); }
|
||||
} // namespace
|
||||
@ -57,8 +58,7 @@ int EVP_MD_CTX_reset(EVP_MD_CTX* ctx)
|
||||
return 1;
|
||||
}
|
||||
} // namespace
|
||||
#endif // defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER <
|
||||
// 0x10100001L
|
||||
#endif // !OPENSSL_101_API
|
||||
|
||||
template <const EVP_MD* (*init_fn)()>
|
||||
class MessageDigestBase : public MessageDigestImpl {
|
||||
|
@ -44,6 +44,15 @@
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
#if !OPENSSL_101_API
|
||||
namespace {
|
||||
const unsigned char* ASN1_STRING_get0_data(ASN1_STRING* x)
|
||||
{
|
||||
return ASN1_STRING_data(x);
|
||||
}
|
||||
} // namespace
|
||||
#endif // !OPENSSL_101_API
|
||||
|
||||
TLSSession* TLSSession::make(TLSContext* ctx)
|
||||
{
|
||||
return new OpenSSLTLSSession(static_cast<OpenSSLTLSContext*>(ctx));
|
||||
@ -253,8 +262,7 @@ int OpenSSLTLSSession::tlsConnect(const std::string& hostname,
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
const GENERAL_NAME* altName = sk_GENERAL_NAME_value(altNames, i);
|
||||
if (altName->type == GEN_DNS) {
|
||||
const char* name =
|
||||
reinterpret_cast<char*>(ASN1_STRING_data(altName->d.ia5));
|
||||
auto name = ASN1_STRING_get0_data(altName->d.ia5);
|
||||
if (!name) {
|
||||
continue;
|
||||
}
|
||||
@ -268,7 +276,7 @@ int OpenSSLTLSSession::tlsConnect(const std::string& hostname,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dnsNames.push_back(std::string(name, len));
|
||||
dnsNames.push_back(std::string(name, name + len));
|
||||
}
|
||||
else if (altName->type == GEN_IPADD) {
|
||||
const unsigned char* ipAddr = altName->d.iPAddress->data;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "LibsslTLSContext.h"
|
||||
#include "TLSSession.h"
|
||||
#include "a2netcompat.h"
|
||||
#include "libssl_compat.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
43
src/libssl_compat.h
Normal file
43
src/libssl_compat.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2016 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef LIBSSL_COMPAT_H
|
||||
#define LIBSSL_COMPAT_H
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#define OPENSSL_101_API \
|
||||
(!defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x1010000fL)
|
||||
|
||||
#endif // LIBSSL_COMPAT_H
|
@ -243,7 +243,6 @@ endif # ENABLE_LIBARIA2
|
||||
aria2c_LDADD = \
|
||||
../src/libaria2.la \
|
||||
@LIBINTL@ \
|
||||
@CPPUNIT_LIBS@ \
|
||||
@EXTRALIBS@ \
|
||||
@ZLIB_LIBS@ \
|
||||
@LIBUV_LIBS@ \
|
||||
@ -259,6 +258,7 @@ aria2c_LDADD = \
|
||||
@LIBSSH2_LIBS@ \
|
||||
@LIBCARES_LIBS@ \
|
||||
@WSLAY_LIBS@ \
|
||||
@CPPUNIT_LIBS@ \
|
||||
@TCMALLOC_LIBS@ \
|
||||
@JEMALLOC_LIBS@
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user