From db7e8bac9a6da48b22c3e183a464a9156db0a33d Mon Sep 17 00:00:00 2001 From: Greg Wickham Date: Mon, 26 Dec 2016 11:34:55 +0300 Subject: [PATCH] > EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed to > EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1. This patch permits compilation on RHEL7 systems (that have OpenSSL tagged as 1.0) --- cache.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cache.c b/cache.c index 0bdb4a81..78cbc861 100644 --- a/cache.c +++ b/cache.c @@ -45,12 +45,20 @@ static unsigned int sha_hash(const char *data, size_t size, unsigned char *out) const EVP_MD *md = EVP_get_digestbyname("SHA1"); if (md != NULL) { +#if OPENSSL_VERSION_NUMBER < 0x10100000 + EVP_MD_CTX *mdctx = EVP_MD_CTX_create(); +#else EVP_MD_CTX *mdctx = EVP_MD_CTX_new(); +#endif EVP_MD_CTX_init(mdctx); EVP_DigestInit_ex(mdctx, md, NULL); EVP_DigestUpdate(mdctx, data, size); EVP_DigestFinal_ex(mdctx, out, &md_len); +#if OPENSSL_VERSION_NUMBER < 0x10100000 + EVP_MD_CTX_destroy(mdctx); +#else EVP_MD_CTX_free(mdctx); +#endif } return md_len; }