Skip to content

Commit

Permalink
Replace our AES code with the one from MbedTLS 3.6.2
Browse files Browse the repository at this point in the history
This one supports AES-NI (Intel) and AES-CE (ARM, including Apple Silicon)
and does not depend on yasm as it's written in C with intrinsics.  Unlike
the old code that was only used for o5logon, this code kicks in for any
format using AES.  Great boosts seen with AES-heavy formats.

Closes #4314
  • Loading branch information
magnumripper committed Nov 29, 2024
1 parent 2fce717 commit 869dc3d
Show file tree
Hide file tree
Showing 57 changed files with 11,326 additions and 6,933 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ run/wpapcap2john
run/zip2john

src/.gdbinit
src/aes/aes.a
src/mbedtls/aes.a
src/arch.h
src/all_tests.lst
src/autoconfig-stamp-h
Expand Down
6 changes: 6 additions & 0 deletions doc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
character classes got (very minor) changes - this can affect resuming old
jobs [magnum; 2024]

- Dropped our old AES-NI code in favor of the AES code from mbedTLS, which
supports AES-NI (Intel) as well as AES-CE (Arm). The new code kicks in for
any format using AES. Boosts of up to 13x seen on Intel and 7x on MacBook
M1 (those are for the KeePass format with AES-KDF, which is extreme because
all the heavy lifting is AES). [magnum; 2024]


Major changes from 1.8.0-jumbo-1 (December 2014) to 1.9.0-jumbo-1 (May 2019):

Expand Down
41 changes: 13 additions & 28 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PEFLAGS = peflags --dynamicbase=true --nxcompat=true
SHELL = /bin/sh
VPATH = @srcdir@

subdirs = aes secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
subdirs = mbedtls secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
top_srcdir = @top_srcdir@
srcdir = @srcdir@
prefix = @prefix@
Expand Down Expand Up @@ -71,20 +71,6 @@ LDFLAGS = -g @LDFLAGS@ $(LIBS) @HAVE_MPI@
OPT_NORMAL = @OPT_NORMAL_FLAGS@
OPT_INLINE = @OPT_INLINE_FLAGS@
#
AES_OK := $(shell expr `$(CC) -dumpversion | cut -d '.' -f 1` \>= 4)
YASM = @YASM@
USE_AESNI = @AESNI_OS@
AESNI_ARCH=@AESNI_ARCH@

ifeq "$(AES_OK)" "1"
ifneq "$(YASM)" ""
ifdef USE_AESNI
ifdef AESNI_ARCH
AESNI_DEC = -DAESNI_IN_USE
endif
endif
endif
endif

PLUGFORMATS_OBJS = @PLUGFORMATS_OBJS@

Expand Down Expand Up @@ -206,8 +192,7 @@ endif
default:
$(MAKE) find_version
@$(MAKE) $(PROJ) \
JOHN_OBJS="$(JOHN_OBJS) @CC_ASM_OBJS@" \
AESNI_ARCH=@AESNI_ARCH@
JOHN_OBJS="$(JOHN_OBJS) @CC_ASM_OBJS@"

@if [ "$(OS)" = "Windows_NT" ]; then \
$(MAKE) peflags; \
Expand Down Expand Up @@ -525,15 +510,15 @@ unicode.o: unicode.c common.h arch.h memory.h byteorder.h unicode.h options.h au

unique.o: unique.c autoconfig.h arch.h misc.h jumbo.h params.h memory.h os.h os-autoconf.h

unrar.o: unrar.c arch.h unrar.h aes.h autoconfig.h aes/aes_func.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h
unrar.o: unrar.c arch.h unrar.h aes.h autoconfig.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h

unrarcmd.o: unrarcmd.c aes.h autoconfig.h aes/aes_func.h unrar.h arch.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h
unrarcmd.o: unrarcmd.c aes.h autoconfig.h unrar.h arch.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h

unrarfilter.o: unrarfilter.c arch.h aes.h autoconfig.h aes/aes_func.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h
unrarfilter.o: unrarfilter.c arch.h aes.h autoconfig.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h os.h os-autoconf.h

unrarhlp.o: unrarhlp.c jumbo.h arch.h unrarhlp.h memory.h os.h os-autoconf.h autoconfig.h

