Skip to content

Commit

Permalink
basic integration mfoc + cropto1_bs
Browse files Browse the repository at this point in the history
Special thanks to @skgsergio for the help with automake stuff :)
  • Loading branch information
vk496 committed Nov 25, 2018
1 parent 0723f53 commit f3acee6
Show file tree
Hide file tree
Showing 19 changed files with 73,386 additions and 20 deletions.
11 changes: 9 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ AC_CONFIG_HEADERS([config.h])

AC_CONFIG_SRCDIR([src/mfoc.c])

AM_INIT_AUTOMAKE(dist-bzip2 no-dist-gzip)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
CFLAGS="$CFLAGS -O3"
AX_CFLAGS_WARN_ALL

AC_PROG_CC

Expand All @@ -16,6 +18,11 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
LIBNFC_REQUIRED_VERSION=1.7.0
PKG_CHECK_MODULES([libnfc], [libnfc >= $LIBNFC_REQUIRED_VERSION], [], [AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.])])

PKG_CHECK_MODULES([liblzma], [liblzma], LIBS="$LIBS -llzma", [AC_MSG_ERROR([liblzma is mandatory.])])
ACX_PTHREAD(LIBS="$LIBS $PTHREAD_CFLAGS", [AC_MSG_ERROR([pthread is mandatory.])])
AC_CHECK_LIB(m, log, LIBS="$LIBS -lm", [AC_MSG_ERROR([math is mandatory.])])
AX_LIB_READLINE

PKG_CONFIG_REQUIRES="libnfc"
AC_SUBST([PKG_CONFIG_REQUIRES])

Expand All @@ -35,7 +42,7 @@ AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset])

# C99
CFLAGS="$CFLAGS -std=c99 -O3 -Wall"
CFLAGS="$CFLAGS -std=c99"

AC_CONFIG_FILES([Makefile
src/Makefile])
Expand Down
47 changes: 44 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,50 @@ AM_CFLAGS = @libnfc_CFLAGS@

bin_PROGRAMS = mfoc

noinst_HEADERS = crapto1.h mfoc.h mifare.h nfc-utils.h parity.h
noinst_HEADERS = crapto1.h mfoc.h mifare.h nfc-utils.h parity.h hardnested/hardnested_bruteforce.h hardnested/tables.h cmdhfmfhard.h util.h util_posix.h ui.h

mfoc_SOURCES = crapto1.c crypto1.c mfoc.c mifare.c nfc-utils.c parity.c
mfoc_LDADD = @libnfc_LIBS@
mfoc_SOURCES = crapto1.c crypto1.c mfoc.c mifare.c nfc-utils.c parity.c hardnested/hardnested_bruteforce.c hardnested/tables.c cmdhfmfhard.c util.c util_posix.c ui.c
mfoc_LDADD = @libnfc_LIBS@ $(MULTIARCHOBJS)

dist_man_MANS = mfoc.1


#MULTIARCH = hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c

MULTIARCHOBJS = hardnested/hardnested_bf_core_NOSIMD.o \
hardnested/hardnested_bf_core_MMX.o \
hardnested/hardnested_bf_core_SSE2.o \
hardnested/hardnested_bf_core_AVX.o \
hardnested/hardnested_bf_core_AVX2.o \
hardnested/hardnested_bf_core_AVX512.o \
hardnested/hardnested_bitarray_core_NOSIMD.o \
hardnested/hardnested_bitarray_core_MMX.o \
hardnested/hardnested_bitarray_core_SSE2.o \
hardnested/hardnested_bitarray_core_AVX.o \
hardnested/hardnested_bitarray_core_AVX2.o \
hardnested/hardnested_bitarray_core_AVX512.o

HARD_SWITCH_NOSIMD = -mno-mmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f
HARD_SWITCH_MMX = -mmmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f
HARD_SWITCH_SSE2 = -mmmx -msse2 -mno-avx -mno-avx2 -mno-avx512f
HARD_SWITCH_AVX = -mmmx -msse2 -mavx -mno-avx2 -mno-avx512f
HARD_SWITCH_AVX2 = -mmmx -msse2 -mavx -mavx2 -mno-avx512f
HARD_SWITCH_AVX512 = -mmmx -msse2 -mavx -mavx2 -mavx512f

hardnested/%_NOSIMD.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_NOSIMD) -c -o $@ $<

hardnested/%_MMX.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_MMX) -c -o $@ $<

hardnested/%_SSE2.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_SSE2) -c -o $@ $<

hardnested/%_AVX.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX) -c -o $@ $<

hardnested/%_AVX2.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX2) -c -o $@ $<

hardnested/%_AVX512.o : hardnested/%.c
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
Loading

0 comments on commit f3acee6

Please sign in to comment.