[GH-ISSUE #1474] Add preprocessor warnings for formats that are skipped #949

Closed
opened 2026-10-14 03:29:39 +07:00 by bsakaguchi · 15 comments
Owner

Originally created by @frank-dittrich on GitHub (Jun 28, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1474

Originally assigned to: @frank-dittrich on GitHub.

Otherwise, users and developers will not notice that (and why) they do not get all the formats.
./configure of course mentions when you don't get OpenCL and CUDA formats in the "feature summary" output.
It also mentions pkzip format and generic crypt(3) format.
But it doesn't mention that you don't get OpenVMS format on big endian systems, or if some formats are suppressed due to missing CPU features (SSE4.1, etc).

In these cases, we should add a preprocessor warning, either for DEBUG builds or for all builds.

See comments on commit github.com/magnumripper/JohnTheRipper@b1da77d8a2.

At least these formats can be skipped depending on endianness, CPU features, etc:

  • Stribog-256
  • Stribog-512
  • OpenVMS

So we need to add preprocessor warnings in case they are skipped.

Originally created by @frank-dittrich on GitHub (Jun 28, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1474 Originally assigned to: @frank-dittrich on GitHub. Otherwise, users and developers will not notice that (and why) they do not get all the formats. ./configure of course mentions when you don't get OpenCL and CUDA formats in the "feature summary" output. It also mentions pkzip format and generic crypt(3) format. But it doesn't mention that you don't get OpenVMS format on big endian systems, or if some formats are suppressed due to missing CPU features (SSE4.1, etc). In these cases, we should add a preprocessor warning, either for DEBUG builds or for all builds. See comments on commit https://github.com/magnumripper/JohnTheRipper/commit/b1da77d8a235a0517782700f1cbe536e4203b0ed. At least these formats can be skipped depending on endianness, CPU features, etc: - [x] Stribog-256 - [x] Stribog-512 - [x] OpenVMS So we need to add preprocessor warnings in case they are skipped.
Author
Owner

@lei-april commented on GitHub (Jul 1, 2015):

The build info of a POWER build compared with a typical x86 build (no CUDA or OpenCL):

1,3c1,3
< Version: 1.8.0-jumbo-1-2778-g9977f4c+
< Build: linux-gnu 64-bit powerpc64le-autoconf OMP
< Arch: 64-bit BE
---
> Version: 1.8.0-jumbo-1-2779-g2bda069
> Build: linux-gnu 64-bit AVX2-autoconf OMP
> Arch: 64-bit LE
15c15
< Compiler version: 4.9.2 20141101 (Red Hat 4.9.2-1)
---
> Compiler version: 4.9.2
17c17
< GNU libc version: 2.20 (loaded: 2.20)
---
> GNU libc version: 2.15 (loaded: 2.15)
19,21c19,21
< OpenSSL library version: 0100010bf
< OpenSSL 1.0.1k-fips 8 Jan 2015
< GMP library version: 6.0.0
---
> OpenSSL library version: 01000100f
> OpenSSL 1.0.1 14 Mar 2012
> GMP library version: 5.0.2

And the configure summary of the POWER build:

Target CPU .................................. powerpc64le, 64-bit BE
AES-NI support .............................. no
Target OS ................................... linux-gnu
Cross compiling ............................. no
Legacy arch header .......................... ppc32.h

Optional libraries/features found:
Experimental code ........................... no
OpenMPI support (default disabled) .......... no
Fork support ................................ yes
OpenMP support .............................. yes (not for fast formats)
OpenCL support .............................. no
CUDA support ................................ no
Generic crypt(3) format ..................... yes
Rexgen (extra cracking mode) ................ no
GMP (PRINCE mode and faster SRP formats) .... yes
PCAP (vncpcap2john and SIPdump) ............. no
Z (pkzip format, gpg2john) .................. yes
BZ2 (gpg2john extra decompression logic) .... yes
128-bit integer (faster PRINCE mode) ........ yes
Memory map (share/page large files) ......... yes

Development options (these may hurt performance when enabled):
Memdbg memory debugging settings ............ disabled
AddressSanitizer ("ASan") ................... disabled

There's another minor issue. The POWER platform in use is actually configured as little endian, but is reported as big endian here.

<!-- gh-comment-id:117496450 --> @lei-april commented on GitHub (Jul 1, 2015): The build info of a POWER build compared with a typical x86 build (no CUDA or OpenCL): ``` diff 1,3c1,3 < Version: 1.8.0-jumbo-1-2778-g9977f4c+ < Build: linux-gnu 64-bit powerpc64le-autoconf OMP < Arch: 64-bit BE --- > Version: 1.8.0-jumbo-1-2779-g2bda069 > Build: linux-gnu 64-bit AVX2-autoconf OMP > Arch: 64-bit LE 15c15 < Compiler version: 4.9.2 20141101 (Red Hat 4.9.2-1) --- > Compiler version: 4.9.2 17c17 < GNU libc version: 2.20 (loaded: 2.20) --- > GNU libc version: 2.15 (loaded: 2.15) 19,21c19,21 < OpenSSL library version: 0100010bf < OpenSSL 1.0.1k-fips 8 Jan 2015 < GMP library version: 6.0.0 --- > OpenSSL library version: 01000100f > OpenSSL 1.0.1 14 Mar 2012 > GMP library version: 5.0.2 ``` And the configure summary of the POWER build: ``` Target CPU .................................. powerpc64le, 64-bit BE AES-NI support .............................. no Target OS ................................... linux-gnu Cross compiling ............................. no Legacy arch header .......................... ppc32.h Optional libraries/features found: Experimental code ........................... no OpenMPI support (default disabled) .......... no Fork support ................................ yes OpenMP support .............................. yes (not for fast formats) OpenCL support .............................. no CUDA support ................................ no Generic crypt(3) format ..................... yes Rexgen (extra cracking mode) ................ no GMP (PRINCE mode and faster SRP formats) .... yes PCAP (vncpcap2john and SIPdump) ............. no Z (pkzip format, gpg2john) .................. yes BZ2 (gpg2john extra decompression logic) .... yes 128-bit integer (faster PRINCE mode) ........ yes Memory map (share/page large files) ......... yes Development options (these may hurt performance when enabled): Memdbg memory debugging settings ............ disabled AddressSanitizer ("ASan") ................... disabled ``` There's another minor issue. The POWER platform in use is actually configured as little endian, but is reported as big endian here.
Author
Owner

@frank-dittrich commented on GitHub (Jul 1, 2015):

So, which formats are missing?
I am sure that OpenVMS format is most likely missing, I recently saw the if ARCH_LITTLE_ENDIAN in vms_fmt_plug.c.
But there must be some more that are missing in your POWER build.

<!-- gh-comment-id:117497795 --> @frank-dittrich commented on GitHub (Jul 1, 2015): So, which formats are missing? I am sure that OpenVMS format is most likely missing, I recently saw the `if ARCH_LITTLE_ENDIAN` in vms_fmt_plug.c. But there must be some more that are missing in your POWER build.
Author
Owner

@lei-april commented on GitHub (Jul 1, 2015):

The missing formats are:

Raw-SHA1-Linkedin
Raw-SHA256-ng
Raw-SHA512-ng
Raw-SHA1-ng,
Stribog-256
Stribog-512
OpenVMS
<!-- gh-comment-id:117512121 --> @lei-april commented on GitHub (Jul 1, 2015): The missing formats are: ``` Raw-SHA1-Linkedin Raw-SHA256-ng Raw-SHA512-ng Raw-SHA1-ng, Stribog-256 Stribog-512 OpenVMS ```
Author
Owner

@frank-dittrich commented on GitHub (Jul 1, 2015):

#if defined(SIMD_PARA_SHA1) causes Raw-SHA1-Linkedin to be excluded.
#if SIMD_COEF_32 causes Raw-SHA256-ng and Raw-SHA512-ng to be excluded.
#if defined(SIMD_COEF_32) && (SIMD_COEF_32 < 16 || ARCH_BITS >= 64) && !_MSC_VER causes Raw-SHA1-ng to be excluded.
For the *-ng formats there are similar formats without the -ng suffix. These should crack the same hashes, just a little slower.
Nevertheless, I think we should add a #warning ... here.
#if __SSE4_1__ excludes Stribog-256 and Stribog-512.
And OpenVMS apparently only works for LE archs.

<!-- gh-comment-id:117522244 --> @frank-dittrich commented on GitHub (Jul 1, 2015): `#if defined(SIMD_PARA_SHA1)` causes Raw-SHA1-Linkedin to be excluded. `#if SIMD_COEF_32` causes Raw-SHA256-ng and Raw-SHA512-ng to be excluded. `#if defined(SIMD_COEF_32) && (SIMD_COEF_32 < 16 || ARCH_BITS >= 64) && !_MSC_VER` causes Raw-SHA1-ng to be excluded. For the `*-ng` formats there are similar formats without the `-ng` suffix. These should crack the same hashes, just a little slower. Nevertheless, I think we should add a `#warning ...` here. `#if __SSE4_1__` excludes Stribog-256 and Stribog-512. And OpenVMS apparently only works for LE archs.
Author
Owner

@lei-april commented on GitHub (Jul 1, 2015):

In configure:

 7741   powerpcle) ARCH_LINK=ppc32.h endian=little ;;
 7742   powerpc*) ARCH_LINK=ppc32.h endian=big ;;

Both a LE build and a BE build use ppc32.h. But in ppc32.h:

 26 #define ARCH_LITTLE_ENDIAN      0

This is problematic.

<!-- gh-comment-id:117538844 --> @lei-april commented on GitHub (Jul 1, 2015): In configure: ``` 7741 powerpcle) ARCH_LINK=ppc32.h endian=little ;; 7742 powerpc*) ARCH_LINK=ppc32.h endian=big ;; ``` Both a LE build and a BE build use ppc32.h. But in ppc32.h: ``` c 26 #define ARCH_LITTLE_ENDIAN 0 ``` This is problematic.
Author
Owner

@frank-dittrich commented on GitHub (Jul 1, 2015):

@zzlei what is the output of --list=build-info for your build?

<!-- gh-comment-id:117539463 --> @frank-dittrich commented on GitHub (Jul 1, 2015): @zzlei what is the output of `--list=build-info` for your build?
Author
Owner

@lei-april commented on GitHub (Jul 1, 2015):

Version: 1.8.0-jumbo-1-2778-g9977f4c+
Build: linux-gnu 64-bit powerpc64le-autoconf OMP
Arch: 64-bit BE
$JOHN is ../run/
Format interface version: 13
Max. number of reported tunable costs: 3
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
Max. Markov mode level: 400
Max. Markov mode password length: 30
File locking: fcntl()
Compiler version: 4.9.2 20141101 (Red Hat 4.9.2-1)
gcc version: 4.9.2
GNU libc version: 2.20 (loaded: 2.20)
Crypto library: OpenSSL
OpenSSL library version: 0100010bf
OpenSSL 1.0.1k-fips 8 Jan 2015
GMP library version: 6.0.0
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's
<!-- gh-comment-id:117540075 --> @lei-april commented on GitHub (Jul 1, 2015): ``` Version: 1.8.0-jumbo-1-2778-g9977f4c+ Build: linux-gnu 64-bit powerpc64le-autoconf OMP Arch: 64-bit BE $JOHN is ../run/ Format interface version: 13 Max. number of reported tunable costs: 3 Rec file version: REC4 Charset file version: CHR3 CHARSET_MIN: 1 (0x01) CHARSET_MAX: 255 (0xff) CHARSET_LENGTH: 24 Max. Markov mode level: 400 Max. Markov mode password length: 30 File locking: fcntl() Compiler version: 4.9.2 20141101 (Red Hat 4.9.2-1) gcc version: 4.9.2 GNU libc version: 2.20 (loaded: 2.20) Crypto library: OpenSSL OpenSSL library version: 0100010bf OpenSSL 1.0.1k-fips 8 Jan 2015 GMP library version: 6.0.0 fseek(): fseek ftell(): ftell fopen(): fopen memmem(): System's ```
Author
Owner

@jfoug commented on GitHub (Jul 1, 2015):

The problem is this is an LE system, but configure picks BE

<!-- gh-comment-id:117584815 --> @jfoug commented on GitHub (Jul 1, 2015): The problem is this is an LE system, but configure picks BE
Author
Owner

@magnumripper commented on GitHub (Jul 1, 2015):

In configure:

 7741   powerpcle) ARCH_LINK=ppc32.h endian=little ;;
 7742   powerpc*) ARCH_LINK=ppc32.h endian=big ;;