unrarvm.o: unrarvm.c arch.h aes.h autoconfig.h aes/aes_func.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h common.h os.h os-autoconf.h
unrarvm.o: unrarvm.c arch.h aes.h autoconfig.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h common.h os.h os-autoconf.h

unshadow.o: unshadow.c misc.h jumbo.h arch.h autoconfig.h params.h memory.h os.h os-autoconf.h

Expand Down Expand Up @@ -574,7 +559,7 @@ find_version:
echo "#define JTR_GIT_VERSION $(JTR_GIT_VERSION)" > version.h.new
diff >/dev/null 2>/dev/null version.h.new version.h && $(RM) version.h.new || $(MV) version.h.new version.h

SUBDIRS = aes secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
SUBDIRS = mbedtls secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@

.PHONY: subdirs $(SUBDIRS) find_version

Expand All @@ -590,8 +575,8 @@ DES_bs_b.o: DES_bs_b.c arch.h common.h memory.h DES_bs.h loader.h params.h list.
miscnl.o: misc.c
$(CC) $(CFLAGS) $(OPT_NORMAL) -D_JOHN_MISC_NO_LOG misc.c -o miscnl.o

aes/aes.a:
$(MAKE) -C aes all
mbedtls/aes.a:
$(MAKE) -C mbedtls all

secp256k1/secp256k1.a:
$(MAKE) -C secp256k1 all
Expand All @@ -614,8 +599,8 @@ poly1305-donna/poly1305-donna.a:

# PTHREAD_CFLAGS and OPENMP_CFLAGS may actually contain linker options,
# like -fopenmp
../run/john@EXE_EXT@: $(JOHN_OBJS) aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a @ZTEX_SUBDIRS@
$(LD) $(JOHN_OBJS) $(LDFLAGS) @OPENSSL_LIBS@ @OPENMP_CFLAGS@ @GMP_LIBS@ @SKEY_LIBS@ @REXGEN_LIBS@ @CL_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @M_LIBS@ @RT_LIBS@ @Z_LIBS@ @DL_LIBS@ @CRYPT_LIBS@ @BZ2_LIBS@ @ZTEX_LIBS@ aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -o $@
../run/john@EXE_EXT@: $(JOHN_OBJS) mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a @ZTEX_SUBDIRS@
$(LD) $(JOHN_OBJS) $(LDFLAGS) @OPENSSL_LIBS@ @OPENMP_CFLAGS@ @GMP_LIBS@ @SKEY_LIBS@ @REXGEN_LIBS@ @CL_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @M_LIBS@ @RT_LIBS@ @Z_LIBS@ @DL_LIBS@ @CRYPT_LIBS@ @BZ2_LIBS@ @ZTEX_LIBS@ mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -o $@

../run/unshadow: ../run/john
$(RM) ../run/unshadow
Expand Down Expand Up @@ -756,11 +741,11 @@ path.o: path.c path.h autoconfig.h arch.h params.h misc.h memory.h
$(CC) $(CFLAGS_MAIN) $(OPT_NORMAL) -O1 $*.c

# Workaround for gcc 3.4.6 (seen on Sparc32) (do not use -funroll-loops)
unrarppm.o: unrarppm.c arch.h aes.h autoconfig.h aes/aes_func.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h common.h os.h os-autoconf.h
unrarppm.o: unrarppm.c arch.h aes.h autoconfig.h unrar.h unrarhlp.h memory.h jumbo.h unrarppm.h unrarvm.h unrarcmd.h unrarfilter.h common.h os.h os-autoconf.h
$(CC) -DAC_BUILT $(CFLAGS) $< -o $@

.c.o:
$(CC) $(CFLAGS) $(OPT_NORMAL) $(AESNI_DEC) $< -o $@
$(CC) $(CFLAGS) $(OPT_NORMAL) $< -o $@

