Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2017-09-06 18:35:35

magny
Contributor
Registered: 2017-09-06
Posts: 12

Hardnested code on OSX

Hi

I have some problems on OSX with the hardnested code for the same tag, I have tried this both on the homebrew version of icemans stable build and compiled my own version with the same results.

 [ ARM ]
 bootrom: iceman// 2017-09-06 16:15:34
      os: iceman// 2017-09-06 16:15:36
 [ FPGA ]
 LF image built for 2s30vq100 on 2015/03/06 at 07:38:04
 HF image built for 2s30vq100 on 2017/05/17 at 17:48:26

 [ Hardware ]
  --= uC: AT91SAM7S512 Rev B
  --= Embedded Processor: ARM7TDMI
  --= Nonvolatile Program Memory Size: 512K bytes, Used: 216914 bytes (41) Free: 307374 bytes (59)
  --= Second Nonvolatile Program Memory Size: None
  --= Internal SRAM Size: 64K bytes
  --= Architecture Identifier: AT91SAM7Sxx Series
  --= Nonvolatile Program Memory Type: Embedded Flash Memory

On windows it works fast and without hickups:

pm3 --> hf mf hardnested 0 A ffffffffffff 19 B
--target block no: 19, target key type:B, known target key: 0x000000000000 (not set), file action: none, Slow: No, Tests: 0



 time    | #nonces | Activity                                                | expected to brute force
         |         |                                                         | #states         | time
------------------------------------------------------------------------------------------------------
       0 |       0 | Start using 4 threads and AVX2 SIMD core                |                 |
       0 |       0 | Brute force benchmark: 640 million (2^29.3) keys/s      | 140737488355328 |    3d
       1 |       0 | Using 235 precalculated bitflip state tables            | 140737488355328 |    3d
       6 |     112 | Apply bit flip properties                               |    833033404416 | 22min
       7 |     224 | Apply bit flip properties                               |    251339571200 |  7min
       8 |     336 | Apply bit flip properties                               |    195359342592 |  5min
       8 |     446 | Apply bit flip properties                               |    164248141824 |  4min
       9 |     558 | Apply bit flip properties                               |    154331447296 |  4min
      10 |     670 | Apply bit flip properties                               |    153816514560 |  4min
      11 |     782 | Apply bit flip properties                               |    153816514560 |  4min
      11 |     893 | Apply bit flip properties                               |    153816514560 |  4min
      12 |    1005 | Apply bit flip properties                               |    153816514560 |  4min
      13 |    1116 | Apply bit flip properties                               |    153816514560 |  4min
      14 |    1225 | Apply bit flip properties                               |    153816514560 |  4min
      15 |    1335 | Apply bit flip properties                               |    153816514560 |  4min
      16 |    1444 | Apply bit flip properties                               |    153816514560 |  4min
      16 |    1552 | Apply bit flip properties                               |    153816514560 |  4min
      19 |    1663 | Apply Sum property. Sum(a0) = 128                       |     24011833344 |   38s
      20 |    1771 | Apply bit flip properties                               |     27183794176 |   42s
      21 |    1882 | Apply bit flip properties                               |     21408495616 |   33s
      21 |    1993 | Apply bit flip properties                               |     21408495616 |   33s
      23 |    2100 | Apply bit flip properties                               |     20679641088 |   32s
      23 |    2206 | Apply bit flip properties                               |     25775753216 |   40s
      24 |    2312 | Apply bit flip properties                               |     29945434112 |   47s
      25 |    2422 | Apply bit flip properties                               |     29945434112 |   47s
      26 |    2530 | Apply bit flip properties                               |     28279986176 |   44s
      27 |    2639 | Apply bit flip properties                               |     25694128128 |   40s
      28 |    2748 | Apply bit flip properties                               |     11533188096 |   18s
      29 |    2859 | Apply bit flip properties                               |     11533188096 |   18s
      29 |    2965 | Apply bit flip properties                               |     11533188096 |   18s
      30 |    3070 | Apply bit flip properties                               |     17135758336 |   27s
      31 |    3175 | Apply bit flip properties                               |     25160384512 |   39s
      32 |    3280 | Apply bit flip properties                               |     14291827712 |   22s
      33 |    3388 | Apply bit flip properties                               |     14291827712 |   22s
      34 |    3492 | Apply bit flip properties                               |     14291827712 |   22s
      35 |    3597 | Apply bit flip properties                               |     14291827712 |   22s
      35 |    3597 | (1. guess: Sum(a8) = 64)                                |     14291827712 |   22s
      35 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     14229858304 |   22s
      35 |    3597 | (2. guess: Sum(a8) = 96)                                |     25697175552 |   40s
      36 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     25110788096 |   39s
      36 |    3597 | (3. guess: Sum(a8) = 32)                                |     41394110464 |   65s
      36 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     41386897408 |   65s
      36 |    3597 | (4. guess: Sum(a8) = 128)                               |     59602608128 |  2min
      38 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     46723739648 |   73s
      43 |    3597 | Brute force phase:  53.26%                              |     44937826304 |   70s
      47 |    3597 | (5. guess: Sum(a8) = 112)                               |     70494445568 |  2min
      48 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     29418924032 |   46s
      50 |    3597 | (6. guess: Sum(a8) = 80)                                |     44079525888 |   69s
      51 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     41449598976 |   65s
      51 |    3597 | (7. guess: Sum(a8) = 120)                               |     64660090880 |  2min
      52 |    3597 | Apply Sum(a8) and all bytes bitflip properties          |     11599750144 |   18s
      52 |    3597 | Brute force phase completed. Key found: e5519e1cc92b    |               0 |    0s
