openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.06k stars 2.08k forks source link

OpenCL formats failing (or emitting new warnings) on recent nvidia driver versions. #5542

Open magnumripper opened 3 hours ago

magnumripper commented 3 hours ago

So I tested all OpenCL formats on nvidia 560.35.03 / OpenCL 3.0 CUDA 12.6.65. Nearly every kernel emitted the bogus "Warning: Function [...] is a kernel, so overriding noinline attribute" as seen in #5456.

Oddly enough, these did not:

Testing: electrum-modern-opencl, Electrum Wallet 2.8+ [PBKDF2-SHA512 OpenCL]... (8xOMP) PASS
Testing: krb5asrep-aes-opencl, Kerberos 5 AS-REP etype 17/18 [PBKDF2-SHA1 OpenCL]... PASS
Testing: krb5tgs-sha1-opencl, Kerberos 5 TGS-REP etype 17/18 [PBKDF2-SHA1 AES-CTS OpenCL]... PASS
Testing: lpcli-opencl, LastPass CLI [PBKDF2-SHA256 AES OpenCL]... PASS
Testing: PBKDF2-HMAC-SHA512-opencl, GRUB2 / OS X 10.8+ [PBKDF2-SHA512 OpenCL]... PASS

Two of my newest formats emitted other warnings that may or may not be valid, I did not see them before so will investigate.

I guess (though didn't look yet) the first one is more or less valid and can be easily fixed:

Testing: streebog256crypt-opencl, Astra Linux $gost12256hash$ (rounds=5000) [GOST R 34.11-2012 OpenCL]... 6 warnings generated.
<kernel>:99:30: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
        GOST34112012Final(&alt_ctx, &result, loc_buf);
                                    ^~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^
<kernel>:119:26: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
        GOST34112012Final(&ctx, &result, loc_buf);
                                ^~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^
<kernel>:129:30: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
        GOST34112012Final(&alt_ctx, &temp_result, loc_buf);
                                    ^~~~~~~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^
<kernel>:152:30: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
        GOST34112012Final(&alt_ctx, &temp_result, loc_buf);
                                    ^~~~~~~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^
<kernel>:230:27: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
                GOST34112012Final(&ctx, &result, loc_buf);
                                        ^~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^
<kernel>:298:27: warning: incompatible pointer types passing 'uint256_u *' to parameter of type 'uint512_u *'
                GOST34112012Final(&ctx, &result, loc_buf);
                                        ^~~~~~~
opencl/opencl_streebog.h:951:56: note: passing argument to parameter 'digest' here
GOST34112012Final(GOST34112012Context *CTX, uint512_u *digest, __local localbuf *loc_buf)
                                                       ^

The second one looks like a bogus problem very similar to #5456:

Testing: gost94crypt-opencl, Astra Linux $gost94hash$ (rounds=5000) [GOST R 34.11-94 OpenCL]... 5 warnings generated.
In file included from <kernel>:13:
opencl/opencl_gost94.h:311:3: warning: static function 'rhash_gost94_compute_sum_and_hash' is used in an inline function with external linkage
                rhash_gost94_compute_sum_and_hash(ctx, (uint*)ctx->message, sbox);
                ^
opencl/opencl_gost94.h:298:1: note: use 'static' to give inline function 'gost94_update' internal linkage
inline void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
^
static
opencl/opencl_gost94.h:264:13: note: 'rhash_gost94_compute_sum_and_hash' declared here
static void rhash_gost94_compute_sum_and_hash(gost94_ctx * ctx, const uint* block, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
            ^
opencl/opencl_gost94.h:326:3: warning: static function 'rhash_gost94_compute_sum_and_hash' is used in an inline function with external linkage
                rhash_gost94_compute_sum_and_hash(ctx, aligned_message_block, sbox);
                ^
opencl/opencl_gost94.h:298:1: note: use 'static' to give inline function 'gost94_update' internal linkage
inline void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
^
static
opencl/opencl_gost94.h:264:13: note: 'rhash_gost94_compute_sum_and_hash' declared here
static void rhash_gost94_compute_sum_and_hash(gost94_ctx * ctx, const uint* block, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
            ^
opencl/opencl_gost94.h:367:3: warning: static function 'rhash_gost94_compute_sum_and_hash' is used in an inline function with external linkage
                rhash_gost94_compute_sum_and_hash(ctx, msg32, sbox);
                ^
opencl/opencl_gost94.h:359:1: note: use 'static' to give inline function 'gost94_final' internal linkage
inline void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
^
static
opencl/opencl_gost94.h:264:13: note: 'rhash_gost94_compute_sum_and_hash' declared here
static void rhash_gost94_compute_sum_and_hash(gost94_ctx * ctx, const uint* block, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
            ^
opencl/opencl_gost94.h:375:2: warning: static function 'rhash_gost94_block_compress' is used in an inline function with external linkage
        rhash_gost94_block_compress(ctx, msg32, sbox);
        ^
opencl/opencl_gost94.h:359:1: note: use 'static' to give inline function 'gost94_final' internal linkage
inline void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
^
static
opencl/opencl_gost94.h:122:13: note: 'rhash_gost94_block_compress' declared here
static void rhash_gost94_block_compress(gost94_ctx *ctx, const uint* block, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
            ^
opencl/opencl_gost94.h:376:2: warning: static function 'rhash_gost94_block_compress' is used in an inline function with external linkage
        rhash_gost94_block_compress(ctx, ctx->sum, sbox);
        ^
opencl/opencl_gost94.h:359:1: note: use 'static' to give inline function 'gost94_final' internal linkage
inline void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
^
static
opencl/opencl_gost94.h:122:13: note: 'rhash_gost94_block_compress' declared here
static void rhash_gost94_block_compress(gost94_ctx *ctx, const uint* block, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
            ^

Only two formats failed, that is a relief:

Testing: cryptosafe-opencl [AES-256-CBC OpenCL]... FAILED (crypt_all(1) zero return)
Testing: krb5pa-md5-opencl, Kerberos 5 AS-REQ Pre-Auth etype 23 [MD4 HMAC-MD5 RC4 OpenCL]... FAILED (crypt_all(1) zero return)

I already found out a silly workaround for cryptosafe (will commit soon but unsure how to #ifdef it). I'll look into the Kerberos format too.

solardiz commented 2 hours ago

Testing: krb5pa-md5-opencl, Kerberos 5 AS-REQ Pre-Auth etype 23 [MD4 HMAC-MD5 RC4 OpenCL]... FAILED (crypt_all(1) zero return)

This or at least same-looking failure was also seen on AMD GPUs recently in https://github.com/openwall/john/issues/5522#issuecomment-2287375852 and https://github.com/openwall/john/issues/3572#issuecomment-2018612676