.S.o:
$(AS) $(ASFLAGS) $*.S
Expand Down
35 changes: 5 additions & 30 deletions src/Makefile.legacy
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ linux-x86-64-xop:
CFLAGS="$(CFLAGS) -mxop -DHAVE_CRYPT -DHAVE_LIBDL" \
ASFLAGS="$(ASFLAGS) -mxop" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -384,7 +383,6 @@ linux-x86-64-avx:
CFLAGS="$(CFLAGS) -mavx -DHAVE_CRYPT -DHAVE_LIBDL" \
ASFLAGS="$(ASFLAGS) -mavx" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -397,7 +395,6 @@ linux-x86-64-opencl:
CFLAGS="$(CFLAGS) -I$(OCLROOT)/include -DHAVE_CRYPT -DHAVE_OPENCL -DHAVE_LIBDL -march=native" \
ASFLAGS="$(ASFLAGS) -march=native" \
LDFLAGS="$(LDFLAGS) -L$(OCLROOT)/lib/x86_64 -L$(OCLROOT)/lib64 -lcrypt -lOpenCL -ldl -march=native" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -410,7 +407,6 @@ linux-x86-64-native:
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -march=native" \
ASFLAGS="$(ASFLAGS) -march=native" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -423,7 +419,6 @@ linux-X32-native:
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -march=native -mx32" \
ASFLAGS="$(ASFLAGS) -march=native -mx32" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native -mx32" \
AESNI_ARCH=64 YASM_FORMAT="elfx32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -436,7 +431,6 @@ linux-X32:
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -mx32" \
ASFLAGS="$(ASFLAGS) -mx32" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -mx32" \
AESNI_ARCH=64 YASM_FORMAT="elfx32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -448,7 +442,6 @@ linux-x86-64:
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86-64.o simd-intrinsics.o" \
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -462,7 +455,6 @@ linux-x86-64-clang:
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
OPT_INLINE="$(OPT_NORMAL)" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CC="clang"
@echo "All done"
Expand All @@ -475,7 +467,6 @@ linux-x86-64-clang-debug:
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -faddress-sanitizer $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) \
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
Expand All @@ -490,7 +481,6 @@ linux-x86-64-newgcc-debug:
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86-64.o simd-intrinsics.o" \
CFLAGS="-Wall -c -g -O1 -fsanitize=address -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -fsanitize=address $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) \
CFLAGS="-Wall -c -g -O1 -fsanitize=address -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
Expand All @@ -506,7 +496,6 @@ linux-x86-64-icc:
ASFLAGS="-c -xHost $(JOHN_ASFLAGS)" \
LDFLAGS="-lm $(LDFLAGS_OPENSSL) -ipo -static-intel -lcrypt -ldl -lz $(ICCOMPFLAGS) -s $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
CPP="icc" CC="icc" AS="icc" LD="icc" \
AESNI_ARCH=64 YASM_FORMAT="elf64"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CPP="icc" CC="icc" AS="icc" LD="icc"
@echo "All done"
Expand All @@ -519,7 +508,6 @@ linux-x86-64-32-native:
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
ASFLAGS="$(ASFLAGS) -m32 -msse2 -march=native" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl -march=native" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
@echo "All done"
Expand All @@ -532,7 +520,6 @@ linux-x86-64-32-sse2:
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -m32 -msse2" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
@echo "All done"
Expand All @@ -545,7 +532,6 @@ linux-x86-64-32-sse2asm:
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -DJOHN_DISABLE_INTRINSICS -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -m32 -msse2" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
@echo "All done"
Expand All @@ -558,7 +544,6 @@ linux-x86-64-32-mmx:
CFLAGS="$(CFLAGS) -m32 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -m32" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
@echo "All done"
Expand All @@ -571,7 +556,6 @@ linux-x86-64-32-any:
CFLAGS="$(CFLAGS) -m32 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -m32" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
@echo "All done"
Expand Down Expand Up @@ -605,7 +589,6 @@ linux-x86-xop:
CFLAGS="$(CFLAGS) -m32 -mxop -DHAVE_CRYPT -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -m32 -mxop" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32"
@echo "All done"
Expand All @@ -619,7 +602,6 @@ linux-x86-avx:
CFLAGS="$(CFLAGS) -m32 -mavx -DHAVE_CRYPT" \
ASFLAGS="$(ASFLAGS) -m32 -mavx" \
LDFLAGS="$(LDFLAGS) -m32 -lcrypt" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32"
@echo "All done"
Expand All @@ -632,7 +614,6 @@ linux-x86-opencl:
CFLAGS="$(CFLAGS) -I$(OCLROOT)/include -DHAVE_CRYPT -DHAVE_OPENCL -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
ASFLAGS="$(ASFLAGS) -march=native" \
LDFLAGS="$(LDFLAGS) -L$(OCLROOT)/lib/x86 -L$(OCLROOT)/lib -lcrypt -lOpenCL -ldl -march=native" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -645,7 +626,6 @@ linux-x86-native:
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
ASFLAGS="$(ASFLAGS) -march=native" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -658,7 +638,6 @@ linux-x86-sse2:
CFLAGS="$(CFLAGS) -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
ASFLAGS="$(ASFLAGS) -msse2" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -670,7 +649,6 @@ linux-x86-mmx:
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o x86-mmx.o" \
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -682,7 +660,6 @@ linux-x86-any:
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o" \
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP)
@echo "All done"
Expand All @@ -696,7 +673,6 @@ linux-x86-clang:
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
OPT_INLINE="$(OPT_NORMAL)" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) CC="clang"
@echo "All done"
Expand All @@ -709,7 +685,6 @@ linux-x86-clang-debug:
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE $(HAVE_LIBGMP) $(OMPFLAGS) $(JOHN_CFLAGS)" \
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -faddress-sanitizer $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
AESNI_ARCH=86 YASM_FORMAT="elf32"
@echo "Failing after this point just means some helper tools did not build:"
$(MAKE_ORIG) $(PROJ_PCAP) \
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(OMPFLAGS) $(JOHN_CFLAGS)" \
Expand Down Expand Up @@ -1745,7 +1720,7 @@ find_version:
echo "#define JTR_GIT_VERSION $(JTR_GIT_VERSION)" > version.h.new
diff >/dev/null 2>/dev/null version.h.new version.h && $(RM) version.h.new || $(MV) version.h.new version.h

