From 517ddf4bfc351548ea57ac9885626adea78001a3 Mon Sep 17 00:00:00 2001 From: Doridian Date: Sun, 27 Mar 2022 10:33:33 -0700 Subject: [PATCH] Fix compilation on M1 Macs --- CHANGELOG.md | 1 + tools/mfd_aes_brute/Makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cea15af82..b5a26c72e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fixed compilation of mfd_aes_brute on Apple M1 based Macs (@Doridian) - Changed calculation of companion ARM firmware hash to be uniform accross platforms (@Doridian) - Changed `hf mf *` - verbose flag now also decode and prints found value blocks (@iceman1001) - Changed `hf mf wrbl` - added more helptext and new param --force to point out block0 writes (@iceman1001) diff --git a/tools/mfd_aes_brute/Makefile b/tools/mfd_aes_brute/Makefile index 027477f50..cf2c457c6 100644 --- a/tools/mfd_aes_brute/Makefile +++ b/tools/mfd_aes_brute/Makefile @@ -1,10 +1,18 @@ MYSRCPATHS = ../../common ../../common/mbedtls MYSRCS = util_posix.c randoms.c MYINCLUDES = -I../../include -I../../common -I../../common/mbedtls -MYCFLAGS = -march=native -Ofast +MYCFLAGS = -Ofast MYDEFS = MYLDLIBS = -lcrypto +# A better way would be to just try compiling with march and seeing if we succeed +cpu_arch = $(shell uname -m) +ifneq ($(findstring arm64, $(cpu_arch)), ) + MYCFLAGS += -mcpu=native +else + MYCFLAGS += -march=native +endif + ifneq ($(SKIPPTHREAD),1) MYLDLIBS += -lpthread endif