mirror of
https://github.com/hashcat/hashcat
synced 2024-12-23 14:13:43 +01:00
Update some unstable_warning on Intel CPU
This commit is contained in:
parent
2f2bc54fec
commit
4115e6b825
@ -8,10 +8,175 @@
|
||||
#include "inc_common.h"
|
||||
#include "inc_cipher_des.h"
|
||||
|
||||
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
DECLSPEC void _des_crypt_encrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
{
|
||||
u32x r = data[0];
|
||||
u32x l = data[1];
|
||||
u32 r = in[0];
|
||||
u32 l = in[1];
|
||||
|
||||
DES_IP_S (r, l);
|
||||
|
||||
r = hc_rotl32_S (r, 3u);
|
||||
l = hc_rotl32_S (l, 3u);
|
||||
|
||||
for (u32 i = 0; i < 16; i += 2)
|
||||
{
|
||||
u32 u;
|
||||
u32 t;
|
||||
|
||||
u = Kc[i + 0] ^ r;
|
||||
t = Kd[i + 0] ^ hc_rotl32_S (r, 28u);
|
||||
|
||||
l ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
|
||||
|
||||
u = Kc[i + 1] ^ l;
|
||||
t = Kd[i + 1] ^ hc_rotl32_S (l, 28u);
|
||||
|
||||
r ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
|
||||
}
|
||||
|
||||
l = hc_rotl32_S (l, 29u);
|
||||
r = hc_rotl32_S (r, 29u);
|
||||
|
||||
DES_FP_S (r, l);
|
||||
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
DECLSPEC void _des_crypt_decrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
{
|
||||
u32 r = in[0];
|
||||
u32 l = in[1];
|
||||
|
||||
DES_IP_S (r, l);
|
||||
|
||||
r = hc_rotl32_S (r, 3u);
|
||||
l = hc_rotl32_S (l, 3u);
|
||||
|
||||
for (u32 i = 16; i > 0; i -= 2)
|
||||
{
|
||||
u32 u;
|
||||
u32 t;
|
||||
|
||||
u = Kc[i - 1] ^ r;
|
||||
t = Kd[i - 1] ^ hc_rotl32_S (r, 28u);
|
||||
|
||||
l ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
|
||||
|
||||
u = Kc[i - 2] ^ l;
|
||||
t = Kd[i - 2] ^ hc_rotl32_S (l, 28u);
|
||||
|
||||
r ^= DES_BOX_S (((u >> 2) & 0x3f), 0, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 10) & 0x3f), 2, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 18) & 0x3f), 4, s_SPtrans)
|
||||
| DES_BOX_S (((u >> 26) & 0x3f), 6, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 2) & 0x3f), 1, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 10) & 0x3f), 3, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 18) & 0x3f), 5, s_SPtrans)
|
||||
| DES_BOX_S (((t >> 26) & 0x3f), 7, s_SPtrans);
|
||||
}
|
||||
|
||||
l = hc_rotl32_S (l, 29u);
|
||||
r = hc_rotl32_S (r, 29u);
|
||||
|
||||
DES_FP_S (r, l);
|
||||
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64])
|
||||
{
|
||||
PERM_OP_S (d, c, 4, 0x0f0f0f0f);
|
||||
HPERM_OP_S (c, 2, 0xcccc0000);
|
||||
HPERM_OP_S (d, 2, 0xcccc0000);
|
||||
PERM_OP_S (d, c, 1, 0x55555555);
|
||||
PERM_OP_S (c, d, 8, 0x00ff00ff);
|
||||
PERM_OP_S (d, c, 1, 0x55555555);
|
||||
|
||||
d = ((d & 0x000000ff) << 16)
|
||||
| ((d & 0x0000ff00) << 0)
|
||||
| ((d & 0x00ff0000) >> 16)
|
||||
| ((c & 0xf0000000) >> 4);
|
||||
|
||||
c = c & 0x0fffffff;
|
||||
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
if ((i < 2) || (i == 8) || (i == 15))
|
||||
{
|
||||
c = ((c >> 1) | (c << 27));
|
||||
d = ((d >> 1) | (d << 27));
|
||||
}
|
||||
else
|
||||
{
|
||||
c = ((c >> 2) | (c << 26));
|
||||
d = ((d >> 2) | (d << 26));
|
||||
}
|
||||
|
||||
c = c & 0x0fffffff;
|
||||
d = d & 0x0fffffff;
|
||||
|
||||
const u32 c00 = (c >> 0) & 0x0000003f;
|
||||
const u32 c06 = (c >> 6) & 0x00383003;
|
||||
const u32 c07 = (c >> 7) & 0x0000003c;
|
||||
const u32 c13 = (c >> 13) & 0x0000060f;
|
||||
const u32 c20 = (c >> 20) & 0x00000001;
|
||||
|
||||
u32 s = DES_BOX_S (((c00 >> 0) & 0xff), 0, s_skb)
|
||||
| DES_BOX_S (((c06 >> 0) & 0xff)
|
||||
|((c07 >> 0) & 0xff), 1, s_skb)
|
||||
| DES_BOX_S (((c13 >> 0) & 0xff)
|
||||
|((c06 >> 8) & 0xff), 2, s_skb)
|
||||
| DES_BOX_S (((c20 >> 0) & 0xff)
|
||||
|((c13 >> 8) & 0xff)
|
||||
|((c06 >> 16) & 0xff), 3, s_skb);
|
||||
|
||||
const u32 d00 = (d >> 0) & 0x00003c3f;
|
||||
const u32 d07 = (d >> 7) & 0x00003f03;
|
||||
const u32 d21 = (d >> 21) & 0x0000000f;
|
||||
const u32 d22 = (d >> 22) & 0x00000030;
|
||||
|
||||
u32 t = DES_BOX_S (((d00 >> 0) & 0xff), 4, s_skb)
|
||||
| DES_BOX_S (((d07 >> 0) & 0xff)
|
||||
|((d00 >> 8) & 0xff), 5, s_skb)
|
||||
| DES_BOX_S (((d07 >> 8) & 0xff), 6, s_skb)
|
||||
| DES_BOX_S (((d21 >> 0) & 0xff)
|
||||
|((d22 >> 0) & 0xff), 7, s_skb);
|
||||
|
||||
Kc[i] = ((t << 16) | (s & 0x0000ffff));
|
||||
Kd[i] = ((s >> 16) | (t & 0xffff0000));
|
||||
|
||||
Kc[i] = hc_rotl32_S (Kc[i], 2u);
|
||||
Kd[i] = hc_rotl32_S (Kd[i], 2u);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void _des_crypt_encrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
{
|
||||
u32x r = in[0];
|
||||
u32x l = in[1];
|
||||
|
||||
DES_IP (r, l);
|
||||
|
||||
@ -53,14 +218,14 @@ DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_
|
||||
|
||||
DES_FP (r, l);
|
||||
|
||||
iv[0] = l;
|
||||
iv[1] = r;
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
DECLSPEC void _des_crypt_decrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
|
||||
{
|
||||
u32x r = data[0];
|
||||
u32x l = data[1];
|
||||
u32x r = in[0];
|
||||
u32x l = in[1];
|
||||
|
||||
DES_IP (r, l);
|
||||
|
||||
@ -102,11 +267,11 @@ DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_
|
||||
|
||||
DES_FP (r, l);
|
||||
|
||||
iv[0] = l;
|
||||
iv[1] = r;
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64])
|
||||
DECLSPEC void _des_crypt_keysetup_vect (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64])
|
||||
{
|
||||
PERM_OP (d, c, 4, 0x0f0f0f0f);
|
||||
HPERM_OP (c, 2, 0xcccc0000);
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define _INC_CIPHER_DES_H
|
||||
|
||||
// these really should be turned into real function
|
||||
|
||||
#define PERM_OP(a,b,n,m) \
|
||||
{ \
|
||||
u32x t; \
|
||||
@ -48,6 +47,48 @@
|
||||
PERM_OP (l, r, 4, 0x0f0f0f0f); \
|
||||
}
|
||||
|
||||
#define PERM_OP_S(a,b,n,m) \
|
||||
{ \
|
||||
u32 t; \
|
||||
t = a >> n; \
|
||||
t = t ^ b; \
|
||||
t = t & m; \
|
||||
b = b ^ t; \
|
||||
t = t << n; \
|
||||
a = a ^ t; \
|
||||
}
|
||||
|
||||
#define HPERM_OP_S(a,n,m) \
|
||||
{ \
|
||||
u32 t; \
|
||||
t = a << (16 + n); \
|
||||
t = t ^ a; \
|
||||
t = t & m; \
|
||||
a = a ^ t; \
|
||||
t = t >> (16 + n); \
|
||||
a = a ^ t; \
|
||||
}
|
||||
|
||||
#define DES_IP_S(l,r) \
|
||||
{ \
|
||||
PERM_OP_S (r, l, 4, 0x0f0f0f0f); \
|
||||
PERM_OP_S (l, r, 16, 0x0000ffff); \
|
||||
PERM_OP_S (r, l, 2, 0x33333333); \
|
||||
PERM_OP_S (l, r, 8, 0x00ff00ff); \
|
||||
PERM_OP_S (r, l, 1, 0x55555555); \
|
||||
}
|
||||
|
||||
#define DES_FP_S(l,r) \
|
||||
{ \
|
||||
PERM_OP_S (l, r, 1, 0x55555555); \
|
||||
PERM_OP_S (r, l, 8, 0x00ff00ff); \
|
||||
PERM_OP_S (l, r, 2, 0x33333333); \
|
||||
PERM_OP_S (r, l, 16, 0x0000ffff); \
|
||||
PERM_OP_S (l, r, 4, 0x0f0f0f0f); \
|
||||
}
|
||||
|
||||
#define DES_BOX_S(i,n,S) (S)[(n)][(i)]
|
||||
|
||||
#if VECT_SIZE == 1
|
||||
#define DES_BOX(i,n,S) (S)[(n)][(i)]
|
||||
#elif VECT_SIZE == 2
|
||||
@ -364,8 +405,12 @@ CONSTANT_AS CONSTSPEC u32a c_skb[8][64] =
|
||||
}
|
||||
};
|
||||
|
||||
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]);
|
||||
DECLSPEC void _des_crypt_encrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_decrypt (u32 *out, const u32 *in, const u32 *Kc, const u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64]);
|
||||
|
||||
DECLSPEC void _des_crypt_encrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_decrypt_vect (u32x *out, const u32x *in, const u32x *Kc, const u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
|
||||
DECLSPEC void _des_crypt_keysetup_vect (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]);
|
||||
|
||||
#endif // _INC_CIPHER_DES_H
|
||||
|
@ -159,14 +159,14 @@ DECLSPEC static void m03100m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_sk
|
||||
data[0] ^= iv[0];
|
||||
data[1] ^= iv[1];
|
||||
|
||||
_des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
|
||||
_des_crypt_encrypt_vect (iv, data, Kc, Kd, s_SPtrans);
|
||||
}
|
||||
|
||||
/**
|
||||
* key2 (generate hash)
|
||||
*/
|
||||
|
||||
_des_crypt_keysetup (iv[0], iv[1], Kc, Kd, s_skb);
|
||||
_des_crypt_keysetup_vect (iv[0], iv[1], Kc, Kd, s_skb);
|
||||
|
||||
iv[0] = 0;
|
||||
iv[1] = 0;
|
||||
@ -181,7 +181,7 @@ DECLSPEC static void m03100m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_sk
|
||||
data[0] ^= iv[0];
|
||||
data[1] ^= iv[1];
|
||||
|
||||
_des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
|
||||
_des_crypt_encrypt_vect (iv, data, Kc, Kd, s_SPtrans);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,14 +352,14 @@ DECLSPEC static void m03100s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_sk
|
||||
data[0] ^= iv[0];
|
||||
data[1] ^= iv[1];
|
||||
|
||||
_des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
|
||||
_des_crypt_encrypt_vect (iv, data, Kc, Kd, s_SPtrans);
|
||||
}
|
||||
|
||||
/**
|
||||
* key2 (generate hash)
|
||||
*/
|
||||
|
||||
_des_crypt_keysetup (iv[0], iv[1], Kc, Kd, s_skb);
|
||||
_des_crypt_keysetup_vect (iv[0], iv[1], Kc, Kd, s_skb);
|
||||
|
||||
iv[0] = 0;
|
||||
iv[1] = 0;
|
||||
@ -374,7 +374,7 @@ DECLSPEC static void m03100s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_sk
|
||||
data[0] ^= iv[0];
|
||||
data[1] ^= iv[1];
|
||||
|
||||
_des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
|
||||
_des_crypt_encrypt_vect (iv, data, Kc, Kd, s_SPtrans);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,17 +67,6 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con
|
||||
return pw_max;
|
||||
}
|
||||
|
||||
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param)
|
||||
{
|
||||
// l_opencl_p_18.1.0.013: self-test failed
|
||||
if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||
{
|
||||
u32 *digest = (u32 *) digest_buf;
|
||||
@ -264,6 +253,6 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = module_tmp_size;
|
||||
module_ctx->module_unstable_warning = module_unstable_warning;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -114,10 +114,10 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
return true;
|
||||
}
|
||||
|
||||
// l_opencl_p_18.1.0.013: Segmentation fault
|
||||
// l_opencl_p_18.1.0.013: password not found
|
||||
if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
|
||||
{
|
||||
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 1)
|
||||
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -97,26 +97,6 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con
|
||||
return pw_max;
|
||||
}
|
||||
|
||||
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param)
|
||||
{
|
||||
if (device_param->platform_vendor_id == VENDOR_ID_APPLE)
|
||||
{
|
||||
// trap 6
|
||||
if ((device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) && (device_param->device_type & CL_DEVICE_TYPE_GPU))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// self-test failed
|
||||
if (device_param->device_type & CL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||
{
|
||||
u32 *digest = (u32 *) digest_buf;
|
||||
@ -458,6 +438,6 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = module_tmp_size;
|
||||
module_ctx->module_unstable_warning = module_unstable_warning;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user