[GH-ISSUE #1497] oldoffice-opencl fails self test on super (Catalyst 15.5 & 15.7) #968

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

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

Originally assigned to: @magnumripper on GitHub.

$ ./john --test=0 --format=oldoffice-opencl
./john: /usr/local/cuda/lib64/libOpenCL.so.1: no version information available (required by ./john)
./john: /usr/local/cuda/lib64/libOpenCL.so.1: no version information available (required by ./john)
Device 0: Tahiti [AMD Radeon HD 7900 Series]
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1))

Originally created by @frank-dittrich on GitHub (Jul 6, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1497 Originally assigned to: @magnumripper on GitHub. ``` $ ./john --test=0 --format=oldoffice-opencl ./john: /usr/local/cuda/lib64/libOpenCL.so.1: no version information available (required by ./john) ./john: /usr/local/cuda/lib64/libOpenCL.so.1: no version information available (required by ./john) Device 0: Tahiti [AMD Radeon HD 7900 Series] Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1)) ```
bsakaguchi 2026-10-14 03:30:14 +07:00
Author
Owner

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

BTW, I just tested again on super with scl enable devtoolset-3 bash:

./john --test=0 --format=oldoffice-opencl
Device 0: Tahiti [AMD Radeon HD 7900 Series]
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1))
$ for i in 1 2 3 4 5 ; do ./john --test=0 --format=oldoffice-opencl --device=$i; done
Device 1: Tahiti [AMD Radeon HD 7900 Series]
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1))

Device 2: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... PASS
Device 3: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: Compilation started
Compilation done
Linking started
Linking done
Kernel <oldoffice_utf16> was not vectorized
Kernel <oldoffice_md5> was successfully vectorized
Kernel <oldoffice_sha1> was successfully vectorized
Done.
PASS
Device 4: Intel(R) Many Integrated Core Acceleration Card
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: Compilation started
Compilation done
Linking started
Linking done
Build started
Kernel <oldoffice_utf16> was successfully vectorized
Kernel <oldoffice_md5> was successfully vectorized
Kernel <oldoffice_sha1> was successfully vectorized
Done.
PASS
Device 5: GeForce GTX TITAN
Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: 
ptxas info    : 0 bytes gmem, 360 bytes cmem[3]
ptxas info    : Compiling entry function 'oldoffice_md5' for 'sm_35'
ptxas info    : Function properties for oldoffice_md5
ptxas         .     96 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 71 registers, 16388 bytes smem, 344 bytes cmem[0]
ptxas info    : Compiling entry function 'oldoffice_utf16' for 'sm_35'
ptxas info    : Function properties for oldoffice_utf16
ptxas         .     0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 12 registers, 344 bytes cmem[0]
ptxas info    : Compiling entry function 'oldoffice_sha1' for 'sm_35'
ptxas info    : Function properties for oldoffice_sha1
ptxas         .     96 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 41 registers, 16388 bytes smem, 344 bytes cmem[0]
PASS
<!-- gh-comment-id:120483258 --> @frank-dittrich commented on GitHub (Jul 10, 2015): BTW, I just tested again on super with `scl enable devtoolset-3 bash`: ``` ./john --test=0 --format=oldoffice-opencl Device 0: Tahiti [AMD Radeon HD 7900 Series] Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1)) ``` ``` $ for i in 1 2 3 4 5 ; do ./john --test=0 --format=oldoffice-opencl --device=$i; done Device 1: Tahiti [AMD Radeon HD 7900 Series] Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1)) Device 2: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... PASS Device 3: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: Compilation started Compilation done Linking started Linking done Kernel <oldoffice_utf16> was not vectorized Kernel <oldoffice_md5> was successfully vectorized Kernel <oldoffice_sha1> was successfully vectorized Done. PASS Device 4: Intel(R) Many Integrated Core Acceleration Card Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: Compilation started Compilation done Linking started Linking done Build started Kernel <oldoffice_utf16> was successfully vectorized Kernel <oldoffice_md5> was successfully vectorized Kernel <oldoffice_sha1> was successfully vectorized Done. PASS Device 5: GeForce GTX TITAN Testing: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... Build log: ptxas info : 0 bytes gmem, 360 bytes cmem[3] ptxas info : Compiling entry function 'oldoffice_md5' for 'sm_35' ptxas info : Function properties for oldoffice_md5 ptxas . 96 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 71 registers, 16388 bytes smem, 344 bytes cmem[0] ptxas info : Compiling entry function 'oldoffice_utf16' for 'sm_35' ptxas info : Function properties for oldoffice_utf16 ptxas . 0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 12 registers, 344 bytes cmem[0] ptxas info : Compiling entry function 'oldoffice_sha1' for 'sm_35' ptxas info : Function properties for oldoffice_sha1 ptxas . 96 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 41 registers, 16388 bytes smem, 344 bytes cmem[0] PASS ```
Author
Owner

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

Damn, I was hoping for dfbdc38 to fix this, but it didn't.

<!-- gh-comment-id:125335061 --> @magnumripper commented on GitHub (Jul 27, 2015): Damn, I was hoping for dfbdc38 to fix this, but it didn't.
Author
Owner

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

Clue: This works

$ ../run/john -test -form:oldoffice-opencl -cost=3:3
Device 0: Tahiti [AMD Radeon HD 7900 Series]
Benchmarking: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... DONE
Speed for cost 1 (hash type) of 3
Many salts: 23519K c/s real, 1258M c/s virtual
Only one salt:  18893K c/s real, 99864K c/s virtual

This means Unicode, SHA-1 and RC4 are fine and bug is in MD5. That narrows it down significantly.

