From 87400b61565bed5673dd0ed8a17ec9730a4b67e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lteri=C5=9F=20Ya=C4=9F=C4=B1ztegin=20Ero=C4=9Flu?= Date: Mon, 31 Jan 2022 12:08:17 +0300 Subject: [PATCH 1/2] don't define _POSIX_C_SOURCE in mfd_aes_brute.c if macos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unistd.h in macos has this snippet: #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL #define _SC_NPROCESSORS_CONF 57 #define _SC_NPROCESSORS_ONLN 58 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ __DARWIN_C_FULL is 900000L. If _POSIX_C_SOURCE gets defined without __DARWIN_C_SOURCE being defined, __DARWIN_C_LEVEL will be assigned to __DARWIN_C_ANSI, which is 010000L. Thus this definition will remove _SC_NPROCESSORS_CONF. If we don't define _POSIX_C_SOURCE, __DARWIN_C_LEVEL will be equal to __DARWIN_C_FULL, and _SC_NPROCESSORS_CONF will be available. This commit also includes homebrew and macports prefix definitions for mfd_aes_brute. Signed-off-by: İlteriş Yağıztegin Eroğlu --- tools/mfd_aes_brute/Makefile | 8 ++++++-- tools/mfd_aes_brute/mfd_aes_brute.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/mfd_aes_brute/Makefile b/tools/mfd_aes_brute/Makefile index cff2a1d40..968610723 100644 --- a/tools/mfd_aes_brute/Makefile +++ b/tools/mfd_aes_brute/Makefile @@ -22,8 +22,12 @@ ifneq (,$(findstring MINGW,$(platform))) endif # OS X needs linking to openssl -ifeq ($(platform),Darwin) - MYLDFLAGS += -L/usr/local/opt/openssl@3/lib +ifeq ($(USE_BREW),1) + MYLDFLAGS += -L$(BREW_PREFIX)/opt/openssl@3/lib -L$(BREW_PREFIX)/opt/openssl@1.1/lib +endif + +ifeq ($(USE_MACPORTS),1) + MYLDFLAGS += -L$(MACPORTS_PREFIX)/lib/openssl-3 -L$(MACPORTS_PREFIX)/lib/openssl-1.1 endif brute_key : $(OBJDIR)/brute_key.o $(MYOBJS) diff --git a/tools/mfd_aes_brute/mfd_aes_brute.c b/tools/mfd_aes_brute/mfd_aes_brute.c index 4e39ea93f..b6984e307 100644 --- a/tools/mfd_aes_brute/mfd_aes_brute.c +++ b/tools/mfd_aes_brute/mfd_aes_brute.c @@ -18,7 +18,7 @@ #define __STDC_FORMAT_MACROS -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(__APPLE__) #define _POSIX_C_SOURCE 200112L // need localtime_r() #endif From 391cc3d331030c16e93cc831e61167dc940aff35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lteri=C5=9F=20Ya=C4=9F=C4=B1ztegin=20Ero=C4=9Flu?= Date: Mon, 31 Jan 2022 16:35:59 +0300 Subject: [PATCH 2/2] add homebrew quirk fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: İlteriş Yağıztegin Eroğlu --- .github/workflows/macos.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 950b85cc4..6a9dd07b0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -37,6 +37,13 @@ jobs: - name: Install dependencies run: brew install readline qt5 RfidResearchGroup/proxmark3/arm-none-eabi-gcc openssl + - name: Fix linkings for qt5 and openssl + working-directory: /usr/local/include + continue-on-error: true + run: | + ln -svf ../opt/openssl@3/include/openssl . + ln -svf ../opt/qt@5/include/qt . + - name: Install Python dependencies run: | python3 -m pip install --upgrade pip @@ -78,6 +85,13 @@ jobs: - name: Install dependencies run: brew install readline qt5 RfidResearchGroup/proxmark3/arm-none-eabi-gcc openssl + - name: Fix linkings for qt5 and openssl + working-directory: /usr/local/include + continue-on-error: true + run: | + ln -svf ../opt/openssl@3/include/openssl . + ln -svf ../opt/qt@5/include/qt . + - name: Install Python dependencies run: | python3 -m pip install --upgrade pip @@ -120,6 +134,13 @@ jobs: - name: Install dependencies run: brew install readline qt5 RfidResearchGroup/proxmark3/arm-none-eabi-gcc openssl + - name: Fix linkings for qt5 and openssl + working-directory: /usr/local/include + continue-on-error: true + run: | + ln -svf ../opt/openssl@3/include/openssl . + ln -svf ../opt/qt@5/include/qt . + - name: Install Python dependencies run: | python3 -m pip install --upgrade pip