From ac6e003c16d36365f8cc885a3f1e25500c3b7e99 Mon Sep 17 00:00:00 2001 From: Tom Harkness Date: Mon, 9 Nov 2026 15:54:17 +1100 Subject: [PATCH] tools: find brew OpenSSL via installed keg, not the alias brew's "openssl" alias follows the newest major (now openssl@4), so `brew --prefix openssl` returns a prefix that isn't installed on setups with only openssl@3, and the build fails with evp.h / des.h not found. Probe the candidate kegs and use the first that actually has the headers. Co-Authored-By: Claude Opus 4.8 --- tools/mfd_aes_brute/Makefile | 7 ++++++- tools/mfulc_des_brute/Makefile | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/mfd_aes_brute/Makefile b/tools/mfd_aes_brute/Makefile index 890de2c64..0aa117259 100644 --- a/tools/mfd_aes_brute/Makefile +++ b/tools/mfd_aes_brute/Makefile @@ -39,7 +39,12 @@ endif # OS X needs linking to openssl ifeq ($(USE_BREW),1) - OPENSSL_PREFIX := $(shell brew --prefix openssl) + # brew's openssl alias can point at an uninstalled major (e.g. openssl@4); + # pick the newest keg that actually has the headers. + OPENSSL_PREFIX := $(shell for f in openssl openssl@3 openssl@1.1; do \ + p=$$(brew --prefix $$f 2>/dev/null); \ + [ -f "$$p/include/openssl/evp.h" ] && { echo $$p; break; }; \ + done) MYCFLAGS += -I$(OPENSSL_PREFIX)/include MYLDFLAGS += -L$(OPENSSL_PREFIX)/lib endif diff --git a/tools/mfulc_des_brute/Makefile b/tools/mfulc_des_brute/Makefile index 2b97d6c55..8dba555d8 100644 --- a/tools/mfulc_des_brute/Makefile +++ b/tools/mfulc_des_brute/Makefile @@ -15,7 +15,12 @@ endif # OS X needs linking to openssl ifeq ($(USE_BREW),1) - OPENSSL_PREFIX := $(shell brew --prefix openssl) + # brew's openssl alias can point at an uninstalled major (e.g. openssl@4); + # pick the newest keg that actually has the headers. + OPENSSL_PREFIX := $(shell for f in openssl openssl@3 openssl@1.1; do \ + p=$$(brew --prefix $$f 2>/dev/null); \ + [ -f "$$p/include/openssl/evp.h" ] && { echo $$p; break; }; \ + done) MYCFLAGS += -I$(OPENSSL_PREFIX)/include MYLDFLAGS += -L$(OPENSSL_PREFIX)/lib endif