[GH-ISSUE #1526] New legacy build errors for dynamic #996

Closed
opened 2026-10-14 03:31:13 +07:00 by bsakaguchi · 31 comments
Owner

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

Originally assigned to: @frank-dittrich on GitHub.

 $ make -s -f Makefile.legacy linux-x86-64-native
dynamic_compiler.c:518:32: error: '#' is not followed by a macro parameter
 #define LOOKUP_IF_BLK(T,U,S,F,L) \
                                ^
dynamic_compiler.c: In function ‘comp_get_symbol’:
dynamic_compiler.c:555:2: warning: implicit declaration of function ‘LOOKUP_IF_BLK’ [-Wimplicit-function-declaration]
  LOOKUP_IF_BLK(md5,MD5,5,5,3)
  ^
dynamic_compiler.c:555:16: error: ‘md5’ undeclared (first use in this function)
  LOOKUP_IF_BLK(md5,MD5,5,5,3)
                ^
dynamic_compiler.c:555:16: note: each undeclared identifier is reported only once for each function it appears in
dynamic_compiler.c:555:20: error: ‘MD5’ undeclared (first use in this function)
  LOOKUP_IF_BLK(md5,MD5,5,5,3)
                    ^
dynamic_compiler.c:556:2: error: expected ‘;’ before ‘LOOKUP_IF_BLK’
  LOOKUP_IF_BLK(md4,MD4,4,4,3)
  ^
dynamic_compiler.c: At top level:
dynamic_compiler.c:388:14: warning: ‘dynamic_f5h’ defined but not used [-Wunused-function]
  static void dynamic_f##N##h()    { dyna_helper_pre(); T##_hex();               dyna_helper_poststr(); } \
              ^
dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’
 LEXI_FUNC(5,md5,16)       LEXI_FUNC(4,md4,16)          LEXI_FUNC(1,sha1,20)
 ^
dynamic_compiler.c:389:14: warning: ‘dynamic_f5H’ defined but not used [-Wunused-function]
  static void dynamic_f##N##H()    { dyna_helper_pre(); T##_hex(); strupr(h);    dyna_helper_poststr(); } \
              ^
dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’
 LEXI_FUNC(5,md5,16)       LEXI_FUNC(4,md4,16)          LEXI_FUNC(1,sha1,20)
 ^
dynamic_compiler.c:390:14: warning: ‘dynamic_f56’ defined but not used [-Wunused-function]
  static void dynamic_f##N##6()    { dyna_helper_pre(); T##_base64();            dyna_helper_poststr(); } \
              ^
dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’
 LEXI_FUNC(5,md5,16)       LEXI_FUNC(4,md4,16)          LEXI_FUNC(1,sha1,20)
 ^
[...]

I'll look into this, but don't have time for it right now.

Originally created by @frank-dittrich on GitHub (Jul 9, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1526 Originally assigned to: @frank-dittrich on GitHub. ``` $ make -s -f Makefile.legacy linux-x86-64-native dynamic_compiler.c:518:32: error: '#' is not followed by a macro parameter #define LOOKUP_IF_BLK(T,U,S,F,L) \ ^ dynamic_compiler.c: In function ‘comp_get_symbol’: dynamic_compiler.c:555:2: warning: implicit declaration of function ‘LOOKUP_IF_BLK’ [-Wimplicit-function-declaration] LOOKUP_IF_BLK(md5,MD5,5,5,3) ^ dynamic_compiler.c:555:16: error: ‘md5’ undeclared (first use in this function) LOOKUP_IF_BLK(md5,MD5,5,5,3) ^ dynamic_compiler.c:555:16: note: each undeclared identifier is reported only once for each function it appears in dynamic_compiler.c:555:20: error: ‘MD5’ undeclared (first use in this function) LOOKUP_IF_BLK(md5,MD5,5,5,3) ^ dynamic_compiler.c:556:2: error: expected ‘;’ before ‘LOOKUP_IF_BLK’ LOOKUP_IF_BLK(md4,MD4,4,4,3) ^ dynamic_compiler.c: At top level: dynamic_compiler.c:388:14: warning: ‘dynamic_f5h’ defined but not used [-Wunused-function] static void dynamic_f##N##h() { dyna_helper_pre(); T##_hex(); dyna_helper_poststr(); } \ ^ dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’ LEXI_FUNC(5,md5,16) LEXI_FUNC(4,md4,16) LEXI_FUNC(1,sha1,20) ^ dynamic_compiler.c:389:14: warning: ‘dynamic_f5H’ defined but not used [-Wunused-function] static void dynamic_f##N##H() { dyna_helper_pre(); T##_hex(); strupr(h); dyna_helper_poststr(); } \ ^ dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’ LEXI_FUNC(5,md5,16) LEXI_FUNC(4,md4,16) LEXI_FUNC(1,sha1,20) ^ dynamic_compiler.c:390:14: warning: ‘dynamic_f56’ defined but not used [-Wunused-function] static void dynamic_f##N##6() { dyna_helper_pre(); T##_base64(); dyna_helper_poststr(); } \ ^ dynamic_compiler.c:393:1: note: in expansion of macro ‘LEXI_FUNC’ LEXI_FUNC(5,md5,16) LEXI_FUNC(4,md4,16) LEXI_FUNC(1,sha1,20) ^ [...] ``` I'll look into this, but don't have time for it right now.
bsakaguchi 2026-10-14 03:31:13 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

I get an entire different failure for legacy linux-x86-64-native target:

[ghost@localhost src]$ make -s -f Makefile.legacy linux-x86-64-native
md4.c: In function ‘body’:
md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’
  (ctx->Block[(n)] = \
      ^
md4.c:44:29: note: in definition of macro ‘STEP’
  (a) += f((b), (c), (d)) + (x); \
                             ^
md4.c:95:23: note: in expansion of macro ‘SET’
   STEP(F, a, b, c, d, SET(0), 3)
                       ^
md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’
  (ctx->Block[(n)] = \
      ^
md4.c:44:29: note: in definition of macro ‘STEP’
  (a) += f((b), (c), (d)) + (x); \
                             ^
md4.c:96:23: note: in expansion of macro ‘SET’
   STEP(F, d, a, b, c, SET(1), 7)
                       ^
md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’
  (ctx->Block[(n)] = \
      ^
md4.c:44:29: note: in definition of macro ‘STEP’
  (a) += f((b), (c), (d)) + (x); \
                             ^
md4.c:97:23: note: in expansion of macro ‘SET’
   STEP(F, c, d, a, b, SET(2), 11)
.......

This was after doing a 'make distclean' to make sure there were no straggler stuff from a ./configure run

<!-- gh-comment-id:120008446 --> @jfoug commented on GitHub (Jul 9, 2015): I get an entire different failure for legacy linux-x86-64-native target: ``` [ghost@localhost src]$ make -s -f Makefile.legacy linux-x86-64-native md4.c: In function ‘body’: md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’ (ctx->Block[(n)] = \ ^ md4.c:44:29: note: in definition of macro ‘STEP’ (a) += f((b), (c), (d)) + (x); \ ^ md4.c:95:23: note: in expansion of macro ‘SET’ STEP(F, a, b, c, d, SET(0), 3) ^ md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’ (ctx->Block[(n)] = \ ^ md4.c:44:29: note: in definition of macro ‘STEP’ (a) += f((b), (c), (d)) + (x); \ ^ md4.c:96:23: note: in expansion of macro ‘SET’ STEP(F, d, a, b, c, SET(1), 7) ^ md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’ (ctx->Block[(n)] = \ ^ md4.c:44:29: note: in definition of macro ‘STEP’ (a) += f((b), (c), (d)) + (x); \ ^ md4.c:97:23: note: in expansion of macro ‘SET’ STEP(F, c, d, a, b, SET(2), 11) ....... ``` This was after doing a 'make distclean' to make sure there were no straggler stuff from a ./configure run
Author
Owner

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

@jfoug I did test after make distclean as well.
No idea why you get errors for md4.c.
I retried d6daf0b and get the same result, even if I try make generic.
Do you have any local changes?

<!-- gh-comment-id:120047352 --> @frank-dittrich commented on GitHub (Jul 9, 2015): @jfoug I did test after `make distclean` as well. No idea why you get errors for md4.c. I retried d6daf0b and get the same result, even if I try make generic. Do you have any local changes?
Author
Owner

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

I forgot to mention: after the

Makefile.legacy:2360: recipe for target 'dynamic_compiler.o' failed
make[1]: *** [dynamic_compiler.o] Error 1
Makefile.legacy:443: recipe for target 'linux-x86-64-native' failed
make: *** [linux-x86-64-native] Error 2

I do have md4.o and md5.o.
This is an AVX system, will retry on an AVX2 system later.

<!-- gh-comment-id:120049998 --> @frank-dittrich commented on GitHub (Jul 9, 2015): I forgot to mention: after the ``` Makefile.legacy:2360: recipe for target 'dynamic_compiler.o' failed make[1]: *** [dynamic_compiler.o] Error 1 Makefile.legacy:443: recipe for target 'linux-x86-64-native' failed make: *** [linux-x86-64-native] Error 2 ``` I do have md4.o and md5.o. This is an AVX system, will retry on an AVX2 system later.
Author
Owner

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

Funny: make -s -f Makefile.legacy linux-x86-64-clang succeeds.
I just get a few warnings.

<!-- gh-comment-id:120050274 --> @frank-dittrich commented on GitHub (Jul 9, 2015): Funny: `make -s -f Makefile.legacy linux-x86-64-clang` succeeds. I just get a few warnings.
Author
Owner

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

On a 64bit AVX2 system (older gcc version etc.), make -s -f Makefile.legacy linux-x86-64-native succeeds, a make -s -f Makefile.legacy linux-x86-64 fails when linking the john binary (undefined reference to fmt_stribog_256 / fmt_stribog_512).

<!-- gh-comment-id:120072622 --> @frank-dittrich commented on GitHub (Jul 9, 2015): On a 64bit AVX2 system (older gcc version etc.), `make -s -f Makefile.legacy linux-x86-64-native` succeeds, a `make -s -f Makefile.legacy linux-x86-64` fails when linking the john binary (undefined reference to fmt_stribog_256 / fmt_stribog_512).
Author
Owner

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

Seems to depend on gcc version.
On super, make -s -f Makefile.legacy linux-x86-64-native succeeds for the default build environment as well as after each of these:

scl enable devtoolset-1.1 bash
scl enable devtoolset-2 bash
scl enable devtoolset-3 bash

On my AVX2 system and on my AVX laptop, both Fedora 22 with gcc 5.1.1, I get the same build errors.

dynamic_compiler.c:518:32: error: '#' is not followed by a macro parameter
 #define LOOKUP_IF_BLK(T,U,S,F,L) \

etc., while make -s -f Makefile.legacy linux-x86-64-clang succeeds.

So, may be I'm seeing gcc bugs?

@jfoug what gcc version and what OS were you using for the make -f Makefile.legacy test?

<!-- gh-comment-id:120088088 --> @frank-dittrich commented on GitHub (Jul 9, 2015): Seems to depend on gcc version. On super, `make -s -f Makefile.legacy linux-x86-64-native` succeeds for the default build environment as well as after each of these: ``` scl enable devtoolset-1.1 bash scl enable devtoolset-2 bash scl enable devtoolset-3 bash ``` On my AVX2 system and on my AVX laptop, both Fedora 22 with gcc 5.1.1, I get the same build errors. ``` dynamic_compiler.c:518:32: error: '#' is not followed by a macro parameter #define LOOKUP_IF_BLK(T,U,S,F,L) \ ``` etc., while `make -s -f Makefile.legacy linux-x86-64-clang` succeeds. So, may be I'm seeing gcc bugs? @jfoug what gcc version and what OS were you using for the `make -f Makefile.legacy` test?
Author
Owner

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

On well and bull, make -f Makefile.legacy linux-x86-64-native succeeds as well.

<!-- gh-comment-id:120090834 --> @frank-dittrich commented on GitHub (Jul 9, 2015): On well and bull, `make -f Makefile.legacy linux-x86-64-native` succeeds as well.
Author
Owner

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

No idea why you get errors for md4.c.

It's a known problem: We access members of private structs in crypto libs, depending on them not to be renamed, or be named differently by some other version/vendor.

It's more or less impossible get it safe - unless we just stop ever using OpenSSL for code we do have in our tree. Why don't we?

<!-- gh-comment-id:120093325 --> @magnumripper commented on GitHub (Jul 9, 2015): > No idea why you get errors for md4.c. It's a known problem: We access members of private structs in crypto libs, depending on them not to be renamed, or be named differently by some other version/vendor. It's more or less impossible get it safe - unless we just stop ever using OpenSSL for code we do have in our tree. Why don't we?
Author
Owner

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

@magnumripper and how does autoconf manage to avoid these problems?

<!-- gh-comment-id:120093753 --> @frank-dittrich commented on GitHub (Jul 9, 2015): @magnumripper and how does autoconf manage to avoid these problems?
Author
Owner

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

I do have md4.o and md5.o.

Everybody gets them, but how big are they? Even when defined out, you may get a file of several hundred bytes, depending on OS and circumstances.

<!-- gh-comment-id:120094037 --> @magnumripper commented on GitHub (Jul 9, 2015): > I do have md4.o and md5.o. Everybody gets them, but how big are they? Even when defined out, you may get a file of several hundred bytes, depending on OS and circumstances.
Author
Owner

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

how does autoconf manage to avoid these problems?

It's more of "happen to" than "manage to". It's likely about -I paths used, or order of them.

<!-- gh-comment-id:120094255 --> @magnumripper commented on GitHub (Jul 9, 2015): > how does autoconf manage to avoid these problems? It's more of "happen to" than "manage to". It's likely about `-I` paths used, or order of them.
Author
Owner

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

Yes! This will fix the probem I get on my systems:

$ git diff
diff --git a/src/dynamic_compiler.c b/src/dynamic_compiler.c
index e0124a5..3b896d9 100644
--- a/src/dynamic_compiler.c
+++ b/src/dynamic_compiler.c
@@ -517,11 +517,11 @@ static const char *comp_push_sym(const char *p, fpSYM fpsym, const char *pRet) {

 #define LOOKUP_IF_BLK(T,U,S,F,L) \
        if (!strncasecmp(pInput, #T, L)) { \
-               if (!strncmp(pInput, #T"_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \
-               if (!strncmp(pInput, #T"_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \
-               if (!strncmp(pInput, #T"_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \
-               if (!strncmp(pInput, #T"(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \
-               if (!strncmp(pInput, #U"(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } }
+               if (!strncmp(pInput, #T "_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f" #S "r", dynamic_f##F##r, pInput+(L+4)); } \
+               if (!strncmp(pInput, #T "_64c(", L+5)) { return comp_push_sym("f" #S "c", dynamic_f##F##c, pInput+(L+4)); } \
+               if (!strncmp(pInput, #T "_64(", L+4)) { return comp_push_sym("f" #S "6", dynamic_f##F##6, pInput+(L+3)); } \
+               if (!strncmp(pInput, #T "(", L+1)) { return comp_push_sym("f" #S "h", dynamic_f##F##h, pInput+L); } \
+               if (!strncmp(pInput, #U "(", L+1)) { return comp_push_sym("f" #S "H", dynamic_f##F##H, pInput+L); } }

I wonder why gcc only complains about the old version in legacy builds, not in autoconf builds.

<!-- gh-comment-id:120096793 --> @frank-dittrich commented on GitHub (Jul 9, 2015): Yes! This will fix the probem I get on my systems: ``` $ git diff diff --git a/src/dynamic_compiler.c b/src/dynamic_compiler.c index e0124a5..3b896d9 100644 --- a/src/dynamic_compiler.c +++ b/src/dynamic_compiler.c @@ -517,11 +517,11 @@ static const char *comp_push_sym(const char *p, fpSYM fpsym, const char *pRet) { #define LOOKUP_IF_BLK(T,U,S,F,L) \ if (!strncasecmp(pInput, #T, L)) { \ - if (!strncmp(pInput, #T"_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \ - if (!strncmp(pInput, #T"_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \ - if (!strncmp(pInput, #T"_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \ - if (!strncmp(pInput, #T"(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \ - if (!strncmp(pInput, #U"(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } } + if (!strncmp(pInput, #T "_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f" #S "r", dynamic_f##F##r, pInput+(L+4)); } \ + if (!strncmp(pInput, #T "_64c(", L+5)) { return comp_push_sym("f" #S "c", dynamic_f##F##c, pInput+(L+4)); } \ + if (!strncmp(pInput, #T "_64(", L+4)) { return comp_push_sym("f" #S "6", dynamic_f##F##6, pInput+(L+3)); } \ + if (!strncmp(pInput, #T "(", L+1)) { return comp_push_sym("f" #S "h", dynamic_f##F##h, pInput+L); } \ + if (!strncmp(pInput, #U "(", L+1)) { return comp_push_sym("f" #S "H", dynamic_f##F##H, pInput+L); } } ``` I wonder why gcc only complains about the old version in legacy builds, not in autoconf builds.
Author
Owner

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

I'll re-test legacy without the above patch, but with -std=gnu89 added to CFLAGS.

<!-- gh-comment-id:120098176 --> @frank-dittrich commented on GitHub (Jul 9, 2015): I'll re-test legacy without the above patch, but with -std=gnu89 added to CFLAGS.
Author
Owner

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

Yes, adding -std=gnu89 to the Makefile.legacy CFLAGS fixes my build errors as well.

But if the dynamic_compiler.c change posted above fixes my build error even without adding -std=gnu89 option to CFLAGS, may be we should commit that as well?

@jfoug does adding -std=gnu89 to the CFLAGS fix your legacy build problems?

<!-- gh-comment-id:120101628 --> @frank-dittrich commented on GitHub (Jul 9, 2015): Yes, adding `-std=gnu89` to the Makefile.legacy CFLAGS fixes my build errors as well. But if the `dynamic_compiler.c` change posted above fixes my build error even without adding `-std=gnu89` option to CFLAGS, may be we should commit that as well? @jfoug does adding `-std=gnu89` to the CFLAGS fix your legacy build problems?
Author
Owner

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

-std=gnu89 makes no difference. Like magnum stated, it has something to do with paths and such. Since I really do not care about makefile.legacy, I am not spending any time on this.

I have found the gcc CPP to be problematic. if there are ways I can make these macros a bit nicer to more compilers, I will. NOTE, I have yet to build on my sparc. I expect to have some changes there also. Surprisingly, VC's macro processor seems more robust than gcc. It was able to handle things like re-interpretation of values which the macro concatenated items. But unfortunately, there does seem to be some nuanced differences between compilers when it comes to the pre-processor, when you get to some of the more obscure usages like pasting strings or concatenation stuff.

builds on

<!-- gh-comment-id:120119708 --> @jfoug commented on GitHub (Jul 9, 2015): -std=gnu89 makes no difference. Like magnum stated, it has something to do with paths and such. Since I really do not care about makefile.legacy, I am not spending any time on this. I have found the gcc CPP to be problematic. if there are ways I can make these macros a bit nicer to more compilers, I will. NOTE, I have yet to build on my sparc. I expect to have some changes there also. Surprisingly, VC's macro processor seems more robust than gcc. It was able to handle things like re-interpretation of values which the macro concatenated items. But unfortunately, there does seem to be some nuanced differences between compilers when it comes to the pre-processor, when you get to some of the more obscure usages like pasting strings or concatenation stuff. builds on
Author
Owner

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

We have other code that needs -std=gnu89 but I think you should commit those changes to dynamic_compiler.c as well. Do I see right and there's just whitespace changes? Likely other preprocessors will need that as well.

<!-- gh-comment-id:120120739 --> @magnumripper commented on GitHub (Jul 9, 2015): We have other code that needs -std=gnu89 but I think you should commit those changes to dynamic_compiler.c as well. Do I see right and there's just whitespace changes? Likely other preprocessors will need that as well.
Author
Owner

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

Yes, this is just a whitespace change. And, being paranoid, I'll compare sha1sum of the object file before and after that change.

<!-- gh-comment-id:120121079 --> @frank-dittrich commented on GitHub (Jul 9, 2015): Yes, this is just a whitespace change. And, being paranoid, I'll compare sha1sum of the object file before and after that change.
Author
Owner

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

This did not need 'fixed' also ??? does not make sense

#define IF(C,T,L,F) if (!strncasecmp(pCode[i], #T, L)) { \
    comp_add_script_line("Func=DynamicFunc__"#C"_crypt_input%s_to_output1_FINAL\n", use_inp1?"1":"2"); \
    if(F) comp_add_script_line("Flag=MGF_INPUT_"#F"_BYTE\n"); }
#define ELSEIF(C,T,L,F) else if (!strncasecmp(pCode[i], #T, L)) { \
    comp_add_script_line("Func=DynamicFunc__"#C"_crypt_input%s_to_output1_FINAL\n", use_inp1?"1":"2"); \
    if(F) comp_add_script_line("Flag=MGF_INPUT_"#F"_BYTE\n"); }

I would expect these to fail in same way

<!-- gh-comment-id:120121895 --> @jfoug commented on GitHub (Jul 9, 2015): This did not need 'fixed' also ??? does not make sense ``` #define IF(C,T,L,F) if (!strncasecmp(pCode[i], #T, L)) { \ comp_add_script_line("Func=DynamicFunc__"#C"_crypt_input%s_to_output1_FINAL\n", use_inp1?"1":"2"); \ if(F) comp_add_script_line("Flag=MGF_INPUT_"#F"_BYTE\n"); } #define ELSEIF(C,T,L,F) else if (!strncasecmp(pCode[i], #T, L)) { \ comp_add_script_line("Func=DynamicFunc__"#C"_crypt_input%s_to_output1_FINAL\n", use_inp1?"1":"2"); \ if(F) comp_add_script_line("Flag=MGF_INPUT_"#F"_BYTE\n"); } ``` I would expect these to fail in same way
Author
Owner

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

Likely this was the ones the preprocessor could not properly handle

(pInput, #T"_raw(", L+5)) 

turn into 

(pInput, #T "_raw(", L+5)) 
<!-- gh-comment-id:120123679 --> @jfoug commented on GitHub (Jul 9, 2015): Likely this was the ones the preprocessor could not properly handle ``` (pInput, #T"_raw(", L+5)) turn into (pInput, #T "_raw(", L+5)) ```
Author
Owner

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

@jfoug even if it doesn't make sense, nevertheless it did help.
May be not all of the whitespace changes were needed.
I can try to reduce my change to the bare minimum that makes it work even without -std=gnu89.

<!-- gh-comment-id:120123858 --> @frank-dittrich commented on GitHub (Jul 9, 2015): @jfoug even if it doesn't make sense, nevertheless it did help. May be not all of the whitespace changes were needed. I can try to reduce my change to the bare minimum that makes it work even without -std=gnu89.
Author
Owner

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

Try changing just this (note the lines are 'trimmed'

-               if (!strncmp(pInput, #T"_raw(", L+5))   ... rest of line trimmed
+               if (!strncmp(pInput, #T "_raw(", L+5)) ... rest of line trimmed

It may be the C compiler that can not handle it.

What is output is this: (Let's say T is MD5)

"MD5""_raw("

where your change is: "MD5" "_raw("

I would think the compiler should handle that just fine, but I could be wrong.

<!-- gh-comment-id:120124187 --> @jfoug commented on GitHub (Jul 9, 2015): Try changing just this (note the lines are 'trimmed' ``` - if (!strncmp(pInput, #T"_raw(", L+5)) ... rest of line trimmed + if (!strncmp(pInput, #T "_raw(", L+5)) ... rest of line trimmed ``` It may be the C compiler that can not handle it. What is output is this: (Let's say T is MD5) "MD5""_raw(" where your change is: "MD5" "_raw(" I would think the compiler should handle that just fine, but I could be wrong.
Author
Owner

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

I will just space pad all string pasting usage in my code.

<!-- gh-comment-id:120125465 --> @jfoug commented on GitHub (Jul 9, 2015): I will just space pad all string pasting usage in my code.
Author
Owner

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

@jfoug this is the minimal change that makes legacy build succeed without -std=gnu89:

diff --git a/src/dynamic_compiler.c b/src/dynamic_compiler.c
index e0124a5..b70e319 100644
--- a/src/dynamic_compiler.c
+++ b/src/dynamic_compiler.c
@@ -517,11 +517,11 @@ static const char *comp_push_sym(const char *p, fpSYM fpsym, const char *pRet) {

 #define LOOKUP_IF_BLK(T,U,S,F,L) \
    if (!strncasecmp(pInput, #T, L)) { \
-       if (!strncmp(pInput, #T"_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \
-       if (!strncmp(pInput, #T"_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \
-       if (!strncmp(pInput, #T"_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \
-       if (!strncmp(pInput, #T"(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \
-       if (!strncmp(pInput, #U"(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } }
+       if (!strncmp(pInput, #T "_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \
+       if (!strncmp(pInput, #T "_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \
+       if (!strncmp(pInput, #T "_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \
+       if (!strncmp(pInput, #T "(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \
+       if (!strncmp(pInput, #U "(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } }

 static const char *comp_get_symbol(const char *pInput) {
    // This function will grab the next valid symbol, and returns
<!-- gh-comment-id:120127115 --> @frank-dittrich commented on GitHub (Jul 9, 2015): @jfoug this is the minimal change that makes legacy build succeed without -std=gnu89: ``` diff --git a/src/dynamic_compiler.c b/src/dynamic_compiler.c index e0124a5..b70e319 100644 --- a/src/dynamic_compiler.c +++ b/src/dynamic_compiler.c @@ -517,11 +517,11 @@ static const char *comp_push_sym(const char *p, fpSYM fpsym, const char *pRet) { #define LOOKUP_IF_BLK(T,U,S,F,L) \ if (!strncasecmp(pInput, #T, L)) { \ - if (!strncmp(pInput, #T"_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \ - if (!strncmp(pInput, #T"_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \ - if (!strncmp(pInput, #T"_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \ - if (!strncmp(pInput, #T"(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \ - if (!strncmp(pInput, #U"(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } } + if (!strncmp(pInput, #T "_raw(", L+5)) { LastTokIsFunc = 2; return comp_push_sym("f"#S"r", dynamic_f##F##r, pInput+(L+4)); } \ + if (!strncmp(pInput, #T "_64c(", L+5)) { return comp_push_sym("f"#S"c", dynamic_f##F##c, pInput+(L+4)); } \ + if (!strncmp(pInput, #T "_64(", L+4)) { return comp_push_sym("f"#S"6", dynamic_f##F##6, pInput+(L+3)); } \ + if (!strncmp(pInput, #T "(", L+1)) { return comp_push_sym("f"#S"h", dynamic_f##F##h, pInput+L); } \ + if (!strncmp(pInput, #U "(", L+1)) { return comp_push_sym("f"#S"H", dynamic_f##F##H, pInput+L); } } static const char *comp_get_symbol(const char *pInput) { // This function will grab the next valid symbol, and returns ```
Author
Owner

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

Ok, some shortcoming of the CPP. I will put spacing everywhere I use string pasting, just to be safe.

<!-- gh-comment-id:120127513 --> @jfoug commented on GitHub (Jul 9, 2015): Ok, some shortcoming of the CPP. I will put spacing everywhere I use string pasting, just to be safe.
Author
Owner

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

Is this issue 'fixed' ? I still can not compile on my base install Fedora VM with legacy (64 bit -native target), but I am almost certain it is due to include/lib paths not getting setup properly for oSSL. It is not an issue whatsoever on that system (or any others I can get my hands on) with a autoconf build, so for me, I really do not care.

But this bug still stands open.

<!-- gh-comment-id:120194173 --> @jfoug commented on GitHub (Jul 10, 2015): Is this issue 'fixed' ? I still can not compile on my base install Fedora VM with legacy (64 bit -native target), but I am almost certain it is due to include/lib paths not getting setup properly for oSSL. It is not an issue whatsoever on that system (or any others I can get my hands on) with a autoconf build, so for me, I really do not care. But this bug still stands open.
Author
Owner

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

@jfoug For me it is fixed now.
That's why I don't even want to add --std=gnu89 to legacy CFLAGS, so that we can detect some more problems with different compilers.

Please leave it open, I want to find out whether I can reproduce and finally avoid the bug you got.
I never wanted you to spend much time on it, since I know you don't care much about legacy.
That's why I self-assigned this issue.
What Fedora version do you have in your VM?

<!-- gh-comment-id:120270781 --> @frank-dittrich commented on GitHub (Jul 10, 2015): @jfoug For me it is fixed now. That's why I don't even want to add --std=gnu89 to legacy CFLAGS, so that we can detect some more problems with different compilers. Please leave it open, I want to find out whether I can reproduce and finally avoid the bug you got. I never wanted you to spend much time on it, since I know you don't care much about legacy. That's why I self-assigned this issue. What Fedora version do you have in your VM?
Author
Owner

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

[ghost@localhost src]$ uname -a
Linux localhost.localdomain 4.0.4-303.fc22.x86_64 #1 SMP Thu May 28 12:37:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[ghost@localhost src]$ gcc --version
gcc (GCC) 5.1.1 20150422 (Red Hat 5.1.1-1)

Running in VirtualBox VM

<!-- gh-comment-id:120438743 --> @jfoug commented on GitHub (Jul 10, 2015): [ghost@localhost src]$ uname -a Linux localhost.localdomain 4.0.4-303.fc22.x86_64 #1 SMP Thu May 28 12:37:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [ghost@localhost src]$ gcc --version gcc (GCC) 5.1.1 20150422 (Red Hat 5.1.1-1) Running in VirtualBox VM
Author
Owner

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

@magnumripper @jfoug I am sure the

md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’

error was caused by not including <openssl/md4.h> for legacy builds.

So, commit 6313df9bd4 should fix that.
It adds -DHAVE_LIBSSL to Makefile.legacy CFLAGS.

<!-- gh-comment-id:120614557 --> @frank-dittrich commented on GitHub (Jul 11, 2015): @magnumripper @jfoug I am sure the ``` md4.c:62:6: error: ‘MD4_CTX {aka struct <anonymous>}’ has no member named ‘Block’ ``` error was caused by not including `<openssl/md4.h>` for legacy builds. So, commit 6313df9bd40b25749b5ab7a0d8744c873943752d should fix that. It adds -DHAVE_LIBSSL to Makefile.legacy CFLAGS.
Author
Owner

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

But it does show us a bug. You just hid it.

md4.h

typedef struct {
        MD4_u32plus A, B, C, D;
        MD4_u32plus lo, hi;
        unsigned char buffer[64];
        MD4_u32plus block[16];
} MD4_CTX;

md4.c

#define SET(n) \
        (ctx->Block[(n)] = \
        (MD4_u32plus)ptr[(n) * 4] | \
        ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \
        ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \
        ((MD4_u32plus)ptr[(n) * 4 + 3] << 24))
#define GET(n) \
        (ctx->Block[(n)])

@jfoug introduced this bug in abe2cdb5

<!-- gh-comment-id:120675242 --> @magnumripper commented on GitHub (Jul 12, 2015): But it does show us a bug. You just hid it. md4.h ``` typedef struct { MD4_u32plus A, B, C, D; MD4_u32plus lo, hi; unsigned char buffer[64]; MD4_u32plus block[16]; } MD4_CTX; ``` md4.c ``` #define SET(n) \ (ctx->Block[(n)] = \ (MD4_u32plus)ptr[(n) * 4] | \ ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \ ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \ ((MD4_u32plus)ptr[(n) * 4 + 3] << 24)) #define GET(n) \ (ctx->Block[(n)]) ``` @jfoug introduced this bug in abe2cdb5
Author
Owner

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

So md4.h should be fixed, s/block/Block/. But I really really need to get some sleep now.

<!-- gh-comment-id:120675283 --> @magnumripper commented on GitHub (Jul 12, 2015): So md4.h should be fixed, `s/block/Block/`. But I really really need to get some sleep now.
Author
Owner

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

No, I am going to undo the block->Block in the .c file. The parts that are 'important' are the ABCD. I am not sure why the other was changed.

<!-- gh-comment-id:120682069 --> @jfoug commented on GitHub (Jul 12, 2015): No, I am going to undo the block->Block in the .c file. The parts that are 'important' are the ABCD. I am not sure why the other was changed.
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#996
No description provided.