Skip to content

Commit c18eac4

Browse files
committed
Replace our AES code with the one from MbedTLS 3.6.2
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
1 parent 2fce717 commit c18eac4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+11324
-6933
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ run/wpapcap2john
7373
run/zip2john
7474

7575
src/.gdbinit
76-
src/aes/aes.a
76+
src/mbedtls/aes.a
7777
src/arch.h
7878
src/all_tests.lst
7979
src/autoconfig-stamp-h

doc/NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
354354
character classes got (very minor) changes - this can affect resuming old
355355
jobs [magnum; 2024]
356356

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

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

src/Makefile.in

+13-28
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PEFLAGS = peflags --dynamicbase=true --nxcompat=true
3939
SHELL = /bin/sh
4040
VPATH = @srcdir@
4141

42-
subdirs = aes secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
42+
subdirs = mbedtls secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
4343
top_srcdir = @top_srcdir@
4444
srcdir = @srcdir@
4545
prefix = @prefix@
@@ -71,20 +71,6 @@ LDFLAGS = -g @LDFLAGS@ $(LIBS) @HAVE_MPI@
7171
OPT_NORMAL = @OPT_NORMAL_FLAGS@
7272
OPT_INLINE = @OPT_INLINE_FLAGS@
7373
#
74-
AES_OK := $(shell expr `$(CC) -dumpversion | cut -d '.' -f 1` \>= 4)
75-
YASM = @YASM@
76-
USE_AESNI = @AESNI_OS@
77-
AESNI_ARCH=@AESNI_ARCH@
78-
79-
ifeq "$(AES_OK)" "1"
80-
ifneq "$(YASM)" ""
81-
ifdef USE_AESNI
82-
ifdef AESNI_ARCH
83-
AESNI_DEC = -DAESNI_IN_USE
84-
endif
85-
endif
86-
endif
87-
endif
8874

8975
PLUGFORMATS_OBJS = @PLUGFORMATS_OBJS@
9076

@@ -206,8 +192,7 @@ endif
206192
default:
207193
$(MAKE) find_version
208194
@$(MAKE) $(PROJ) \
209-
JOHN_OBJS="$(JOHN_OBJS) @CC_ASM_OBJS@" \
210-
AESNI_ARCH=@AESNI_ARCH@
195+
JOHN_OBJS="$(JOHN_OBJS) @CC_ASM_OBJS@"
211196

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

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

528-
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
513+
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
529514

530-
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
515+
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
531516

532-
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
517+
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
533518

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

536-
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
521+
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
537522

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

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

577-
SUBDIRS = aes secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
562+
SUBDIRS = mbedtls secp256k1 ed25519-donna poly1305-donna @ZTEX_SUBDIRS@
578563

579564
.PHONY: subdirs $(SUBDIRS) find_version
580565

@@ -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.
590575
miscnl.o: misc.c
591576
$(CC) $(CFLAGS) $(OPT_NORMAL) -D_JOHN_MISC_NO_LOG misc.c -o miscnl.o
592577

593-
aes/aes.a:
594-
$(MAKE) -C aes all
578+
mbedtls/aes.a:
579+
$(MAKE) -C mbedtls all
595580

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