Both a LE build and a BE build use ppc32.h. But in ppc32.h:

 26 #define ARCH_LITTLE_ENDIAN      0

This is problematic.

I shouldn't be, the file starts with

#if AC_BUILT
#include "autoconfig.h"
#else

and line 26 is within the #else clause

<!-- gh-comment-id:117624633 --> @magnumripper commented on GitHub (Jul 1, 2015): > In configure: > > ``` > 7741 powerpcle) ARCH_LINK=ppc32.h endian=little ;; > 7742 powerpc*) ARCH_LINK=ppc32.h endian=big ;; > ``` > > Both a LE build and a BE build use ppc32.h. But in ppc32.h: > > ``` c > 26 #define ARCH_LITTLE_ENDIAN 0 > ``` > > This is problematic. I shouldn't be, the file starts with ``` c #if AC_BUILT #include "autoconfig.h" #else ``` and line 26 is within the #else clause
Author
Owner

@magnumripper commented on GitHub (Jul 1, 2015):

In configure:

 7741   powerpcle) ARCH_LINK=ppc32.h endian=little ;;
 7742   powerpc*) ARCH_LINK=ppc32.h endian=big ;;

I think we need this

diff --git a/src/configure.ac b/src/configure.ac
index 2bffa44..d9c8db5 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -320,6 +320,8 @@ case "$host_cpu" in
   mips64*) ARCH_LINK=mips64.h endian=big ;;
   mips*) ARCH_LINK=mips32.h endian=big ;;
   pdp*) ARCH_LINK=autoconf_arch.h endian=little ;;
