summaryrefslogtreecommitdiffstats
path: root/src/modules/str
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-01-10 01:47:10 +0100
committerSlávek Banko <slavek.banko@axis.cz>2017-01-10 01:47:10 +0100
commit08fa491feaf3a3923b1c9b6b2f52efd42232850e (patch)
treede9a3b56eb1e4844355a3649d5c13f8abf40281e /src/modules/str
parentc170347975ecc096314e9cf744d47ece6ffb1325 (diff)
downloadkvirc-08fa491feaf3a3923b1c9b6b2f52efd42232850e.tar.gz
kvirc-08fa491feaf3a3923b1c9b6b2f52efd42232850e.zip
Added support for OpenSSL 1.1
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/modules/str')
-rw-r--r--src/modules/str/libkvistr.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp
index 7cd6b0c5..e372f75a 100644
--- a/src/modules/str/libkvistr.cpp
+++ b/src/modules/str/libkvistr.cpp
@@ -1532,7 +1532,7 @@ static bool str_kvs_fnc_digest(KviKvsModuleFunctionCall * c)
if(szType.isEmpty()) szType="md5";
- EVP_MD_CTX mdctx;
+ EVP_MD_CTX *mdctx;
const EVP_MD *md;
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len, i;
@@ -1545,11 +1545,21 @@ static bool str_kvs_fnc_digest(KviKvsModuleFunctionCall * c)
return true;
}
- EVP_MD_CTX_init(&mdctx);
- EVP_DigestInit_ex(&mdctx, md, NULL);
- EVP_DigestUpdate(&mdctx, szString.utf8().data(), szString.utf8().length());
- EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
- EVP_MD_CTX_cleanup(&mdctx);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ mdctx = (EVP_MD_CTX*)OPENSSL_malloc(sizeof(EVP_MD_CTX));
+ EVP_MD_CTX_init(mdctx);
+#else
+ mdctx = EVP_MD_CTX_new();
+#endif
+ EVP_DigestInit_ex(mdctx, md, NULL);
+ EVP_DigestUpdate(mdctx, szString.utf8().data(), szString.utf8().length());
+ EVP_DigestFinal_ex(mdctx, md_value, &md_len);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ EVP_MD_CTX_cleanup(mdctx);
+ OPENSSL_free(mdctx);
+#else
+ EVP_MD_CTX_free(mdctx);
+#endif
for(i = 0; i < md_len; i++)
{