diff options
| author | 2017-12-11 04:06:41 -0600 | |
|---|---|---|
| committer | 2017-12-11 11:06:41 +0100 | |
| commit | ed2a156892c5ce9a1ab54c50031ba59a9a34485f (patch) | |
| tree | 4e0bb3a7e703586b074f7228a7176aad45cf0246 /src/modules/file/libkvifile.cpp | |
| parent | AppVeyor: Updated OpenSSL version to 1.0.2m (diff) | |
| download | KVIrc-ed2a156892c5ce9a1ab54c50031ba59a9a34485f.tar.gz KVIrc-ed2a156892c5ce9a1ab54c50031ba59a9a34485f.tar.bz2 KVIrc-ed2a156892c5ce9a1ab54c50031ba59a9a34485f.zip | |
Support OpenSSL 1.1.0 (#2223)
Fixes #2151.
Diffstat (limited to 'src/modules/file/libkvifile.cpp')
| -rw-r--r-- | src/modules/file/libkvifile.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/modules/file/libkvifile.cpp b/src/modules/file/libkvifile.cpp index 5dac7ba0f..9025ad33d 100644 --- a/src/modules/file/libkvifile.cpp +++ b/src/modules/file/libkvifile.cpp @@ -53,6 +53,12 @@ #endif #include <openssl/evp.h> + +#if OPENSSL_VERSION_NUMBER < 0x10100005L +#define EVP_MD_CTX_new EVP_MD_CTX_create +#define EVP_MD_CTX_free EVP_MD_CTX_destroy +#endif + #else // The fallback we can always use, but with very limited set of // functionality. @@ -1553,7 +1559,7 @@ static bool file_kvs_fnc_digest(KviKvsModuleFunctionCall * c) if(szAlgo.isEmpty()) szAlgo = "md5"; - EVP_MD_CTX mdctx; + EVP_MD_CTX *mdctx; const EVP_MD * pMD; unsigned char ucMDValue[EVP_MAX_MD_SIZE]; unsigned int uMDLen, u; @@ -1567,11 +1573,11 @@ static bool file_kvs_fnc_digest(KviKvsModuleFunctionCall * c) return true; } - EVP_MD_CTX_init(&mdctx); - EVP_DigestInit_ex(&mdctx, pMD, nullptr); - EVP_DigestUpdate(&mdctx, content.constData(), content.size()); - EVP_DigestFinal_ex(&mdctx, ucMDValue, &uMDLen); - EVP_MD_CTX_cleanup(&mdctx); + mdctx = EVP_MD_CTX_new(); + EVP_DigestInit_ex(mdctx, pMD, nullptr); + EVP_DigestUpdate(mdctx, content.constData(), content.size()); + EVP_DigestFinal_ex(mdctx, ucMDValue, &uMDLen); + EVP_MD_CTX_free(mdctx); for(u = 0; u < uMDLen; u++) { |