+  powerpc64le) ARCH_LINK=ppc64.h endian=little ;;
+  powerpc64*) ARCH_LINK=ppc64.h endian=big ;;
   powerpcle) ARCH_LINK=ppc32.h endian=little ;;
   powerpc*) ARCH_LINK=ppc32.h endian=big ;;
   sparc64) ARCH_LINK=sparc64.h endian=big ;;
<!-- gh-comment-id:117626141 --> @magnumripper commented on GitHub (Jul 1, 2015): > In configure: > > ``` > 7741 powerpcle) ARCH_LINK=ppc32.h endian=little ;; > 7742 powerpc*) ARCH_LINK=ppc32.h endian=big ;; > ``` I think we need this ``` diff diff --git a/src/configure.ac b/src/configure.ac index 2bffa44..d9c8db5 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -320,6 +320,8 @@ case "$host_cpu" in mips64*) ARCH_LINK=mips64.h endian=big ;; mips*) ARCH_LINK=mips32.h endian=big ;; pdp*) ARCH_LINK=autoconf_arch.h endian=little ;; + powerpc64le) ARCH_LINK=ppc64.h endian=little ;; + powerpc64*) ARCH_LINK=ppc64.h endian=big ;; powerpcle) ARCH_LINK=ppc32.h endian=little ;; powerpc*) ARCH_LINK=ppc32.h endian=big ;; sparc64) ARCH_LINK=sparc64.h endian=big ;; ```
Author
Owner

