From a5746548e8f860a41f05637a8ffd4414bd4676db Mon Sep 17 00:00:00 2001 From: jsteube Date: Mon, 13 Aug 2018 13:41:43 +0200 Subject: [PATCH] Allow use of hash-mode 7900, 10700 and 13731 on AMD devices after workaround --- OpenCL/inc_cipher_aes.cl | 22 +++++++++++----------- OpenCL/inc_cipher_serpent.cl | 10 +++++----- OpenCL/inc_cipher_twofish.cl | 6 +++--- OpenCL/inc_truecrypt_xts.cl | 32 ++++++++++++++++---------------- src/opencl.c | 13 ------------- 5 files changed, 35 insertions(+), 48 deletions(-) diff --git a/OpenCL/inc_cipher_aes.cl b/OpenCL/inc_cipher_aes.cl index 86cebf04d..a9d1eb111 100644 --- a/OpenCL/inc_cipher_aes.cl +++ b/OpenCL/inc_cipher_aes.cl @@ -683,7 +683,7 @@ __constant u32a td4[256] = 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d, }; -__constant u32a rcon[] = +__constant u32a rcon[10] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, @@ -699,7 +699,7 @@ DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S ks[2] = ukey[2]; ks[3] = ukey[3]; - for (u32 i = 0, j = 0; i < 10; i += 1, j += 4) + for (volatile int i = 0, j = 0; i < 10; i += 1, j += 4) { u32 temp = ks[j + 3]; @@ -720,7 +720,7 @@ DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { - for (u32 i = 0, j = 40; i < j; i += 4, j -= 4) + for (volatile int i = 0, j = 40; i < j; i += 4, j -= 4) { u32 temp; @@ -730,7 +730,7 @@ DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te temp = ks[i + 3]; ks[i + 3] = ks[j + 3]; ks[j + 3] = temp; } - for (u32 i = 1, j = 4; i < 10; i += 1, j += 4) + for (volatile int i = 1, j = 4; i < 10; i += 1, j += 4) { ks[j + 0] = s_td0[s_te1[(ks[j + 0] >> 24) & 0xff] & 0xff] ^ @@ -799,7 +799,7 @@ DECLSPEC void aes128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (int i = 4; i < 40; i += 4) + for (volatile int i = 4; i < 40; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -862,7 +862,7 @@ DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (int i = 4; i < 40; i += 4) + for (volatile int i = 4; i < 40; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -926,7 +926,7 @@ DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S int i; int j; - for (int i = 0, j = 0; i < 7; i += 1, j += 8) + for (volatile int i = 0, j = 0; i < 7; i += 1, j += 8) { const u32 temp1 = ks[j + 7]; @@ -959,7 +959,7 @@ DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { - for (u32 i = 0, j = 56; i < j; i += 4, j -= 4) + for (volatile int i = 0, j = 56; i < j; i += 4, j -= 4) { u32 temp; @@ -969,7 +969,7 @@ DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te temp = ks[i + 3]; ks[i + 3] = ks[j + 3]; ks[j + 3] = temp; } - for (u32 i = 1, j = 4; i < 14; i += 1, j += 4) + for (volatile int i = 1, j = 4; i < 14; i += 1, j += 4) { ks[j + 0] = s_td0[s_te1[(ks[j + 0] >> 24) & 0xff] & 0xff] ^ @@ -1046,7 +1046,7 @@ DECLSPEC void aes256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (int i = 4; i < 56; i += 4) + for (volatile int i = 4; i < 56; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -1109,7 +1109,7 @@ DECLSPEC void aes256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (int i = 4; i < 56; i += 4) + for (volatile int i = 4; i < 56; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); diff --git a/OpenCL/inc_cipher_serpent.cl b/OpenCL/inc_cipher_serpent.cl index 20a077a38..a32cf65bc 100644 --- a/OpenCL/inc_cipher_serpent.cl +++ b/OpenCL/inc_cipher_serpent.cl @@ -408,7 +408,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (int i = 0; i < 4; i++) + for (volatile int i = 0; i < 4; i++) { ks[i] = ukey[i]; } @@ -416,7 +416,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (int i = 4; i < 8; i++) + for (volatile int i = 4; i < 8; i++) { ks[i] = 0; } @@ -426,7 +426,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (int i = 0; i < 132; i++) + for (volatile int i = 0; i < 132; i++) { ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); } @@ -576,7 +576,7 @@ DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (int i = 0; i < 8; i++) + for (volatile int i = 0; i < 8; i++) { ks[i] = ukey[i]; } @@ -584,7 +584,7 @@ DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (int i = 0; i < 132; i++) + for (volatile int i = 0; i < 132; i++) { ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); } diff --git a/OpenCL/inc_cipher_twofish.cl b/OpenCL/inc_cipher_twofish.cl index 68dcda56f..ad4d1a6ba 100644 --- a/OpenCL/inc_cipher_twofish.cl +++ b/OpenCL/inc_cipher_twofish.cl @@ -270,7 +270,7 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1) { #define G_MOD 0x14d - for (int i = 0; i < 8; i++) + for (volatile int i = 0; i < 8; i++) { u32 t = p1 >> 24; @@ -364,7 +364,7 @@ DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey) sk[1] = mds_rem (me_key[0], mo_key[0]); sk[0] = mds_rem (me_key[1], mo_key[1]); - for (int i = 0; i < 40; i += 2) + for (volatile int i = 0; i < 40; i += 2) { u32 a = 0x01010101 * i; u32 b = 0x01010101 + a; @@ -513,7 +513,7 @@ DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey) sk[1] = mds_rem (me_key[2], mo_key[2]); sk[0] = mds_rem (me_key[3], mo_key[3]); - for (int i = 0; i < 40; i += 2) + for (volatile int i = 0; i < 40; i += 2) { u32 a = 0x01010101 * i; u32 b = 0x01010101 + a; diff --git a/OpenCL/inc_truecrypt_xts.cl b/OpenCL/inc_truecrypt_xts.cl index bc6f319d0..393f71592 100644 --- a/OpenCL/inc_truecrypt_xts.cl +++ b/OpenCL/inc_truecrypt_xts.cl @@ -177,7 +177,7 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); } @@ -186,7 +186,7 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -233,7 +233,7 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); } @@ -242,7 +242,7 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -290,7 +290,7 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_twofish, T_twofish); } @@ -299,7 +299,7 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -353,7 +353,7 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); xts_mul2 (T_twofish, T_twofish); @@ -363,7 +363,7 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -414,7 +414,7 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); xts_mul2 (T_aes, T_aes); @@ -424,7 +424,7 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -477,7 +477,7 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_twofish, T_twofish); xts_mul2 (T_serpent, T_serpent); @@ -487,7 +487,7 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -546,7 +546,7 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); xts_mul2 (T_twofish, T_twofish); @@ -557,7 +557,7 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -615,7 +615,7 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, // seek to byte 256 - for (int i = 4; i < 64 - 16; i += 4) + for (volatile int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); xts_mul2 (T_twofish, T_twofish); @@ -626,7 +626,7 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (int i = 64 - 16; i < 128 - 16; i += 4) + for (volatile int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; diff --git a/src/opencl.c b/src/opencl.c index 53fcc7bc7..0a7189a6c 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -4069,19 +4069,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) #endif // __APPLE__ - if (device_param->platform_vendor_id == VENDOR_ID_AMD) - { - if (device_param->is_rocm == false) - { - if ((user_options->hash_mode == 7900) - || (user_options->hash_mode == 10700) - || (user_options->hash_mode == 13731)) - { - skipped_temp = true; - } - } - } - if ((skipped_temp == true) && (user_options->force == false)) { event_log_warning (hashcat_ctx, "* Device #%u: Skipping unstable hash-mode %u for this device.", device_id + 1, user_options->hash_mode);