From 3e83fbfff0e1254d78f8715d24d4b1dd0f4af9da Mon Sep 17 00:00:00 2001 From: khorben Date: Tue, 22 Oct 2019 16:37:05 +0000 Subject: Update pev to version 0.80 The new patches fix compatibility with OpenSSL 1.1.0, and attempt to fix the build on FreeBSD, NetBSD, and OpenBSD. It does not link on NetBSD (like the previous version, 0.70) but it does on macOS. There was no changelog upstream. --- security/pev/Makefile | 5 +-- security/pev/PLIST | 27 ++++++----- security/pev/distinfo | 18 ++++---- security/pev/patches/patch-Makefile | 24 ---------- security/pev/patches/patch-lib_libpe_Makefile | 35 --------------- security/pev/patches/patch-src_Makefile | 64 +++++---------------------- security/pev/patches/patch-src_pehash.c | 30 +++++++++++++ security/pev/patches/patch-src_pepack.c | 29 ------------ security/pev/patches/patch-src_pesec.c | 16 +++++++ security/pev/patches/patch-src_plugins.c | 15 +++++++ 10 files changed, 100 insertions(+), 163 deletions(-) delete mode 100644 security/pev/patches/patch-Makefile delete mode 100644 security/pev/patches/patch-lib_libpe_Makefile create mode 100644 security/pev/patches/patch-src_pehash.c delete mode 100644 security/pev/patches/patch-src_pepack.c create mode 100644 security/pev/patches/patch-src_pesec.c create mode 100644 security/pev/patches/patch-src_plugins.c diff --git a/security/pev/Makefile b/security/pev/Makefile index f2a50bb1a60..51b9cfbafb4 100644 --- a/security/pev/Makefile +++ b/security/pev/Makefile @@ -1,8 +1,7 @@ -# $NetBSD: Makefile,v 1.4 2016/03/05 11:29:24 jperkin Exp $ +# $NetBSD: Makefile,v 1.5 2019/10/22 16:37:05 khorben Exp $ # -DISTNAME= pev-0.70 -PKGREVISION= 1 +DISTNAME= pev-0.80 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=pev/} diff --git a/security/pev/PLIST b/security/pev/PLIST index 4cf8d546afa..3caed23e291 100644 --- a/security/pev/PLIST +++ b/security/pev/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.2 2014/12/09 14:37:06 khorben Exp $ +@comment $NetBSD: PLIST,v 1.3 2019/10/22 16:37:05 khorben Exp $ bin/ofs2rva bin/pedis bin/pehash @@ -12,14 +12,19 @@ bin/rva2ofs lib/libpe.so lib/libpe.so.1 lib/libpe.so.1.0 -man/man1/ofs2rva.1.gz -man/man1/pedis.1.gz -man/man1/pehash.1.gz -man/man1/pepack.1.gz -man/man1/peres.1.gz -man/man1/pescan.1.gz -man/man1/pesec.1.gz -man/man1/pestr.1.gz -man/man1/readpe.1.gz -man/man1/rva2ofs.1.gz +lib/pev/plugins/csv_plugin.so +lib/pev/plugins/html_plugin.so +lib/pev/plugins/json_plugin.so +lib/pev/plugins/text_plugin.so +lib/pev/plugins/xml_plugin.so +man/man1/ofs2rva.1 +man/man1/pedis.1 +man/man1/pehash.1 +man/man1/pepack.1 +man/man1/peres.1 +man/man1/pescan.1 +man/man1/pesec.1 +man/man1/pestr.1 +man/man1/readpe.1 +man/man1/rva2ofs.1 share/pev/userdb.txt diff --git a/security/pev/distinfo b/security/pev/distinfo index 57e17d8683f..e02b3514454 100644 --- a/security/pev/distinfo +++ b/security/pev/distinfo @@ -1,10 +1,10 @@ -$NetBSD: distinfo,v 1.5 2015/11/04 01:18:00 agc Exp $ +$NetBSD: distinfo,v 1.6 2019/10/22 16:37:05 khorben Exp $ -SHA1 (pev-0.70.tar.gz) = b2d1191c3b57049c78ef77b8f54f7f78838af129 -RMD160 (pev-0.70.tar.gz) = 9ffe6dccecdfbeba09e34f9a212c2abcf3861ef0 -SHA512 (pev-0.70.tar.gz) = c98ea778b05b514ef26d87627484b5942247fb4190ad6a166ee2a01fc185dd4663848ca9b5ba3a26be5c8a40eaf42f476bec58ddea0565ac4c6fe0710c9575aa -Size (pev-0.70.tar.gz) = 254821 bytes -SHA1 (patch-Makefile) = 39b31541b2f51e82e9807aed36723105959aa26c -SHA1 (patch-lib_libpe_Makefile) = 11d1beba07b313a4baf2e95b5b56dfd7da4787f9 -SHA1 (patch-src_Makefile) = 2f04a23d40c1859ba1094a00822c0a0294fe3e5b -SHA1 (patch-src_pepack.c) = acb6dc0d1d9b20c13a61275b4f08f5903fec14f9 +SHA1 (pev-0.80.tar.gz) = 18dcb65269344b5047504cca8598477b33532bab +RMD160 (pev-0.80.tar.gz) = 01ed4fa37c5349397dbd8aa3b592b9657e63acf8 +SHA512 (pev-0.80.tar.gz) = d0c8ff8fcd60470899d5dbccfd7a7e4d960da007f42be9c7eab6b22a3d7cf4dde3c3d5cd9c7d70e369164503fb124640cf508ceda3d4792244cf33d11ab83321 +Size (pev-0.80.tar.gz) = 921102 bytes +SHA1 (patch-src_Makefile) = f51a9d6afa64de8ba761a9b889911403b0107aad +SHA1 (patch-src_pehash.c) = c31083fca0d98dc607eb4f8b338bd93dd714f594 +SHA1 (patch-src_pesec.c) = fa302aa9bf2f07558f6cef0c41b0cd9063df7706 +SHA1 (patch-src_plugins.c) = c85c5c3b918850c7383f30d2efdae38985cdd143 diff --git a/security/pev/patches/patch-Makefile b/security/pev/patches/patch-Makefile deleted file mode 100644 index 060f2d5e145..00000000000 --- a/security/pev/patches/patch-Makefile +++ /dev/null @@ -1,24 +0,0 @@ -$NetBSD: patch-Makefile,v 1.1 2014/12/09 14:37:06 khorben Exp $ - -No longer insist on a particular make(1) flavor - ---- Makefile.orig 2013-12-27 10:39:49.000000000 +0000 -+++ Makefile -@@ -1,14 +1,14 @@ - LIBPE_DIR = lib/libpe - PEV_DIR = src --MAKE = make -+#MAKE = make - VERSION = 0.70 - ZIPFILE = pev-$(VERSION)-win32.zip - - # just call each separated Makefile - all: - %: -- cd $(LIBPE_DIR); $(MAKE) $@ -- cd $(PEV_DIR); $(MAKE) $@ -+ cd $(LIBPE_DIR) && $(MAKE) $@ -+ cd $(PEV_DIR) && $(MAKE) $@ - - # zip rule only Cygwin targets - zip: diff --git a/security/pev/patches/patch-lib_libpe_Makefile b/security/pev/patches/patch-lib_libpe_Makefile deleted file mode 100644 index a33b0d098c4..00000000000 --- a/security/pev/patches/patch-lib_libpe_Makefile +++ /dev/null @@ -1,35 +0,0 @@ -$NetBSD: patch-lib_libpe_Makefile,v 1.2 2014/12/09 14:37:06 khorben Exp $ - -Fixed generation and installation of the libpe shared library on NetBSD - ---- lib/libpe/Makefile.orig 2013-12-27 10:39:52.000000000 +0000 -+++ lib/libpe/Makefile -@@ -70,6 +70,8 @@ libpe: CPPFLAGS += -D_GNU_SOURCE - libpe: $(libpe_OBJS) - ifeq ($(PLATFORM_OS), Linux) - $(LINK) -shared -Wl,-soname,$(LIBNAME).so.1 $(LDFLAGS) -o $(LIBNAME).so $^ -+else ifeq ($(PLATFORM_OS), NetBSD) -+ $(LINK) -shared -Wl,-soname,$(LIBNAME).so.1 $(LDFLAGS) -o $(LIBNAME).so $^ - else ifeq ($(PLATFORM_OS), Darwin) - $(LINK) -headerpad_max_install_names -dynamiclib \ - -flat_namespace -install_name $(LIBNAME).$(VERSION).dylib \ -@@ -88,6 +90,10 @@ ifeq ($(PLATFORM_OS), Linux) - $(INSTALL_DATA) $(LIBNAME).so $(DEST)/$(LIBNAME).so.$(VERSION) - cd $(DEST); $(SYMLINK) $(LIBNAME).so.$(VERSION) $(LIBNAME).so - cd $(DEST); $(SYMLINK) $(LIBNAME).so.$(VERSION) $(LIBNAME).so.1 -+else ifeq ($(PLATFORM_OS), NetBSD) -+ $(INSTALL_DATA) $(LIBNAME).so $(DEST)/$(LIBNAME).so.$(VERSION) -+ cd $(DEST); $(SYMLINK) $(LIBNAME).so.$(VERSION) $(LIBNAME).so -+ cd $(DEST); $(SYMLINK) $(LIBNAME).so.$(VERSION) $(LIBNAME).so.1 - else ifeq ($(PLATFORM_OS), Darwin) - $(INSTALL_DATA) $(LIBNAME).dylib $(DEST)/$(LIBNAME).$(VERSION).dylib - cd $(DEST); $(SYMLINK) $(LIBNAME).$(VERSION).dylib $(LIBNAME).dylib -@@ -102,6 +108,8 @@ installdirs: - strip-binaries: - ifeq ($(PLATFORM_OS), Linux) - $(STRIP) $(LIBNAME).so -+else ifeq ($(PLATFORM_OS), NetBSD) -+ $(STRIP) $(LIBNAME).so - else ifeq ($(PLATFORM_OS), Darwin) - $(STRIP) $(LIBNAME).dylib - else ifeq ($(PLATFORM_OS), CYGWIN) diff --git a/security/pev/patches/patch-src_Makefile b/security/pev/patches/patch-src_Makefile index 4576ef72100..87078ae6fce 100644 --- a/security/pev/patches/patch-src_Makefile +++ b/security/pev/patches/patch-src_Makefile @@ -1,58 +1,18 @@ -$NetBSD: patch-src_Makefile,v 1.3 2014/12/09 14:37:06 khorben Exp $ +$NetBSD: patch-src_Makefile,v 1.4 2019/10/22 16:37:05 khorben Exp $ -Fixed DESTDIR support +Only link with libdl on Linux ---- src/Makefile.orig 2013-12-27 10:39:49.000000000 +0000 +--- src/Makefile.orig 2017-01-07 22:34:07.000000000 +0000 +++ src/Makefile -@@ -56,7 +56,8 @@ ifeq ($(PLATFORM_OS), Darwin) - endif +@@ -52,7 +52,10 @@ endif - PROGS = readpe rva2ofs ofs2rva pehash pesec pescan pepack pestr pedis peres --SHAREDIR = $(datadir)/pev -+MAN1DIR = $(DESTDIR)$(man1dir) -+SHAREDIR = $(DESTDIR)$(datadir)/pev - LIBPE = $(srcdir)/../lib/libpe - LIBUDIS86 = $(srcdir)/../lib/libudis86 - LIBFUZZY = $(srcdir)/../lib/libfuzzy -@@ -68,6 +69,8 @@ MANDIR = $(srcdir)/../doc/manpages + ####### Compiler options - all: $(PROGS) +-override LDFLAGS += -L$(LIBPE) -lpe -ldl ++override LDFLAGS += -L$(LIBPE) -lpe ++ifeq ($(PLATFORM_OS), Linux) ++override LDFLAGS += -ldl ++endif + override CFLAGS += -I$(LIBPE) -I"../include" -W -Wall -Wextra -std=c99 -pedantic + override CPPFLAGS += -D_GNU_SOURCE -DSHAREDIR="\"$(SHAREDIR)"\" -+pepack: CPPFLAGS += -DPREFIX=\"$(prefix)\" -+ - pesec: LDFLAGS += -lcrypto - pesec: compat/strlcat.c - -@@ -85,13 +88,13 @@ pescan: LDFLAGS += -lm - # Generic rule matching binary names and sources - - %: %.c -- $(CC) $(CFLAGS) $(DFLAGS) output.c malloc_s.c $^ -o $@ $(LDFLAGS) -+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DFLAGS) output.c malloc_s.c $^ -o $@ $(LDFLAGS) - - install: installdirs - for prog in $(PROGS); do \ -- $(INSTALL_PROGRAM) -m 755 $$prog $(DEST); \ -+ $(INSTALL_PROGRAM) -m 755 $$prog $(DEST)/$$prog; \ - $(CHK_FILE_EXISTS) $(MANDIR)/$$prog$(man1ext) && \ -- gzip -c -9 $(MANDIR)/$$prog$(man1ext) > $(man1dir)/$$prog$(man1ext).gz || \ -+ gzip -c -9 $(MANDIR)/$$prog$(man1ext) > $(MAN1DIR)/$$prog$(man1ext).gz || \ - echo -n; \ - done - # TODO: Should we copy it anyway if it already exists? -@@ -99,13 +102,13 @@ install: installdirs - - installdirs: - @$(CHK_DIR_EXISTS) $(DEST) || $(MKDIR) $(DEST) -- @$(CHK_DIR_EXISTS) $(man1dir) || $(MKDIR) $(man1dir) -+ @$(CHK_DIR_EXISTS) $(MAN1DIR) || $(MKDIR) $(MAN1DIR) - @$(CHK_DIR_EXISTS) $(SHAREDIR) || $(MKDIR) $(SHAREDIR) - - uninstall: - for prog in $(PROGS); do \ - $(RM) $(DEST)/$$prog; \ -- $(RM) $(man1dir)/$$prog$(man1ext).gz; \ -+ $(RM) $(MAN1DIR)/$$prog$(man1ext).gz; \ - done - - clean: diff --git a/security/pev/patches/patch-src_pehash.c b/security/pev/patches/patch-src_pehash.c new file mode 100644 index 00000000000..ef061564627 --- /dev/null +++ b/security/pev/patches/patch-src_pehash.c @@ -0,0 +1,30 @@ +$NetBSD: patch-src_pehash.c,v 1.1 2019/10/22 16:37:05 khorben Exp $ + +Compatibility fix for OpenSSL 1.1.0 + +--- src/pehash.c.orig 2017-01-06 22:49:50.000000000 +0000 ++++ src/pehash.c +@@ -215,13 +215,22 @@ static void calc_hash(const char *alg_na + unsigned char md_value[EVP_MAX_MD_SIZE]; + unsigned int md_len; + +- EVP_MD_CTX md_ctx; + // FIXME: Handle errors - Check return values. ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L ++ EVP_MD_CTX * md_ctx; ++ md_ctx = EVP_MD_CTX_new(); ++ 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_free(md_ctx); ++#else ++ EVP_MD_CTX 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); + EVP_MD_CTX_cleanup(&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/patches/patch-src_pepack.c b/security/pev/patches/patch-src_pepack.c deleted file mode 100644 index 108570113c6..00000000000 --- a/security/pev/patches/patch-src_pepack.c +++ /dev/null @@ -1,29 +0,0 @@ -$NetBSD: patch-src_pepack.c,v 1.2 2014/12/09 14:37:06 khorben Exp $ - -Fixed the path to userdb.txt (see pkg/49458) - ---- src/pepack.c.orig 2013-12-27 10:39:49.000000000 +0000 -+++ src/pepack.c -@@ -21,6 +21,13 @@ - - #include "common.h" - -+#ifndef PREFIX -+# define PREFIX "/usr" -+#endif -+#ifndef DATADIR -+# define DATADIR PREFIX "/share" -+#endif -+ - #define PROGRAM "pepack" - #define MAX_SIG_SIZE 2048 - -@@ -133,7 +140,7 @@ static bool loaddb(FILE **fp, const opti - *fp = fopen(dbfile, "r"); - if (!*fp) { - // TODO(jweyrich): This might change - Should we use a config.h with a constant from $(SHAREDIR)? -- *fp = fopen("/usr/share/pev/userdb.txt", "r"); -+ *fp = fopen(DATADIR "/pev/userdb.txt", "r"); - } - - return *fp != NULL; diff --git a/security/pev/patches/patch-src_pesec.c b/security/pev/patches/patch-src_pesec.c new file mode 100644 index 00000000000..01fb7eb2543 --- /dev/null +++ b/security/pev/patches/patch-src_pesec.c @@ -0,0 +1,16 @@ +$NetBSD: patch-src_pesec.c,v 1.1 2019/10/22 16:37:05 khorben Exp $ + +Fix build with OpenSSL >= 1.1.0 + +--- src/pesec.c.orig 2017-01-06 22:27:18.000000000 +0000 ++++ src/pesec.c +@@ -225,7 +225,9 @@ static int parse_pkcs7_data(const option + PKCS7 *p7 = NULL; + BIO *in = NULL; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + CRYPTO_malloc_init(); ++#endif + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); + diff --git a/security/pev/patches/patch-src_plugins.c b/security/pev/patches/patch-src_plugins.c new file mode 100644 index 00000000000..ba3c297bc8a --- /dev/null +++ b/security/pev/patches/patch-src_plugins.c @@ -0,0 +1,15 @@ +$NetBSD: patch-src_plugins.c,v 1.1 2019/10/22 16:37:05 khorben Exp $ + +Build fix for FreeBSD, NetBSD, and OpenBSD. + +--- src/plugins.c.orig 2017-01-06 22:27:18.000000000 +0000 ++++ src/plugins.c +@@ -167,7 +167,7 @@ int plugins_load_all_from_directory(cons + const char *filename = dir_entry->d_name; + + // TODO(jweyrich): Use macro conditions for each system: .so, .dylib, .dll +-#if defined(__linux__) ++#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) + const bool possible_plugin = utils_str_ends_with(filename, ".so") != 0; + #elif defined(__APPLE__) + const bool possible_plugin = utils_str_ends_with(filename, ".dylib") != 0; -- cgit v1.2.3