Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
> EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed to
Browse files Browse the repository at this point in the history
> 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)
  • Loading branch information
Greg Wickham committed Dec 26, 2016
1 parent e2bc941 commit db7e8ba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit db7e8ba

Please sign in to comment.