From 7da69e28fa8fdbb9050cf35a95479da4bf83f7f6 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 2 Nov 2018 08:18:02 +0000 Subject: [PATCH] MFH: r482494 - Fix build after OpenSSL update on FreeBSD 12 PR: 232211 Submitted by: Nathan --- security/pev/Makefile | 1 + security/pev/files/patch-src_pehash.c | 34 +++++++++++++++++++++++++++ security/pev/files/patch-src_pesec.c | 12 ++++++++++ 3 files changed, 47 insertions(+) create mode 100644 security/pev/files/patch-src_pehash.c create mode 100644 security/pev/files/patch-src_pesec.c diff --git a/security/pev/Makefile b/security/pev/Makefile index dc24013ab3ec..7e7c896cdf23 100644 --- a/security/pev/Makefile +++ b/security/pev/Makefile @@ -3,6 +3,7 @@ PORTNAME= pev PORTVERSION= 0.80 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-${PORTVERSION}/ 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]); diff --git a/security/pev/files/patch-src_pesec.c b/security/pev/files/patch-src_pesec.c new file mode 100644 index 000000000000..f991bb6c745a --- /dev/null +++ b/security/pev/files/patch-src_pesec.c @@ -0,0 +1,12 @@ +--- src/pesec.c.orig 2018-10-20 11:48:33 UTC ++++ src/pesec.c +@@ -225,7 +225,9 @@ static int parse_pkcs7_data(const options_t *options, + PKCS7 *p7 = NULL; + BIO *in = NULL; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + CRYPTO_malloc_init(); ++#endif + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); +