Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detect march and mcpu #2577

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ 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]
- Added an Makefile variable `DONT_BUILD_NATIVE` in mfd_aes_brute Makefile to easify downstream package
- Auto detect whether compile option `march=native` is supported for mfd_aes_brute Makefile
- Changed `hf mf sim` - support data-first and nested reader attacks (@doegox)
- Fixed em4x50_read() - `lf search` and `lf em 4x50 rdbl -b <blk>` does not coredump reading EM4450 tag (@ANTodorov)
- Fixed flashing - client doesnt fail every other flash attempt (@iceman1001)
Expand Down
18 changes: 10 additions & 8 deletions tools/mfd_aes_brute/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ 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
# iOS 'fun'
else ifneq ($(findstring iP, $(cpu_arch)), )
MYCFLAGS += -mcpu=native
else
SUPPORT_MARCH := $(shell $(CC) -xc /dev/null -c -o /dev/null -march=native > /dev/null 2>/dev/null && echo y)
SUPPORT_MCPU := $(shell $(CC) -xc /dev/null -c -o /dev/null -mcpu=native > /dev/null 2>/dev/null && echo y)

ifeq ($(DONT_BUILD_NATIVE),y)
# do nothing
else ifeq ($(SUPPORT_MARCH),y)
MYCFLAGS += -march=native
else ifeq ($(SUPPORT_MCPU),y)
MYCFLAGS += -mcpu=native
endif

ifneq ($(SKIPPTHREAD),1)
Expand Down Expand Up @@ -43,6 +43,8 @@ ifeq ($(USE_MACPORTS),1)
MYLDFLAGS += -L$(MACPORTS_PREFIX)/lib/openssl-3 -L$(MACPORTS_PREFIX)/lib/openssl-1.1
endif

showinfo: $(info c flags: $(MYCFLAGS))

brute_key : $(OBJDIR)/brute_key.o $(MYOBJS)

mfd_aes_brute : $(OBJDIR)/mfd_aes_brute.o $(MYOBJS)
Expand Down
Loading