615600
# PTHREAD_CFLAGS and OPENMP_CFLAGS may actually contain linker options,
616601
# like -fopenmp
617-
../run/john@EXE_EXT@: $(JOHN_OBJS) aes/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a @ZTEX_SUBDIRS@
618-
$(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 $@
602+
../run/john@EXE_EXT@: $(JOHN_OBJS) mbedtls/aes.a secp256k1/secp256k1.a ed25519-donna/ed25519-donna.a poly1305-donna/poly1305-donna.a @ZTEX_SUBDIRS@
603+
$(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 $@
619604

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

758743
# Workaround for gcc 3.4.6 (seen on Sparc32) (do not use -funroll-loops)
759-
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
744+
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
760745
$(CC) -DAC_BUILT $(CFLAGS) $< -o $@
761746

762747
.c.o:
763-
$(CC) $(CFLAGS) $(OPT_NORMAL) $(AESNI_DEC) $< -o $@
748+
$(CC) $(CFLAGS) $(OPT_NORMAL) $< -o $@
764749

765750
.S.o:
766751
$(AS) $(ASFLAGS) $*.S

src/Makefile.legacy

+5-30
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ linux-x86-64-xop:
370370
CFLAGS="$(CFLAGS) -mxop -DHAVE_CRYPT -DHAVE_LIBDL" \
371371
ASFLAGS="$(ASFLAGS) -mxop" \
372372
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
373-
AESNI_ARCH=64 YASM_FORMAT="elf64"
374373
@echo "Failing after this point just means some helper tools did not build:"
375374
$(MAKE_ORIG) $(PROJ_PCAP)
376375
@echo "All done"
@@ -384,7 +383,6 @@ linux-x86-64-avx:
384383
CFLAGS="$(CFLAGS) -mavx -DHAVE_CRYPT -DHAVE_LIBDL" \
385384
ASFLAGS="$(ASFLAGS) -mavx" \
386385
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
387-
AESNI_ARCH=64 YASM_FORMAT="elf64"
388386
@echo "Failing after this point just means some helper tools did not build:"
389387
$(MAKE_ORIG) $(PROJ_PCAP)
390388
@echo "All done"
@@ -397,7 +395,6 @@ linux-x86-64-opencl:
397395
CFLAGS="$(CFLAGS) -I$(OCLROOT)/include -DHAVE_CRYPT -DHAVE_OPENCL -DHAVE_LIBDL -march=native" \
398396
ASFLAGS="$(ASFLAGS) -march=native" \
399397
LDFLAGS="$(LDFLAGS) -L$(OCLROOT)/lib/x86_64 -L$(OCLROOT)/lib64 -lcrypt -lOpenCL -ldl -march=native" \
400-
AESNI_ARCH=64 YASM_FORMAT="elf64"
401398
@echo "Failing after this point just means some helper tools did not build:"
402399
$(MAKE_ORIG) $(PROJ_PCAP)
403400
@echo "All done"
@@ -410,7 +407,6 @@ linux-x86-64-native:
410407
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -march=native" \
411408
ASFLAGS="$(ASFLAGS) -march=native" \
412409
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native" \
413-
AESNI_ARCH=64 YASM_FORMAT="elf64"
414410
@echo "Failing after this point just means some helper tools did not build:"
415411
$(MAKE_ORIG) $(PROJ_PCAP)
416412
@echo "All done"
@@ -423,7 +419,6 @@ linux-X32-native:
423419
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -march=native -mx32" \
424420
ASFLAGS="$(ASFLAGS) -march=native -mx32" \
425421
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native -mx32" \
426-
AESNI_ARCH=64 YASM_FORMAT="elfx32"
427422
@echo "Failing after this point just means some helper tools did not build:"
428423
$(MAKE_ORIG) $(PROJ_PCAP)
429424
@echo "All done"
@@ -436,7 +431,6 @@ linux-X32:
436431
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -mx32" \
437432
ASFLAGS="$(ASFLAGS) -mx32" \
438433
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -mx32" \
439-
AESNI_ARCH=64 YASM_FORMAT="elfx32"
440434
@echo "Failing after this point just means some helper tools did not build:"
441435
$(MAKE_ORIG) $(PROJ_PCAP)
442436
@echo "All done"
@@ -448,7 +442,6 @@ linux-x86-64:
448442
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86-64.o simd-intrinsics.o" \
449443
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL" \
450444
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
451-
AESNI_ARCH=64 YASM_FORMAT="elf64"
452445
@echo "Failing after this point just means some helper tools did not build:"
453446
$(MAKE_ORIG) $(PROJ_PCAP)
454447
@echo "All done"
@@ -462,7 +455,6 @@ linux-x86-64-clang:
462455
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
463456
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
464457
OPT_INLINE="$(OPT_NORMAL)" \
465-
AESNI_ARCH=64 YASM_FORMAT="elf64"
466458
@echo "Failing after this point just means some helper tools did not build:"
467459
$(MAKE_ORIG) $(PROJ_PCAP) CC="clang"
468460
@echo "All done"
@@ -475,7 +467,6 @@ linux-x86-64-clang-debug:
475467
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
476468
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -faddress-sanitizer $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
477469
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
478-
AESNI_ARCH=64 YASM_FORMAT="elf64"
479470
@echo "Failing after this point just means some helper tools did not build:"
480471
$(MAKE_ORIG) $(PROJ_PCAP) \
481472
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
@@ -490,7 +481,6 @@ linux-x86-64-newgcc-debug:
490481
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86-64.o simd-intrinsics.o" \
491482
CFLAGS="-Wall -c -g -O1 -fsanitize=address -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
492483
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -fsanitize=address $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
493-
AESNI_ARCH=64 YASM_FORMAT="elf64"
494484
@echo "Failing after this point just means some helper tools did not build:"
495485
$(MAKE_ORIG) $(PROJ_PCAP) \
496486
CFLAGS="-Wall -c -g -O1 -fsanitize=address -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(JOHN_CFLAGS)" \
@@ -506,7 +496,6 @@ linux-x86-64-icc:
506496
ASFLAGS="-c -xHost $(JOHN_ASFLAGS)" \
507497
LDFLAGS="-lm $(LDFLAGS_OPENSSL) -ipo -static-intel -lcrypt -ldl -lz $(ICCOMPFLAGS) -s $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
508498
CPP="icc" CC="icc" AS="icc" LD="icc" \
509-
AESNI_ARCH=64 YASM_FORMAT="elf64"
510499
@echo "Failing after this point just means some helper tools did not build:"
511500
$(MAKE_ORIG) $(PROJ_PCAP) CPP="icc" CC="icc" AS="icc" LD="icc"
512501
@echo "All done"
@@ -519,7 +508,6 @@ linux-x86-64-32-native:
519508
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
520509
ASFLAGS="$(ASFLAGS) -m32 -msse2 -march=native" \
521510
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl -march=native" \
522-
AESNI_ARCH=86 YASM_FORMAT="elf32"
523511
@echo "Failing after this point just means some helper tools did not build:"
524512
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
525513
@echo "All done"
@@ -532,7 +520,6 @@ linux-x86-64-32-sse2:
532520
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
533521
ASFLAGS="$(ASFLAGS) -m32 -msse2" \
534522
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
535-
AESNI_ARCH=86 YASM_FORMAT="elf32"
536523
@echo "Failing after this point just means some helper tools did not build:"
537524
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
538525
@echo "All done"
@@ -545,7 +532,6 @@ linux-x86-64-32-sse2asm:
545532
CFLAGS="$(CFLAGS) -m32 -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -DJOHN_DISABLE_INTRINSICS -D_LARGEFILE64_SOURCE" \
546533
ASFLAGS="$(ASFLAGS) -m32 -msse2" \
547534
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
548-
AESNI_ARCH=86 YASM_FORMAT="elf32"
549535
@echo "Failing after this point just means some helper tools did not build:"
550536
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
551537
@echo "All done"
@@ -558,7 +544,6 @@ linux-x86-64-32-mmx:
558544
CFLAGS="$(CFLAGS) -m32 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
559545
ASFLAGS="$(ASFLAGS) -m32" \
560546
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
561-
AESNI_ARCH=86 YASM_FORMAT="elf32"
562547
@echo "Failing after this point just means some helper tools did not build:"
563548
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
564549
@echo "All done"
@@ -571,7 +556,6 @@ linux-x86-64-32-any:
571556
CFLAGS="$(CFLAGS) -m32 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
572557
ASFLAGS="$(ASFLAGS) -m32" \
573558
LDFLAGS="$(LDFLAGS) -m32 -lcrypt -ldl" \
574-
AESNI_ARCH=86 YASM_FORMAT="elf32"
575559
@echo "Failing after this point just means some helper tools did not build:"
576560
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
577561
@echo "All done"
@@ -605,7 +589,6 @@ linux-x86-xop:
605589
CFLAGS="$(CFLAGS) -m32 -mxop -DHAVE_CRYPT -D_LARGEFILE64_SOURCE" \
606590
ASFLAGS="$(ASFLAGS) -m32 -mxop" \
607591
LDFLAGS="$(LDFLAGS) -m32 -lcrypt" \
608-
AESNI_ARCH=86 YASM_FORMAT="elf32"
609592
@echo "Failing after this point just means some helper tools did not build:"
610593
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32"
611594
@echo "All done"
@@ -619,7 +602,6 @@ linux-x86-avx:
619602
CFLAGS="$(CFLAGS) -m32 -mavx -DHAVE_CRYPT" \
620603
ASFLAGS="$(ASFLAGS) -m32 -mavx" \
621604
LDFLAGS="$(LDFLAGS) -m32 -lcrypt" \
622-
AESNI_ARCH=86 YASM_FORMAT="elf32"
623605
@echo "Failing after this point just means some helper tools did not build:"
624606
$(MAKE_ORIG) $(PROJ_PCAP) CFLAGS="$(CFLAGS) -m32"
625607
@echo "All done"
@@ -632,7 +614,6 @@ linux-x86-opencl:
632614
CFLAGS="$(CFLAGS) -I$(OCLROOT)/include -DHAVE_CRYPT -DHAVE_OPENCL -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
633615
ASFLAGS="$(ASFLAGS) -march=native" \
634616
LDFLAGS="$(LDFLAGS) -L$(OCLROOT)/lib/x86 -L$(OCLROOT)/lib -lcrypt -lOpenCL -ldl -march=native" \
635-
AESNI_ARCH=86 YASM_FORMAT="elf32"
636617
@echo "Failing after this point just means some helper tools did not build:"
637618
$(MAKE_ORIG) $(PROJ_PCAP)
638619
@echo "All done"
@@ -645,7 +626,6 @@ linux-x86-native:
645626
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE -march=native" \
646627
ASFLAGS="$(ASFLAGS) -march=native" \
647628
LDFLAGS="$(LDFLAGS) -lcrypt -ldl -march=native" \
648-
AESNI_ARCH=86 YASM_FORMAT="elf32"
649629
@echo "Failing after this point just means some helper tools did not build:"
650630
$(MAKE_ORIG) $(PROJ_PCAP)
651631
@echo "All done"
@@ -658,7 +638,6 @@ linux-x86-sse2:
658638
CFLAGS="$(CFLAGS) -msse2 -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
659639
ASFLAGS="$(ASFLAGS) -msse2" \
660640
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
661-
AESNI_ARCH=86 YASM_FORMAT="elf32"
662641
@echo "Failing after this point just means some helper tools did not build:"
663642
$(MAKE_ORIG) $(PROJ_PCAP)
664643
@echo "All done"
@@ -670,7 +649,6 @@ linux-x86-mmx:
670649
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o x86-mmx.o" \
671650
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
672651
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
673-
AESNI_ARCH=86 YASM_FORMAT="elf32"
674652
@echo "Failing after this point just means some helper tools did not build:"
675653
$(MAKE_ORIG) $(PROJ_PCAP)
676654
@echo "All done"
@@ -682,7 +660,6 @@ linux-x86-any:
682660
JOHN_OBJS="$(JOHN_OBJS) c3_fmt.o x86.o" \
683661
CFLAGS="$(CFLAGS) -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE" \
684662
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
685-
AESNI_ARCH=86 YASM_FORMAT="elf32"
686663
@echo "Failing after this point just means some helper tools did not build:"
687664
$(MAKE_ORIG) $(PROJ_PCAP)
688665
@echo "All done"
@@ -696,7 +673,6 @@ linux-x86-clang:
696673
LDFLAGS="$(LDFLAGS) -lcrypt -ldl" \
697674
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
698675
OPT_INLINE="$(OPT_NORMAL)" \
699-
AESNI_ARCH=86 YASM_FORMAT="elf32"
700676
@echo "Failing after this point just means some helper tools did not build:"
701677
$(MAKE_ORIG) $(PROJ_PCAP) CC="clang"
702678
@echo "All done"
@@ -709,7 +685,6 @@ linux-x86-clang-debug:
709685
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL -D_LARGEFILE64_SOURCE $(HAVE_LIBGMP) $(OMPFLAGS) $(JOHN_CFLAGS)" \
710686
LDFLAGS="-L/usr/local/lib $(LDFLAGS_OPENSSL) -lm -lz -lcrypt -ldl -faddress-sanitizer $(GMP_LDFLAGS) $(JOHN_LDFLAGS)" \
711687
CPP="clang" CC="clang" AS="clang" LD="clang" CXX="clang++" \
712-
AESNI_ARCH=86 YASM_FORMAT="elf32"
713688
@echo "Failing after this point just means some helper tools did not build:"
714689
$(MAKE_ORIG) $(PROJ_PCAP) \
715690
CFLAGS="-Wall -c -g -O1 -faddress-sanitizer -I/usr/include -msse2 -DDEBUG -DHAVE_CRYPT -DHAVE_LIBDL $(HAVE_LIBGMP) $(OMPFLAGS) $(JOHN_CFLAGS)" \
@@ -1745,7 +1720,7 @@ find_version:
17451720
echo "#define JTR_GIT_VERSION $(JTR_GIT_VERSION)" > version.h.new
17461721
diff >/dev/null 2>/dev/null version.h.new version.h && $(RM) version.h.new || $(MV) version.h.new version.h
17471722

1748-
SUBDIRS = aes secp256k1 ed25519-donna poly1305-donna
1723+
SUBDIRS = mbedtls secp256k1 ed25519-donna poly1305-donna
17491724

17501725
.PHONY: subdirs $(SUBDIRS) find_version
17511726

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

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

17601735
../run/unshadow: ../run/john
17611736
$(RM) ../run/unshadow
@@ -1831,7 +1806,7 @@ john.com: john.asm
18311806
# $(LD) $(JOHN_OBJS) -lkernel32 -lcrypto -o ../run/john.exe
18321807

18331808
../run/john.exe: $(JOHN_OBJS) $(SUBDIRS)
1834-
$(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
1809+
$(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
18351810
$(STRIP) ../run/john.exe
18361811

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

18421817
../run/john-mingw.exe: $(JOHN_OBJS)
1843-
$(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
1818+
$(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
18441819
$(STRIP) ../run/john-mingw.exe
18451820
cp ../run/john-mingw.exe ../run/john.exe
18461821

@@ -2058,7 +2033,7 @@ clean:
20582033
$(RM) *~
20592034
$(RM) dynamic_big_crypt.c fmt_registers.h fmt_externs.h john_build_rule.h version.h version.h.new
20602035
$(CP) $(NULL) Makefile.dep
2061-
+$(MAKE_ORIG) -C aes clean
2036+
+$(MAKE_ORIG) -C mbedtls clean
20622037
+$(MAKE_ORIG) -C secp256k1 clean
20632038
+$(MAKE_ORIG) -C ed25519-donna clean
20642039
+$(MAKE_ORIG) -C poly1305-donna clean

0 commit comments

Comments
 (0)