SUBDIRS = aes secp256k1 ed25519-donna poly1305-donna
SUBDIRS = mbedtls secp256k1 ed25519-donna poly1305-donna

.PHONY: subdirs $(SUBDIRS) find_version

Expand All @@ -1755,7 +1730,7 @@ $(SUBDIRS):
$(MAKE_ORIG) -C $@ all CC=$(CC)

../run/john: $(JOHN_OBJS) $(SUBDIRS)
$(LD) $(JOHN_OBJS) $(LDFLAGS) aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.o poly1305-donna/poly1305-donna.o -o ../run/john
$(LD) $(JOHN_OBJS) $(LDFLAGS) mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.o poly1305-donna/poly1305-donna.o -o ../run/john

../run/unshadow: ../run/john
$(RM) ../run/unshadow
Expand Down Expand Up @@ -1831,7 +1806,7 @@ john.com: john.asm
# $(LD) $(JOHN_OBJS) -lkernel32 -lcrypto -o ../run/john.exe

../run/john.exe: $(JOHN_OBJS) $(SUBDIRS)
$(LD) $(JOHN_OBJS) $(LDFLAGS) aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -lkernel32 -o ../run/john.exe
$(LD) $(JOHN_OBJS) $(LDFLAGS) mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -lkernel32 -o ../run/john.exe
$(STRIP) ../run/john.exe

# this LD line removed from the ../run/john-mingw.exe rule (MinGW32 builds)
Expand All @@ -1840,7 +1815,7 @@ john.com: john.asm
# $(LD) $(JOHN_OBJS) $(LDFLAGS) -lkernel32 -o ../run/john-mingw.exe

../run/john-mingw.exe: $(JOHN_OBJS)
$(LD) $(JOHN_OBJS) $(LDFLAGS) aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -lkernel32 -o ../run/john-mingw.exe
$(LD) $(JOHN_OBJS) $(LDFLAGS) mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a -lkernel32 -o ../run/john-mingw.exe
$(STRIP) ../run/john-mingw.exe
cp ../run/john-mingw.exe ../run/john.exe

Expand Down Expand Up @@ -2058,7 +2033,7 @@ clean:
$(RM) *~
$(RM) dynamic_big_crypt.c fmt_registers.h fmt_externs.h john_build_rule.h version.h version.h.new
$(CP) $(NULL) Makefile.dep
+$(MAKE_ORIG) -C aes clean
+$(MAKE_ORIG) -C mbedtls clean
+$(MAKE_ORIG) -C secp256k1 clean
+$(MAKE_ORIG) -C ed25519-donna clean
+$(MAKE_ORIG) -C poly1305-donna clean
Expand Down
Loading

0 comments on commit 869dc3d

Please sign in to comment.