aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-12-26 01:37:02 +0100
committerShauren <shauren.trinity@gmail.com>2017-12-26 01:37:02 +0100
commit130d3eb0ae171eee0a7292c408b12bf3ccf73d2f (patch)
treeca808f0a95d7160ce9c9167a3fd60adc5dc5e297 /src
parent60c756d3f8152eba0d0cab015e549778c9bb1660 (diff)
Core/Crypto: Add const_cast hack to fix linux build with openssl
Diffstat (limited to 'src')
-rw-r--r--src/common/Cryptography/RSA.cpp4
-rw-r--r--src/common/Cryptography/RSA.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/common/Cryptography/RSA.cpp b/src/common/Cryptography/RSA.cpp
index db880b642eb..c40907a56a1 100644
--- a/src/common/Cryptography/RSA.cpp
+++ b/src/common/Cryptography/RSA.cpp
@@ -77,7 +77,9 @@ bool Trinity::Crypto::RSA::LoadFromFile(std::string const& fileName, KeyTag)
template <typename KeyTag>
bool Trinity::Crypto::RSA::LoadFromString(std::string const& keyPem, KeyTag)
{
- std::unique_ptr<BIO, BIODeleter> keyBIO(BIO_new_mem_buf(keyPem.c_str(), keyPem.length() + 1));
+ std::unique_ptr<BIO, BIODeleter> keyBIO(BIO_new_mem_buf(
+ const_cast<char*>(keyPem.c_str()) /*api hack - this function assumes memory is readonly but lacks const modifier*/,
+ keyPem.length() + 1));
if (!keyBIO)
return false;
diff --git a/src/common/Cryptography/RSA.h b/src/common/Cryptography/RSA.h
index 865acac2211..42849c03e4d 100644
--- a/src/common/Cryptography/RSA.h
+++ b/src/common/Cryptography/RSA.h
@@ -24,7 +24,7 @@ namespace Trinity
{
namespace Crypto
{
-class RSA
+class TC_COMMON_API RSA
{
public:
struct NoPadding : std::integral_constant<int32, RSA_NO_PADDING> {};