nfc-tools / miLazyCracker

Mifare Classic Plus - Hardnested Attack Implementation for SCL3711 LibNFC USB reader
313 stars 61 forks source link

Linker Errors in gcc10 #24

Closed priv closed 2 years ago

priv commented 3 years ago

Run Installer on Ubuntu 20.10, libnfc_crypto1_crack failed to link.

--2020-11-23 18:53:42--  http://web.archive.org/web/20190221140220if_/http://www2.vaneay.fr/mifare/craptev1-v1.1.tar.xz
Resolving web.archive.org (web.archive.org)... 207.241.226.190
Connecting to web.archive.org (web.archive.org)|207.241.226.190|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-tar]
Saving to: ‘craptev1-v1.1.tar.xz’

     0K .......... .......... .......... .......... .......... 12.9K
    50K .......... .....                                       46.4K=4.2s

2020-11-23 18:53:47 (15.4 KB/s) - ‘craptev1-v1.1.tar.xz’ saved [66576]

--2020-11-23 18:53:47--  http://web.archive.org/web/20190221140255if_/http://www2.vaneay.fr/mifare/crapto1-v3.3.tar.xz
Resolving web.archive.org (web.archive.org)... 207.241.226.190
Connecting to web.archive.org (web.archive.org)|207.241.226.190|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-tar]
Saving to: ‘crapto1-v3.3.tar.xz’

     0K ......                                                 42.5K=0.1s

2020-11-23 18:53:48 (42.5 KB/s) - ‘crapto1-v3.3.tar.xz’ saved [6476]

+ '[' -f /etc/debian_version ']'
+ pkgs=
+ for pkg in git libnfc-bin autoconf libnfc-dev
+ dpkg -l git
+ for pkg in git libnfc-bin autoconf libnfc-dev
+ dpkg -l libnfc-bin
+ for pkg in git libnfc-bin autoconf libnfc-dev
+ dpkg -l autoconf
+ for pkg in git libnfc-bin autoconf libnfc-dev
+ dpkg -l libnfc-dev
+ '[' '' '!=' '' ']'
+ '[' -d mfoc ']'
+ git clone https://github.com/nfc-tools/mfoc.git
Cloning into 'mfoc'...
+ cd mfoc
+ git reset --hard
HEAD is now at ba072f1 update debian dir with up-to-date packaging
+ git clean -dfx
+ autoreconf -vfi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:11: installing './compile'
configure.ac:9: installing './install-sh'
configure.ac:9: installing './missing'
Makefile.am: installing './INSTALL'
src/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
+ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libnfc >= 1.7.0... yes
checking for inline... inline
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for size_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for memset... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
+ make
make  all-recursive
make[1]: Entering directory '/home/alvin/test/miLazyCracker/mfoc'
Making all in src
make[2]: Entering directory '/home/alvin/test/miLazyCracker/mfoc/src'
  CC       crapto1.o
  CC       crypto1.o
  CC       mfoc.o
mfoc.c: In function ‘main’:
mfoc.c:549:43: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  549 |                     fprintf(pfKey, "%012llx;%d;%c;%d;%c", knownKey, knownSector, knownKeyLetter, unknownSector, unknownKeyLetter);
      |                                     ~~~~~~^               ~~~~~~~~
      |                                           |               |
      |                                           |               uint64_t {aka long unsigned int}
      |                                           long long unsigned int
      |                                     %012lx
  CC       mifare.o
  CC       nfc-utils.o
  CCLD     mfoc
make[2]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc/src'
make[2]: Entering directory '/home/alvin/test/miLazyCracker/mfoc'
make[2]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc'
make[1]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc'
+ sudo make install
Making install in src
make[1]: Entering directory '/home/alvin/test/miLazyCracker/mfoc/src'
make[2]: Entering directory '/home/alvin/test/miLazyCracker/mfoc/src'
 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c mfoc '/usr/local/bin'
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 mfoc.1 '/usr/local/share/man/man1'
make[2]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc/src'
make[1]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc/src'
make[1]: Entering directory '/home/alvin/test/miLazyCracker/mfoc'
make[2]: Entering directory '/home/alvin/test/miLazyCracker/mfoc'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc'
make[1]: Leaving directory '/home/alvin/test/miLazyCracker/mfoc'
+ '[' -d crypto1_bs ']'
+ git clone https://github.com/aczid/crypto1_bs
Cloning into 'crypto1_bs'...
+ cd crypto1_bs
+ git reset --hard
HEAD is now at 873a384 Merge branch 'master' of github.com:aczid/crypto1_bs
+ git clean -dfx
+ patch -p1
patching file libnfc_crypto1_crack.c
+ tar Jxvf ../craptev1-v1.1.tar.xz
craptev1-v1.1/
craptev1-v1.1/readme
craptev1-v1.1/Makefile
craptev1-v1.1/craptev1.h
craptev1-v1.1/craptev1.c
craptev1-v1.1/solve.c
craptev1-v1.1/0xcafec0de.txt
+ mkdir crapto1-v3.3
+ tar Jxvf ../crapto1-v3.3.tar.xz -C crapto1-v3.3
crapto1.c
crapto1.h
crypto1.c
readme
+ make
gcc -std=gnu99 -O3 -march=native solve_bs.c crypto1_bs.c crypto1_bs_crack.c  crapto1-v3.3/crapto1.c crapto1-v3.3/crypto1.c -I crapto1-v3.3/  craptev1-v1.1/craptev1.c -I craptev1-v1.1/ -o solve_bs -lpthread -lm
/usr/bin/ld: /tmp/ccI5eWJA.o:(.bss+0x20): multiple definition of `bs_ones'; /tmp/ccXj0BWD.o:(.bss+0x4b160): first defined here
/usr/bin/ld: /tmp/ccI5eWJA.o:(.bss+0x0): multiple definition of `bs_zeroes'; /tmp/ccXj0BWD.o:(.bss+0x4b140): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x0): multiple definition of `bitsliced_rollback_byte'; /tmp/ccXj0BWD.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x100): multiple definition of `bitsliced_encrypted_parity_bits'; /tmp/ccXj0BWD.o:(.bss+0x120): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x4b110): multiple definition of `keys_found'; /tmp/ccXj0BWD.o:(.bss+0x4b130): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x4b140): multiple definition of `bs_ones'; /tmp/ccXj0BWD.o:(.bss+0x4b160): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x4b108): multiple definition of `total_states_tested'; /tmp/ccXj0BWD.o:(.bss+0x4b128): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x25900): multiple definition of `bitsliced_encrypted_nonces'; /tmp/ccXj0BWD.o:(.bss+0x25920): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x4b120): multiple definition of `bs_zeroes'; /tmp/ccXj0BWD.o:(.bss+0x4b140): first defined here
/usr/bin/ld: /tmp/ccV6aqUC.o:(.bss+0x4b100): multiple definition of `total_states'; /tmp/ccXj0BWD.o:(.bss+0x4b120): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:19: solve_bs] Error 1
+ sudo cp -a libnfc_crypto1_crack /usr/local/bin
cp: cannot stat 'libnfc_crypto1_crack': No such file or directory
+ sudo cp -a miLazyCracker.sh /usr/local/bin/miLazyCracker
+ echo Done.
Done.
priv commented 3 years ago

Submit a patch in PR #25