@frank-dittrich commented on GitHub (Jul 1, 2015):

Do we need to sanity-check the endianness of the build against any of these?

$ gcc -dM -E -x c /dev/null | grep -E "(ORDER|ENDIAN)"
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __ORDER_PDP_ENDIAN__ 3412
#define __ORDER_BIG_ENDIAN__ 4321
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
$ clang -dM -E -x c /dev/null | grep -E "(ORDER|ENDIAN)"
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __LITTLE_ENDIAN__ 1
#define __ORDER_BIG_ENDIAN__ 4321
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __ORDER_PDP_ENDIAN__ 3412
<!-- gh-comment-id:117627031 --> @frank-dittrich commented on GitHub (Jul 1, 2015): Do we need to sanity-check the endianness of the build against any of these? ``` $ gcc -dM -E -x c /dev/null | grep -E "(ORDER|ENDIAN)" #define __ORDER_LITTLE_ENDIAN__ 1234 #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __ORDER_PDP_ENDIAN__ 3412 #define __ORDER_BIG_ENDIAN__ 4321 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ $ clang -dM -E -x c /dev/null | grep -E "(ORDER|ENDIAN)" #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_PDP_ENDIAN__ 3412 ```
Author
Owner

@lei-april commented on GitHub (Jul 1, 2015):

