summaryrefslogtreecommitdiff
path: root/security/pev/files/patch-src_pehash.c
diff options
context:
space:
mode:
authorDanilo Egea Gondolfo <danilo@FreeBSD.org>2018-10-20 12:14:02 +0000
committerDanilo Egea Gondolfo <danilo@FreeBSD.org>2018-10-20 12:14:02 +0000
commit16e19f6313894e6d4648d09e7346641b20dbe756 (patch)
treed9c521a68e0d83338e86a47f39aebdd6d014b4fe /security/pev/files/patch-src_pehash.c
parent- Update to 0.1.7 (diff)
- Fix build after OpenSSL update on FreeBSD 12
PR: 232211 Submitted by: Nathan <ndowens AT yahoo.com>
Notes
Notes: svn path=/head/; revision=482494
Diffstat (limited to 'security/pev/files/patch-src_pehash.c')
-rw-r--r--security/pev/files/patch-src_pehash.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/security/pev/files/patch-src_pehash.c b/security/pev/files/patch-src_pehash.c
new file mode 100644
index 000000000000..2fdb879144c8
--- /dev/null
+++ b/security/pev/files/patch-src_pehash.c
@@ -0,0 +1,34 @@
+--- src/pehash.c.orig 2018-10-20 11:44:18 UTC
++++ src/pehash.c
+@@ -215,13 +215,25 @@ static void calc_hash(const char *alg_name, const unsi
+ unsigned char md_value[EVP_MAX_MD_SIZE];
+ unsigned int md_len;
+
+- EVP_MD_CTX md_ctx;
++ // See https://wiki.openssl.org/index.php/1.1_API_Changes
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ EVP_MD_CTX md_ctx_auto;
++ EVP_MD_CTX *md_ctx = &md_ctx_auto;
++#else
++ EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
++#endif
++
+ // FIXME: Handle errors - Check return values.
+- EVP_MD_CTX_init(&md_ctx);
+- EVP_DigestInit_ex(&md_ctx, md, NULL);
+- EVP_DigestUpdate(&md_ctx, data, size);
+- EVP_DigestFinal_ex(&md_ctx, md_value, &md_len);
+- EVP_MD_CTX_cleanup(&md_ctx);
++ EVP_MD_CTX_init(md_ctx);
++ EVP_DigestInit_ex(md_ctx, md, NULL);
++ EVP_DigestUpdate(md_ctx, data, size);
++ EVP_DigestFinal_ex(md_ctx, md_value, &md_len);
++
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++ EVP_MD_CTX_cleanup(md_ctx);
++#else
++ EVP_MD_CTX_free(md_ctx);
++#endif
+
+ for (unsigned int i=0; i < md_len; i++)
+ sprintf(&output[i * 2], "%02x", md_value[i]);