pm3 -->

On OSX on the other hand it just hangs here,

pm3 --> hf mf hardnested 0 A ffffffffffff 19 B
--target block no: 19, target key type:B, known target key: 0x000000000000 (not set), file action: none, Slow: No, Tests: 0



 time    | #nonces | Activity                                                | expected to brute force
         |         |                                                         | #states         | time
------------------------------------------------------------------------------------------------------
       0 |       0 | Start using 8 threads and no SIMD core                  |                 |
       0 |       0 | Brute force benchmark: inf million (2^inf) keys/s       | 140737488355328 |    0s
^C

Any ideas?

Best regards magny

Offline

#2 2017-09-06 18:43:28

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

How much system memory does your OSX have to play with?

and no SIMD core

This part seems weird too

Offline

#3 2017-09-06 18:46:40

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

and what your output from

uname -a

Offline

#4 2017-09-06 18:54:19

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

OSX is my host environment and have 16Gb of memory, with most of it free. Yeah I googled "SIMD" a bit as well, may as well start digging into the code and see what requires it to work.

Offline

#5 2017-09-06 18:55:43

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

➜  uname -a

Darwin MacBook-Pro-2.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Offline

#6 2017-09-06 19:01:24

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

and output from

gcc --version

Offline

#7 2017-09-06 19:02:26

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

My simple quess the client makefile doesn't recoqnise your Darwin x86_64 possibilities...

Offline

#8 2017-09-06 19:05:59

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

Ah I see,

static void get_SIMD_instruction_set(char* instruction_set) {
#if defined (__i386__) || defined (__x86_64__)	
	#if !defined(__APPLE__) || (defined(__APPLE__) && (__clang_major__ > 8))
		#if (__GNUC__ >= 5) && (__GNUC__ > 5 || __GNUC_MINOR__ > 2)
			if (__builtin_cpu_supports("avx512f")) 
				strcpy(instruction_set, "AVX512F");
			else if (__builtin_cpu_supports("avx2")) 
				strcpy(instruction_set, "AVX2");
		#else 
			if (__builtin_cpu_supports("avx2")) strcpy(instruction_set, "AVX2");
		#endif
	else if (__builtin_cpu_supports("avx")) strcpy(instruction_set, "AVX");
	else if (__builtin_cpu_supports("sse2")) strcpy(instruction_set, "SSE2");
	else if (__builtin_cpu_supports("mmx")) strcpy(instruction_set, "MMX");
	else 
	#endif
#endif
		strcpy(instruction_set, "no");
}
➜  client git:(master) ✗ clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
➜  client git:(master) ✗ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
➜  client git:(master) ✗

Offline

#9 2017-09-06 19:15:52

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

changed __clang_major__ >= 8

and got

 time    | #nonces | Activity                                                | expected to brute force
         |         |                                                         | #states         | time
------------------------------------------------------------------------------------------------------
       0 |       0 | Start using 8 threads and AVX2 SIMD core                |                 |
       0 |       0 | Brute force benchmark: inf million (2^inf) keys/s       | 140737488355328 |    0s

Still hangs, for some reason it says 2^inf on the osx version

Offline

#10 2017-09-06 19:22:59

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

how about you try gcc ?

Offline

#11 2017-09-06 19:32:06

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

gcc --version?

I did it in the previous post, but it maybe got a bit hidden smile 

➜  client git:(master) ✗ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Offline

#12 2017-09-06 19:39:05

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

no,  you use clang as a compiler when compiling.  We normally use the GCC.

"How about using gcc when you compile" was the intention of my last post

Offline

#13 2017-09-06 20:16:24

iceman
Administrator
Registered: 2013-04-25
Posts: 9,497
Website

Re: Hardnested code on OSX

If you did the homebrew,  the hardnested will fail since the needed binary bitflip files are missing.

Offline

#14 2017-09-06 20:33:03

magny
Contributor
Registered: 2017-09-06
Posts: 12

Re: Hardnested code on OSX

I compiled this version from sources and have the paths setup correctly (I think), tried with gcc 7 as well with the same results. I will dig deeper in the source to see where it gets stuck more exactly if it can give some hits!

Offline

#15 2017-09-20 09:03:02

piwi
Contributor
Registered: 2013-06-04
Posts: 704

Re: Hardnested code on OSX

Pull Request #393 on official github repository addresses this issue.

Offline

Board footer

Powered by FluxBB