diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/str/libkvistr.cpp | 22 |
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++) { |