diff --git a/src/configure.ac b/src/configure.ac
index 2bffa44..d9c8db5 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -320,6 +320,8 @@ case "$host_cpu" in
   mips64*) ARCH_LINK=mips64.h endian=big ;;
   mips*) ARCH_LINK=mips32.h endian=big ;;
   pdp*) ARCH_LINK=autoconf_arch.h endian=little ;;
+  powerpc64le) ARCH_LINK=ppc64.h endian=little ;;
+  powerpc64*) ARCH_LINK=ppc64.h endian=big ;;
   powerpcle) ARCH_LINK=ppc32.h endian=little ;;
   powerpc*) ARCH_LINK=ppc32.h endian=big ;;
   sparc64) ARCH_LINK=sparc64.h endian=big ;;

I think that's the right solution. The actually CPU name is powerpc64le, and it was wrongly matched with powerpc*, thus the wrong endianness report.

<!-- gh-comment-id:117649166 --> @lei-april commented on GitHub (Jul 1, 2015): ``` diff diff --git a/src/configure.ac b/src/configure.ac index 2bffa44..d9c8db5 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -320,6 +320,8 @@ case "$host_cpu" in mips64*) ARCH_LINK=mips64.h endian=big ;; mips*) ARCH_LINK=mips32.h endian=big ;; pdp*) ARCH_LINK=autoconf_arch.h endian=little ;; + powerpc64le) ARCH_LINK=ppc64.h endian=little ;; + powerpc64*) ARCH_LINK=ppc64.h endian=big ;; powerpcle) ARCH_LINK=ppc32.h endian=little ;; powerpc*) ARCH_LINK=ppc32.h endian=big ;; sparc64) ARCH_LINK=sparc64.h endian=big ;; ``` I think that's the right solution. The actually CPU name is `powerpc64le`, and it was wrongly matched with `powerpc*`, thus the wrong endianness report.
Author
Owner

@frank-dittrich commented on GitHub (Aug 11, 2015):

See commit b3293b0a4f

Now that Jim disabled some tools like luks2john

+#if !AC_BUILT || HAVE_BIO_NEW

we might also need to add a warning if such tools disappear...

<!-- gh-comment-id:129990997 --> @frank-dittrich commented on GitHub (Aug 11, 2015): See commit b3293b0a4f6b5abfc0450d03b7d2aff9036472fb Now that Jim disabled some tools like luks2john ``` +#if !AC_BUILT || HAVE_BIO_NEW ``` we might also need to add a warning if such tools disappear...
Author
Owner

