1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Workaround volatile for -m 2500 and -m 2501 for macosx

This commit is contained in:
jsteube 2019-04-18 16:52:14 +02:00
parent 6d21c1633b
commit 5b97fe7514
4 changed files with 526 additions and 1478 deletions

View File

@ -294,16 +294,17 @@ KERNEL_FQ void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -346,248 +347,96 @@ KERNEL_FQ void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
else if (wpa_eapol->detected_be == 1)
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = hc_swap32_S (digest[0]);
t0[1] = hc_swap32_S (digest[1]);
t0[2] = hc_swap32_S (digest[2]);
t0[3] = hc_swap32_S (digest[3]);
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_hmac_ctx_t ctx2;
md5_hmac_init_64 (&ctx2, t0, t1, t2, t3);
md5_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
md5_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_init_64 (&ctx1, out0, out1, z, z);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = hc_swap32_S (digest[0]);
t0[1] = hc_swap32_S (digest[1]);
t0[2] = hc_swap32_S (digest[2]);
t0[3] = hc_swap32_S (digest[3]);
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ctx1.opad.h[0] = hc_swap32_S (ctx1.opad.h[0]);
ctx1.opad.h[1] = hc_swap32_S (ctx1.opad.h[1]);
ctx1.opad.h[2] = hc_swap32_S (ctx1.opad.h[2]);
ctx1.opad.h[3] = hc_swap32_S (ctx1.opad.h[3]);
md5_hmac_ctx_t ctx2;
md5_hmac_init_64 (&ctx2, t0, t1, t2, t3);
md5_hmac_init_64 (&ctx2, ctx1.opad.h, z, z, z);
md5_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
md5_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
if ((ctx2.opad.h[0] == wpa_eapol->keymic[0])
&& (ctx2.opad.h[1] == wpa_eapol->keymic[1])
&& (ctx2.opad.h[2] == wpa_eapol->keymic[2])
&& (ctx2.opad.h[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
@ -595,7 +444,6 @@ KERNEL_FQ void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
}
}
}
}
}
KERNEL_FQ void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
@ -604,16 +452,17 @@ KERNEL_FQ void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -656,248 +505,91 @@ KERNEL_FQ void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
else if (wpa_eapol->detected_be == 1)
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = digest[0];
t0[1] = digest[1];
t0[2] = digest[2];
t0[3] = digest[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_hmac_ctx_t ctx2;
sha1_hmac_init_64 (&ctx2, t0, t1, t2, t3);
sha1_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
sha1_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_init_64 (&ctx1, out0, out1, z, z);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = digest[0];
t0[1] = digest[1];
t0[2] = digest[2];
t0[3] = digest[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_hmac_ctx_t ctx2;
sha1_hmac_init_64 (&ctx2, t0, t1, t2, t3);
sha1_hmac_init_64 (&ctx2, ctx1.opad.h, z, z, z);
sha1_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
sha1_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
if ((ctx2.opad.h[0] == wpa_eapol->keymic[0])
&& (ctx2.opad.h[1] == wpa_eapol->keymic[1])
&& (ctx2.opad.h[2] == wpa_eapol->keymic[2])
&& (ctx2.opad.h[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
@ -905,7 +597,6 @@ KERNEL_FQ void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
}
}
}
}
}
KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
@ -950,16 +641,17 @@ KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -1002,90 +694,85 @@ KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
}
else if (wpa_eapol->detected_be == 1)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha256_hmac_ctx_t ctx1;
sha256_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha256_hmac_init_64 (&ctx1, out0, out1, z, z);
sha256_hmac_update (&ctx1, pke, 102);
sha256_hmac_final (&ctx1);
u32 digest[4];
digest[0] = hc_swap32_S (ctx1.opad.h[0]);
digest[1] = hc_swap32_S (ctx1.opad.h[1]);
digest[2] = hc_swap32_S (ctx1.opad.h[2]);
digest[3] = hc_swap32_S (ctx1.opad.h[3]);
ctx1.opad.h[0] = hc_swap32_S (ctx1.opad.h[0]);
ctx1.opad.h[1] = hc_swap32_S (ctx1.opad.h[1]);
ctx1.opad.h[2] = hc_swap32_S (ctx1.opad.h[2]);
ctx1.opad.h[3] = hc_swap32_S (ctx1.opad.h[3]);
// AES CMAC
u32 ks[44];
aes128_set_encrypt_key (ks, digest, s_te0, s_te1, s_te2, s_te3);
aes128_set_encrypt_key (ks, ctx1.opad.h, s_te0, s_te1, s_te2, s_te3);
u32 m[4];
@ -1145,71 +832,6 @@ KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
m[2] ^= iv[2];
m[3] ^= iv[3];
aes128_encrypt (ks, m, keymic, s_te0, s_te1, s_te2, s_te3, s_te4);
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
@ -1217,85 +839,6 @@ KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
keymic[2] = 0;
keymic[3] = 0;
sha256_hmac_ctx_t ctx1;
sha256_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha256_hmac_update (&ctx1, pke, 102);
sha256_hmac_final (&ctx1);
u32 digest[4];
digest[0] = hc_swap32_S (ctx1.opad.h[0]);
digest[1] = hc_swap32_S (ctx1.opad.h[1]);
digest[2] = hc_swap32_S (ctx1.opad.h[2]);
digest[3] = hc_swap32_S (ctx1.opad.h[3]);
// AES CMAC
u32 ks[44];
aes128_set_encrypt_key (ks, digest, s_te0, s_te1, s_te2, s_te3);
u32 m[4];
m[0] = 0;
m[1] = 0;
m[2] = 0;
m[3] = 0;
u32 iv[4];
iv[0] = 0;
iv[1] = 0;
iv[2] = 0;
iv[3] = 0;
int eapol_left;
int eapol_idx;
for (eapol_left = wpa_eapol->eapol_len, eapol_idx = 0; eapol_left > 16; eapol_left -= 16, eapol_idx += 4)
{
m[0] = wpa_eapol->eapol[eapol_idx + 0] ^ iv[0];
m[1] = wpa_eapol->eapol[eapol_idx + 1] ^ iv[1];
m[2] = wpa_eapol->eapol[eapol_idx + 2] ^ iv[2];
m[3] = wpa_eapol->eapol[eapol_idx + 3] ^ iv[3];
aes128_encrypt (ks, m, iv, s_te0, s_te1, s_te2, s_te3, s_te4);
}
m[0] = wpa_eapol->eapol[eapol_idx + 0];
m[1] = wpa_eapol->eapol[eapol_idx + 1];
m[2] = wpa_eapol->eapol[eapol_idx + 2];
m[3] = wpa_eapol->eapol[eapol_idx + 3];
u32 k[4];
k[0] = 0;
k[1] = 0;
k[2] = 0;
k[3] = 0;
aes128_encrypt (ks, k, k, s_te0, s_te1, s_te2, s_te3, s_te4);
make_kn (k);
if (eapol_left < 16)
{
make_kn (k);
}
m[0] ^= k[0];
m[1] ^= k[1];
m[2] ^= k[2];
m[3] ^= k[3];
m[0] ^= iv[0];
m[1] ^= iv[1];
m[2] ^= iv[2];
m[3] ^= iv[3];
aes128_encrypt (ks, m, keymic, s_te0, s_te1, s_te2, s_te3, s_te4);
/**
@ -1313,5 +856,4 @@ KERNEL_FQ void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)
}
}
}
}
}

View File

@ -164,16 +164,17 @@ KERNEL_FQ void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -216,248 +217,96 @@ KERNEL_FQ void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
else if (wpa_eapol->detected_be == 1)
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = hc_swap32_S (digest[0]);
t0[1] = hc_swap32_S (digest[1]);
t0[2] = hc_swap32_S (digest[2]);
t0[3] = hc_swap32_S (digest[3]);
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_hmac_ctx_t ctx2;
md5_hmac_init_64 (&ctx2, t0, t1, t2, t3);
md5_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
md5_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_init_64 (&ctx1, out0, out1, z, z);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = hc_swap32_S (digest[0]);
t0[1] = hc_swap32_S (digest[1]);
t0[2] = hc_swap32_S (digest[2]);
t0[3] = hc_swap32_S (digest[3]);
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ctx1.opad.h[0] = hc_swap32_S (ctx1.opad.h[0]);
ctx1.opad.h[1] = hc_swap32_S (ctx1.opad.h[1]);
ctx1.opad.h[2] = hc_swap32_S (ctx1.opad.h[2]);
ctx1.opad.h[3] = hc_swap32_S (ctx1.opad.h[3]);
md5_hmac_ctx_t ctx2;
md5_hmac_init_64 (&ctx2, t0, t1, t2, t3);
md5_hmac_init_64 (&ctx2, ctx1.opad.h, z, z, z);
md5_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
md5_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
if ((ctx2.opad.h[0] == wpa_eapol->keymic[0])
&& (ctx2.opad.h[1] == wpa_eapol->keymic[1])
&& (ctx2.opad.h[2] == wpa_eapol->keymic[2])
&& (ctx2.opad.h[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
@ -465,7 +314,6 @@ KERNEL_FQ void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
}
}
}
}
}
KERNEL_FQ void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
@ -474,16 +322,17 @@ KERNEL_FQ void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -526,248 +375,91 @@ KERNEL_FQ void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
else if (wpa_eapol->detected_be == 1)
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = digest[0];
t0[1] = digest[1];
t0[2] = digest[2];
t0[3] = digest[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_hmac_ctx_t ctx2;
sha1_hmac_init_64 (&ctx2, t0, t1, t2, t3);
sha1_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
sha1_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha1_hmac_ctx_t ctx1;
sha1_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha1_hmac_init_64 (&ctx1, out0, out1, z, z);
sha1_hmac_update (&ctx1, pke, 100);
sha1_hmac_final (&ctx1);
u32 digest[4];
digest[0] = ctx1.opad.h[0];
digest[1] = ctx1.opad.h[1];
digest[2] = ctx1.opad.h[2];
digest[3] = ctx1.opad.h[3];
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
t0[0] = digest[0];
t0[1] = digest[1];
t0[2] = digest[2];
t0[3] = digest[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_hmac_ctx_t ctx2;
sha1_hmac_init_64 (&ctx2, t0, t1, t2, t3);
sha1_hmac_init_64 (&ctx2, ctx1.opad.h, z, z, z);
sha1_hmac_update_global (&ctx2, wpa_eapol->eapol, wpa_eapol->eapol_len);
sha1_hmac_final (&ctx2);
keymic[0] = ctx2.opad.h[0];
keymic[1] = ctx2.opad.h[1];
keymic[2] = ctx2.opad.h[2];
keymic[3] = ctx2.opad.h[3];
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
if ((ctx2.opad.h[0] == wpa_eapol->keymic[0])
&& (ctx2.opad.h[1] == wpa_eapol->keymic[1])
&& (ctx2.opad.h[2] == wpa_eapol->keymic[2])
&& (ctx2.opad.h[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
@ -775,7 +467,6 @@ KERNEL_FQ void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
}
}
}
}
}
KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
@ -820,16 +511,17 @@ KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
if (gid >= gid_max) return;
u32 out[8];
u32 out0[4];
u32 out1[4];
out[0] = tmps[gid].out[0];
out[1] = tmps[gid].out[1];
out[2] = tmps[gid].out[2];
out[3] = tmps[gid].out[3];
out[4] = tmps[gid].out[4];
out[5] = tmps[gid].out[5];
out[6] = tmps[gid].out[6];
out[7] = tmps[gid].out[7];
out0[0] = tmps[gid].out[0];
out0[1] = tmps[gid].out[1];
out0[2] = tmps[gid].out[2];
out0[3] = tmps[gid].out[3];
out1[0] = tmps[gid].out[4];
out1[1] = tmps[gid].out[5];
out1[2] = tmps[gid].out[6];
out1[3] = tmps[gid].out[7];
const u32 digest_pos = loop_pos;
@ -872,90 +564,85 @@ KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
pke[30] = wpa_eapol->pke[30];
pke[31] = wpa_eapol->pke[31];
u32 z[4];
z[0] = 0;
z[1] = 0;
z[2] = 0;
z[3] = 0;
u32 to;
u32 m0;
u32 m1;
if (wpa_eapol->nonce_compare < 0)
{
m0 = pke[15] & ~0x000000ff;
m1 = pke[16] & ~0xffffff00;
to = pke[15] << 24
| pke[16] >> 8;
}
else
{
m0 = pke[23] & ~0x000000ff;
m1 = pke[24] & ~0xffffff00;
to = pke[23] << 24
| pke[24] >> 8;
}
const u32 nonce_error_corrections = wpa_eapol->nonce_error_corrections;
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
if (wpa_eapol->detected_le == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
}
else if (wpa_eapol->detected_be == 1)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
}
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
pke[15] = m0 | (t >> 24);
pke[16] = m1 | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
pke[23] = m0 | (t >> 24);
pke[24] = m1 | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
keymic[1] = 0;
keymic[2] = 0;
keymic[3] = 0;
sha256_hmac_ctx_t ctx1;
sha256_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha256_hmac_init_64 (&ctx1, out0, out1, z, z);
sha256_hmac_update (&ctx1, pke, 102);
sha256_hmac_final (&ctx1);
u32 digest[4];
digest[0] = hc_swap32_S (ctx1.opad.h[0]);
digest[1] = hc_swap32_S (ctx1.opad.h[1]);
digest[2] = hc_swap32_S (ctx1.opad.h[2]);
digest[3] = hc_swap32_S (ctx1.opad.h[3]);
ctx1.opad.h[0] = hc_swap32_S (ctx1.opad.h[0]);
ctx1.opad.h[1] = hc_swap32_S (ctx1.opad.h[1]);
ctx1.opad.h[2] = hc_swap32_S (ctx1.opad.h[2]);
ctx1.opad.h[3] = hc_swap32_S (ctx1.opad.h[3]);
// AES CMAC
u32 ks[44];
aes128_set_encrypt_key (ks, digest, s_te0, s_te1, s_te2, s_te3);
aes128_set_encrypt_key (ks, ctx1.opad.h, s_te0, s_te1, s_te2, s_te3);
u32 m[4];
@ -1015,71 +702,6 @@ KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
m[2] ^= iv[2];
m[3] ^= iv[3];
aes128_encrypt (ks, m, keymic, s_te0, s_te1, s_te2, s_te3, s_te4);
/**
* final compare
*/
if ((keymic[0] == wpa_eapol->keymic[0])
&& (keymic[1] == wpa_eapol->keymic[1])
&& (keymic[2] == wpa_eapol->keymic[2])
&& (keymic[3] == wpa_eapol->keymic[3]))
{
if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
}
}
}
}
if (wpa_eapol->detected_be == 1)
{
for (u32 nonce_error_correction = 0; nonce_error_correction <= nonce_error_corrections; nonce_error_correction++)
{
u32 t = to;
t = hc_swap32_S (t);
t -= nonce_error_corrections / 2;
t += nonce_error_correction;
t = hc_swap32_S (t);
if (wpa_eapol->nonce_compare < 0)
{
pke[15] = (pke[15] & ~0x000000ff) | (t >> 24);
pke[16] = (pke[16] & ~0xffffff00) | (t << 8);
}
else
{
pke[23] = (pke[23] & ~0x000000ff) | (t >> 24);
pke[24] = (pke[24] & ~0xffffff00) | (t << 8);
}
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = out[0];
w0[1] = out[1];
w0[2] = out[2];
w0[3] = out[3];
w1[0] = out[4];
w1[1] = out[5];
w1[2] = out[6];
w1[3] = out[7];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
u32 keymic[4];
keymic[0] = 0;
@ -1087,85 +709,6 @@ KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
keymic[2] = 0;
keymic[3] = 0;
sha256_hmac_ctx_t ctx1;
sha256_hmac_init_64 (&ctx1, w0, w1, w2, w3);
sha256_hmac_update (&ctx1, pke, 102);
sha256_hmac_final (&ctx1);
u32 digest[4];
digest[0] = hc_swap32_S (ctx1.opad.h[0]);
digest[1] = hc_swap32_S (ctx1.opad.h[1]);
digest[2] = hc_swap32_S (ctx1.opad.h[2]);
digest[3] = hc_swap32_S (ctx1.opad.h[3]);
// AES CMAC
u32 ks[44];
aes128_set_encrypt_key (ks, digest, s_te0, s_te1, s_te2, s_te3);
u32 m[4];
m[0] = 0;
m[1] = 0;
m[2] = 0;
m[3] = 0;
u32 iv[4];
iv[0] = 0;
iv[1] = 0;
iv[2] = 0;
iv[3] = 0;
int eapol_left;
int eapol_idx;
for (eapol_left = wpa_eapol->eapol_len, eapol_idx = 0; eapol_left > 16; eapol_left -= 16, eapol_idx += 4)
{
m[0] = wpa_eapol->eapol[eapol_idx + 0] ^ iv[0];
m[1] = wpa_eapol->eapol[eapol_idx + 1] ^ iv[1];
m[2] = wpa_eapol->eapol[eapol_idx + 2] ^ iv[2];
m[3] = wpa_eapol->eapol[eapol_idx + 3] ^ iv[3];
aes128_encrypt (ks, m, iv, s_te0, s_te1, s_te2, s_te3, s_te4);
}
m[0] = wpa_eapol->eapol[eapol_idx + 0];
m[1] = wpa_eapol->eapol[eapol_idx + 1];
m[2] = wpa_eapol->eapol[eapol_idx + 2];
m[3] = wpa_eapol->eapol[eapol_idx + 3];
u32 k[4];
k[0] = 0;
k[1] = 0;
k[2] = 0;
k[3] = 0;
aes128_encrypt (ks, k, k, s_te0, s_te1, s_te2, s_te3, s_te4);
make_kn (k);
if (eapol_left < 16)
{
make_kn (k);
}
m[0] ^= k[0];
m[1] ^= k[1];
m[2] ^= k[2];
m[3] ^= k[3];
m[0] ^= iv[0];
m[1] ^= iv[1];
m[2] ^= iv[2];
m[3] ^= iv[3];
aes128_encrypt (ks, m, keymic, s_te0, s_te1, s_te2, s_te3, s_te4);
/**
@ -1183,5 +726,4 @@ KERNEL_FQ void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
}
}
}
}
}

View File

@ -587,24 +587,6 @@ bool module_potfile_custom_check (MAYBE_UNUSED const hashconfig_t *hashconfig, M
return r;
}
char *module_jit_build_options (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 hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
{
char *jit_build_options = NULL;
if (device_param->platform_vendor_id == VENDOR_ID_APPLE)
{
if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
{
if (device_param->device_type & CL_DEVICE_TYPE_GPU)
{
hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile");
}
}
}
return jit_build_options;
}
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;
@ -945,7 +927,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_hook23 = MODULE_DEFAULT;
module_ctx->module_hook_salt_size = MODULE_DEFAULT;
module_ctx->module_hook_size = MODULE_DEFAULT;
module_ctx->module_jit_build_options = module_jit_build_options;
module_ctx->module_jit_build_options = MODULE_DEFAULT;
module_ctx->module_jit_cache_disable = MODULE_DEFAULT;
module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
module_ctx->module_kernel_accel_min = MODULE_DEFAULT;

View File

@ -584,24 +584,6 @@ int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
return line_len;
}
char *module_jit_build_options (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 hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
{
char *jit_build_options = NULL;
if (device_param->platform_vendor_id == VENDOR_ID_APPLE)
{
if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
{
if (device_param->device_type & CL_DEVICE_TYPE_GPU)
{
hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile");
}
}
}
return jit_build_options;
}
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;
@ -942,7 +924,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_hook23 = MODULE_DEFAULT;
module_ctx->module_hook_salt_size = MODULE_DEFAULT;
module_ctx->module_hook_size = MODULE_DEFAULT;
module_ctx->module_jit_build_options = module_jit_build_options;
module_ctx->module_jit_build_options = MODULE_DEFAULT;
module_ctx->module_jit_cache_disable = MODULE_DEFAULT;
module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
module_ctx->module_kernel_accel_min = MODULE_DEFAULT;