summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatías Fonzo <[email protected]>2020-01-20 19:33:12 -0300
committerSlávek Banko <[email protected]>2020-01-21 12:51:36 +0100
commit41462673adf382a1c626087bac2df801ac92ca63 (patch)
treed2453bf797f577b18aa64ecfd94a6cb1e11375ca
parent1bc63c30d21028ffe749c1ffd66b607ceaa93aa8 (diff)
downloadtqca-tls-41462673adf382a1c626087bac2df801ac92ca63.tar.gz
tqca-tls-41462673adf382a1c626087bac2df801ac92ca63.zip
Added LibreSSL detectionr14.0.8
Signed-off-by: Matías Fonzo <[email protected]> (cherry picked from commit 9cd1493c36e94b9bfd36e35bc197ecf87634970e)
-rw-r--r--qca-tls.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/qca-tls.cpp b/qca-tls.cpp
index b1fb639..b5080ed 100644
--- a/qca-tls.cpp
+++ b/qca-tls.cpp
@@ -57,7 +57,7 @@ static bool lib_generateKeyIV(const EVP_CIPHER *_type, const TQByteArray &data,
TQByteArray k, i;
unsigned char *kp = 0;
unsigned char *ip = 0;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER type = *_type;
EVP_CIPHER *loctype = &type;
if(keysize != -1)
@@ -75,7 +75,7 @@ static bool lib_generateKeyIV(const EVP_CIPHER *_type, const TQByteArray &data,
ip = (unsigned char *)i.data();
}
int res = EVP_BytesToKey(loctype, EVP_sha1(), (unsigned char *)salt.data(), (unsigned char *)data.data(), data.size(), 1, kp, ip);
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER_meth_free(loctype);
#endif
if (!res)
@@ -187,7 +187,7 @@ public:
virtual ~EVPCipherContext()
{
if(type) {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER_CTX_cleanup(c);
OPENSSL_free(c);
#else
@@ -234,7 +234,7 @@ public:
pad = _pad;
type = getType(mode);
r.resize(0);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
c = (EVP_CIPHER_CTX*)OPENSSL_malloc(sizeof(EVP_CIPHER_CTX));
EVP_CIPHER_CTX_init(c);
#else
@@ -283,11 +283,11 @@ public:
TQByteArray result(EVP_CIPHER_block_size(type));
int olen;
if(dir == TQCA::Encrypt) {
- if(!EVP_EncryptFinal(c, (unsigned char *)result.data(), &olen))
+ if(!EVP_EncryptFinal_ex(c, (unsigned char *)result.data(), &olen))
return false;
}
else {
- if(!EVP_DecryptFinal(c, (unsigned char *)result.data(), &olen))
+ if(!EVP_DecryptFinal_ex(c, (unsigned char *)result.data(), &olen))
return false;
}
result.resize(olen);