@frank-dittrich commented on GitHub (Jan 18, 2016):

Stribog formats now have a warning:

ebbbfc1a (Dhiru Kholia   2015-05-16 17:36:40 +0200 493) #endif /* plugin stanza */
95df0edf (magnum         2015-05-20 00:25:24 +0200 494) 
3f31249a (Frank Dittrich 2016-01-12 15:39:29 +0100 495) #else
1a52a3b2 (JimF           2016-01-15 16:02:01 -0600 496) #if !defined(FMT_EXTERNS_H) && !defined(FMT_REGISTERS_H)
1a52a3b2 (JimF           2016-01-15 16:02:01 -0600 497) #ifdef __GNUC__
3f31249a (Frank Dittrich 2016-01-12 15:39:29 +0100 498) #warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled
1a52a3b2 (JimF           2016-01-15 16:02:01 -0600 499) #elif _MSC_VER
1a52a3b2 (JimF           2016-01-15 16:02:01 -0600 500) #pragma message(": warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled:")
1a52a3b2 (JimF           2016-01-15 16:02:01 -0600 501) #endif
b6744dbe (Frank Dittrich 2016-01-12 23:58:48 +0100 502) #endif
95df0edf (magnum         2015-05-20 00:25:24 +0200 503) #endif /* __SSE4_1__ */
<!-- gh-comment-id:172610050 --> @frank-dittrich commented on GitHub (Jan 18, 2016): Stribog formats now have a warning: ``` ebbbfc1a (Dhiru Kholia 2015-05-16 17:36:40 +0200 493) #endif /* plugin stanza */ 95df0edf (magnum 2015-05-20 00:25:24 +0200 494) 3f31249a (Frank Dittrich 2016-01-12 15:39:29 +0100 495) #else 1a52a3b2 (JimF 2016-01-15 16:02:01 -0600 496) #if !defined(FMT_EXTERNS_H) && !defined(FMT_REGISTERS_H) 1a52a3b2 (JimF 2016-01-15 16:02:01 -0600 497) #ifdef __GNUC__ 3f31249a (Frank Dittrich 2016-01-12 15:39:29 +0100 498) #warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled 1a52a3b2 (JimF 2016-01-15 16:02:01 -0600 499) #elif _MSC_VER 1a52a3b2 (JimF 2016-01-15 16:02:01 -0600 500) #pragma message(": warning Stribog-256 and Stribog-512 formats require SSE 4.1, formats disabled:") 1a52a3b2 (JimF 2016-01-15 16:02:01 -0600 501) #endif b6744dbe (Frank Dittrich 2016-01-12 23:58:48 +0100 502) #endif 95df0edf (magnum 2015-05-20 00:25:24 +0200 503) #endif /* __SSE4_1__ */ ```
Author
Owner

@magnumripper commented on GitHub (Apr 10, 2019):

I now removed the following from OP

  • Raw-SHA1-Linkedin
  • Raw-SHA256-ng
  • Raw-SHA512-ng
  • Raw-SHA1-ng

Reason being that all -ng formats are merely other versions of more portable ones, and the linkedin format isn't very interesting anymore (all complete hashes were later leaked IIRC).

Only one left is thus VMS. It gets disabled on BE platforms.

<!-- gh-comment-id:481902486 --> @magnumripper commented on GitHub (Apr 10, 2019): I now removed the following from OP - [ ] Raw-SHA1-Linkedin - [ ] Raw-SHA256-ng - [ ] Raw-SHA512-ng - [ ] Raw-SHA1-ng Reason being that all -ng formats are merely other versions of more portable ones, and the linkedin format isn't very interesting anymore (all complete hashes were later leaked IIRC). Only one left is thus VMS. It gets disabled on BE platforms.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#949
No description provided.