<!-- gh-comment-id:125375116 --> @magnumripper commented on GitHub (Jul 27, 2015): Clue: This works ``` $ ../run/john -test -form:oldoffice-opencl -cost=3:3 Device 0: Tahiti [AMD Radeon HD 7900 Series] Benchmarking: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... DONE Speed for cost 1 (hash type) of 3 Many salts: 23519K c/s real, 1258M c/s virtual Only one salt: 18893K c/s real, 99864K c/s virtual ``` This means Unicode, SHA-1 and RC4 are fine and bug is in MD5. That narrows it down significantly.
Author
Owner

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

Duh. Adding this debug print makes the bug GO AWAY.

diff --git a/src/opencl/oldoffice_kernel.cl b/src/opencl/oldoffice_kernel.cl
index ce40cd8..975c3a0 100644
--- a/src/opencl/oldoffice_kernel.cl
+++ b/src/opencl/oldoffice_kernel.cl
@@ -259,6 +259,7 @@ __kernel void oldoffice_md5(__global const mid_t *mid,
        for (i = 0; i < 16; i++)
                PUTCHAR(W, i + 47, GETCHAR(salt, i));
        PUTCHAR(W, 63, GETCHAR(md5, 0));
+       dump_stuff_msg("\nW", W, 64);
        md5_block(W, key);
        for (i = 1; i < 5; i++)
                PUTCHAR(W, i - 1, GETCHAR(md5, i));

I tried putting a barrier() there instead but that didn't do the trick.

<!-- gh-comment-id:125382026 --> @magnumripper commented on GitHub (Jul 28, 2015): Duh. Adding this debug print makes the bug GO AWAY. ``` C diff --git a/src/opencl/oldoffice_kernel.cl b/src/opencl/oldoffice_kernel.cl index ce40cd8..975c3a0 100644 --- a/src/opencl/oldoffice_kernel.cl +++ b/src/opencl/oldoffice_kernel.cl @@ -259,6 +259,7 @@ __kernel void oldoffice_md5(__global const mid_t *mid, for (i = 0; i < 16; i++) PUTCHAR(W, i + 47, GETCHAR(salt, i)); PUTCHAR(W, 63, GETCHAR(md5, 0)); + dump_stuff_msg("\nW", W, 64); md5_block(W, key); for (i = 1; i < 5; i++) PUTCHAR(W, i - 1, GETCHAR(md5, i)); ``` I tried putting a barrier() there instead but that didn't do the trick.
Author
Owner

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

This is an optimizer problem or something. I worked around a very similar bug (obviously also for AMD) for SHA-1 in 09d24a1a but that trick did not work here.

<!-- gh-comment-id:125382463 --> @magnumripper commented on GitHub (Jul 28, 2015): This is an optimizer problem or something. I worked around a very similar bug (obviously also for AMD) for SHA-1 in 09d24a1a but that trick did not work here.
Author
Owner

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

This also didn't help (just checking)

diff --git a/src/opencl_md5.h b/src/opencl_md5.h
index 9d1663e..06f46a9 100644
--- a/src/opencl_md5.h
+++ b/src/opencl_md5.h
@@ -119,7 +119,10 @@
                b = ctx[1]; \
                c = ctx[2]; \
                d = ctx[3]; \
-               MD5(a, b, c, d, W); \
+               MAYBE_VECTOR_UINT w[16]; \
+               uint i; \
+               for (i = 0; i < 16; i++) \
+                       w[i] = W[i]; \
+               MD5(a, b, c, d, w);       \
                ctx[0] += a; \
                ctx[1] += b; \
                ctx[2] += c; \
<!-- gh-comment-id:125384253 --> @magnumripper commented on GitHub (Jul 28, 2015): This also didn't help (just checking) ``` c diff --git a/src/opencl_md5.h b/src/opencl_md5.h index 9d1663e..06f46a9 100644 --- a/src/opencl_md5.h +++ b/src/opencl_md5.h @@ -119,7 +119,10 @@ b = ctx[1]; \ c = ctx[2]; \ d = ctx[3]; \ - MD5(a, b, c, d, W); \ + MAYBE_VECTOR_UINT w[16]; \ + uint i; \ + for (i = 0; i < 16; i++) \ + w[i] = W[i]; \ + MD5(a, b, c, d, w); \ ctx[0] += a; \ ctx[1] += b; \ ctx[2] += c; \ ```
Author
Owner

@magnumripper commented on GitHub (Aug 25, 2015):

Super was upgraded to 15.7 but the problem remains.

<!-- gh-comment-id:134424574 --> @magnumripper commented on GitHub (Aug 25, 2015): Super was upgraded to 15.7 but the problem remains.
Author
Owner

@magnumripper commented on GitHub (Sep 3, 2015):

It now (after the rebuild of super) just started working with no code changed AFAIK. 👀

<!-- gh-comment-id:137277033 --> @magnumripper commented on GitHub (Sep 3, 2015): It now (after the rebuild of super) just started working with no code changed AFAIK. :eyes:
Author
Owner

@magnumripper commented on GitHub (Sep 23, 2015):

Now you see it, now you don't. Perhaps I mistook device 0 (now Juniper) for the Tahitis (now 1 and 2)

Device 1: Tahiti [AMD Radeon HD 7900 Series]
Benchmarking: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1))
<!-- gh-comment-id:142469992 --> @magnumripper commented on GitHub (Sep 23, 2015): Now you see it, now you don't. Perhaps I mistook device 0 (now Juniper) for the Tahitis (now 1 and 2) ``` Device 1: Tahiti [AMD Radeon HD 7900 Series] Benchmarking: oldoffice-opencl, MS Office <= 2003 [MD5/SHA1 RC4 OpenCL]... FAILED (cmp_all(1)) ```
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#968
No description provided.