mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-27 17:08:12 +00:00
Merge branch 'master' into pkcs1
This commit is contained in:
commit
f6322dccd5
@ -1040,6 +1040,389 @@ DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u
|
||||
out[3] = hc_swap32_S (out[3]);
|
||||
}
|
||||
|
||||
// 192 bit key
|
||||
|
||||
DECLSPEC void aes192_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3)
|
||||
{
|
||||
ks[ 0] = ukey[0];
|
||||
ks[ 1] = ukey[1];
|
||||
ks[ 2] = ukey[2];
|
||||
ks[ 3] = ukey[3];
|
||||
ks[ 4] = ukey[4];
|
||||
ks[ 5] = ukey[5];
|
||||
ks[ 6] = ks[ 0] ^ 0x01000000
|
||||
^ (s_te2[(ks[ 5] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[ 5] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[ 5] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[ 5] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[ 7] = ks[ 1] ^ ks[ 6];
|
||||
ks[ 8] = ks[ 2] ^ ks[ 7];
|
||||
ks[ 9] = ks[ 3] ^ ks[ 8];
|
||||
ks[10] = ks[ 4] ^ ks[ 9];
|
||||
ks[11] = ks[ 5] ^ ks[10];
|
||||
ks[12] = ks[ 6] ^ 0x02000000
|
||||
^ (s_te2[(ks[11] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[11] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[11] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[11] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[13] = ks[ 7] ^ ks[12];
|
||||
ks[14] = ks[ 8] ^ ks[13];
|
||||
ks[15] = ks[ 9] ^ ks[14];
|
||||
ks[16] = ks[10] ^ ks[15];
|
||||
ks[17] = ks[11] ^ ks[16];
|
||||
ks[18] = ks[12] ^ 0x04000000
|
||||
^ (s_te2[(ks[17] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[17] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[17] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[17] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[19] = ks[13] ^ ks[18];
|
||||
ks[20] = ks[14] ^ ks[19];
|
||||
ks[21] = ks[15] ^ ks[20];
|
||||
ks[22] = ks[16] ^ ks[21];
|
||||
ks[23] = ks[17] ^ ks[22];
|
||||
ks[24] = ks[18] ^ 0x08000000
|
||||
^ (s_te2[(ks[23] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[23] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[23] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[23] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[25] = ks[19] ^ ks[24];
|
||||
ks[26] = ks[20] ^ ks[25];
|
||||
ks[27] = ks[21] ^ ks[26];
|
||||
ks[28] = ks[22] ^ ks[27];
|
||||
ks[29] = ks[23] ^ ks[28];
|
||||
ks[30] = ks[24] ^ 0x10000000
|
||||
^ (s_te2[(ks[29] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[29] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[29] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[29] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[31] = ks[25] ^ ks[30];
|
||||
ks[32] = ks[26] ^ ks[31];
|
||||
ks[33] = ks[27] ^ ks[32];
|
||||
ks[34] = ks[28] ^ ks[33];
|
||||
ks[35] = ks[29] ^ ks[34];
|
||||
ks[36] = ks[30] ^ 0x20000000
|
||||
^ (s_te2[(ks[35] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[35] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[35] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[35] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[37] = ks[31] ^ ks[36];
|
||||
ks[38] = ks[32] ^ ks[37];
|
||||
ks[39] = ks[33] ^ ks[38];
|
||||
ks[40] = ks[34] ^ ks[39];
|
||||
ks[41] = ks[35] ^ ks[40];
|
||||
ks[42] = ks[36] ^ 0x40000000
|
||||
^ (s_te2[(ks[41] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[41] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[41] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[41] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[43] = ks[37] ^ ks[42];
|
||||
ks[44] = ks[38] ^ ks[43];
|
||||
ks[45] = ks[39] ^ ks[44];
|
||||
ks[46] = ks[40] ^ ks[45];
|
||||
ks[47] = ks[41] ^ ks[46];
|
||||
ks[48] = ks[42] ^ 0x80000000
|
||||
^ (s_te2[(ks[47] >> 16) & 0xff] & 0xff000000)
|
||||
^ (s_te3[(ks[47] >> 8) & 0xff] & 0x00ff0000)
|
||||
^ (s_te0[(ks[47] >> 0) & 0xff] & 0x0000ff00)
|
||||
^ (s_te1[(ks[47] >> 24) & 0xff] & 0x000000ff);
|
||||
ks[49] = ks[43] ^ ks[48];
|
||||
ks[50] = ks[44] ^ ks[49];
|
||||
ks[51] = ks[45] ^ ks[50];
|
||||
}
|
||||
|
||||
DECLSPEC void aes192_InvertKey (u32 *ks, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
temp = ks[ 0]; ks[ 0] = ks[48]; ks[48] = temp;
|
||||
temp = ks[ 1]; ks[ 1] = ks[49]; ks[49] = temp;
|
||||
temp = ks[ 2]; ks[ 2] = ks[50]; ks[50] = temp;
|
||||
temp = ks[ 3]; ks[ 3] = ks[51]; ks[51] = temp;
|
||||
temp = ks[ 4]; ks[ 4] = ks[44]; ks[44] = temp;
|
||||
temp = ks[ 5]; ks[ 5] = ks[45]; ks[45] = temp;
|
||||
temp = ks[ 6]; ks[ 6] = ks[46]; ks[46] = temp;
|
||||
temp = ks[ 7]; ks[ 7] = ks[47]; ks[47] = temp;
|
||||
temp = ks[ 8]; ks[ 8] = ks[40]; ks[40] = temp;
|
||||
temp = ks[ 9]; ks[ 9] = ks[41]; ks[41] = temp;
|
||||
temp = ks[10]; ks[10] = ks[42]; ks[42] = temp;
|
||||
temp = ks[11]; ks[11] = ks[43]; ks[43] = temp;
|
||||
temp = ks[12]; ks[12] = ks[36]; ks[36] = temp;
|
||||
temp = ks[13]; ks[13] = ks[37]; ks[37] = temp;
|
||||
temp = ks[14]; ks[14] = ks[38]; ks[38] = temp;
|
||||
temp = ks[15]; ks[15] = ks[39]; ks[39] = temp;
|
||||
temp = ks[16]; ks[16] = ks[32]; ks[32] = temp;
|
||||
temp = ks[17]; ks[17] = ks[33]; ks[33] = temp;
|
||||
temp = ks[18]; ks[18] = ks[34]; ks[34] = temp;
|
||||
temp = ks[19]; ks[19] = ks[35]; ks[35] = temp;
|
||||
temp = ks[20]; ks[20] = ks[28]; ks[28] = temp;
|
||||
temp = ks[21]; ks[21] = ks[29]; ks[29] = temp;
|
||||
temp = ks[22]; ks[22] = ks[30]; ks[30] = temp;
|
||||
temp = ks[23]; ks[23] = ks[31]; ks[31] = temp;
|
||||
|
||||
ks[ 4] = s_td0[s_te1[(ks[ 4] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 4] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 4] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 4] >> 0) & 0xff] & 0xff];
|
||||
ks[ 5] = s_td0[s_te1[(ks[ 5] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 5] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 5] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 5] >> 0) & 0xff] & 0xff];
|
||||
ks[ 6] = s_td0[s_te1[(ks[ 6] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 6] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 6] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 6] >> 0) & 0xff] & 0xff];
|
||||
ks[ 7] = s_td0[s_te1[(ks[ 7] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 7] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 7] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 7] >> 0) & 0xff] & 0xff];
|
||||
ks[ 8] = s_td0[s_te1[(ks[ 8] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 8] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 8] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 8] >> 0) & 0xff] & 0xff];
|
||||
ks[ 9] = s_td0[s_te1[(ks[ 9] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[ 9] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[ 9] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[ 9] >> 0) & 0xff] & 0xff];
|
||||
ks[10] = s_td0[s_te1[(ks[10] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[10] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[10] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[10] >> 0) & 0xff] & 0xff];
|
||||
ks[11] = s_td0[s_te1[(ks[11] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[11] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[11] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[11] >> 0) & 0xff] & 0xff];
|
||||
ks[12] = s_td0[s_te1[(ks[12] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[12] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[12] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[12] >> 0) & 0xff] & 0xff];
|
||||
ks[13] = s_td0[s_te1[(ks[13] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[13] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[13] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[13] >> 0) & 0xff] & 0xff];
|
||||
ks[14] = s_td0[s_te1[(ks[14] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[14] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[14] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[14] >> 0) & 0xff] & 0xff];
|
||||
ks[15] = s_td0[s_te1[(ks[15] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[15] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[15] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[15] >> 0) & 0xff] & 0xff];
|
||||
ks[16] = s_td0[s_te1[(ks[16] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[16] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[16] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[16] >> 0) & 0xff] & 0xff];
|
||||
ks[17] = s_td0[s_te1[(ks[17] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[17] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[17] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[17] >> 0) & 0xff] & 0xff];
|
||||
ks[18] = s_td0[s_te1[(ks[18] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[18] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[18] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[18] >> 0) & 0xff] & 0xff];
|
||||
ks[19] = s_td0[s_te1[(ks[19] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[19] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[19] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[19] >> 0) & 0xff] & 0xff];
|
||||
ks[20] = s_td0[s_te1[(ks[20] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[20] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[20] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[20] >> 0) & 0xff] & 0xff];
|
||||
ks[21] = s_td0[s_te1[(ks[21] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[21] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[21] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[21] >> 0) & 0xff] & 0xff];
|
||||
ks[22] = s_td0[s_te1[(ks[22] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[22] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[22] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[22] >> 0) & 0xff] & 0xff];
|
||||
ks[23] = s_td0[s_te1[(ks[23] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[23] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[23] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[23] >> 0) & 0xff] & 0xff];
|
||||
ks[24] = s_td0[s_te1[(ks[24] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[24] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[24] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[24] >> 0) & 0xff] & 0xff];
|
||||
ks[25] = s_td0[s_te1[(ks[25] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[25] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[25] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[25] >> 0) & 0xff] & 0xff];
|
||||
ks[26] = s_td0[s_te1[(ks[26] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[26] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[26] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[26] >> 0) & 0xff] & 0xff];
|
||||
ks[27] = s_td0[s_te1[(ks[27] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[27] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[27] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[27] >> 0) & 0xff] & 0xff];
|
||||
ks[28] = s_td0[s_te1[(ks[28] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[28] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[28] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[28] >> 0) & 0xff] & 0xff];
|
||||
ks[29] = s_td0[s_te1[(ks[29] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[29] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[29] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[29] >> 0) & 0xff] & 0xff];
|
||||
ks[30] = s_td0[s_te1[(ks[30] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[30] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[30] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[30] >> 0) & 0xff] & 0xff];
|
||||
ks[31] = s_td0[s_te1[(ks[31] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[31] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[31] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[31] >> 0) & 0xff] & 0xff];
|
||||
ks[32] = s_td0[s_te1[(ks[32] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[32] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[32] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[32] >> 0) & 0xff] & 0xff];
|
||||
ks[33] = s_td0[s_te1[(ks[33] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[33] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[33] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[33] >> 0) & 0xff] & 0xff];
|
||||
ks[34] = s_td0[s_te1[(ks[34] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[34] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[34] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[34] >> 0) & 0xff] & 0xff];
|
||||
ks[35] = s_td0[s_te1[(ks[35] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[35] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[35] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[35] >> 0) & 0xff] & 0xff];
|
||||
ks[36] = s_td0[s_te1[(ks[36] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[36] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[36] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[36] >> 0) & 0xff] & 0xff];
|
||||
ks[37] = s_td0[s_te1[(ks[37] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[37] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[37] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[37] >> 0) & 0xff] & 0xff];
|
||||
ks[38] = s_td0[s_te1[(ks[38] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[38] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[38] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[38] >> 0) & 0xff] & 0xff];
|
||||
ks[39] = s_td0[s_te1[(ks[39] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[39] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[39] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[39] >> 0) & 0xff] & 0xff];
|
||||
ks[40] = s_td0[s_te1[(ks[40] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[40] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[40] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[40] >> 0) & 0xff] & 0xff];
|
||||
ks[41] = s_td0[s_te1[(ks[41] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[41] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[41] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[41] >> 0) & 0xff] & 0xff];
|
||||
ks[42] = s_td0[s_te1[(ks[42] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[42] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[42] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[42] >> 0) & 0xff] & 0xff];
|
||||
ks[43] = s_td0[s_te1[(ks[43] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[43] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[43] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[43] >> 0) & 0xff] & 0xff];
|
||||
ks[44] = s_td0[s_te1[(ks[44] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[44] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[44] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[44] >> 0) & 0xff] & 0xff];
|
||||
ks[45] = s_td0[s_te1[(ks[45] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[45] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[45] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[45] >> 0) & 0xff] & 0xff];
|
||||
ks[46] = s_td0[s_te1[(ks[46] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[46] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[46] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[46] >> 0) & 0xff] & 0xff];
|
||||
ks[47] = s_td0[s_te1[(ks[47] >> 24) & 0xff] & 0xff] ^ s_td1[s_te1[(ks[47] >> 16) & 0xff] & 0xff] ^ s_td2[s_te1[(ks[47] >> 8) & 0xff] & 0xff] ^ s_td3[s_te1[(ks[47] >> 0) & 0xff] & 0xff];
|
||||
}
|
||||
|
||||
DECLSPEC void aes192_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3)
|
||||
{
|
||||
u32 ukey_s[6];
|
||||
|
||||
ukey_s[0] = hc_swap32_S (ukey[0]);
|
||||
ukey_s[1] = hc_swap32_S (ukey[1]);
|
||||
ukey_s[2] = hc_swap32_S (ukey[2]);
|
||||
ukey_s[3] = hc_swap32_S (ukey[3]);
|
||||
ukey_s[4] = hc_swap32_S (ukey[4]);
|
||||
ukey_s[5] = hc_swap32_S (ukey[5]);
|
||||
|
||||
aes192_ExpandKey (ks, ukey_s, s_te0, s_te1, s_te2, s_te3);
|
||||
}
|
||||
|
||||
DECLSPEC void aes192_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3)
|
||||
{
|
||||
u32 ukey_s[6];
|
||||
|
||||
ukey_s[0] = hc_swap32_S (ukey[0]);
|
||||
ukey_s[1] = hc_swap32_S (ukey[1]);
|
||||
ukey_s[2] = hc_swap32_S (ukey[2]);
|
||||
ukey_s[3] = hc_swap32_S (ukey[3]);
|
||||
ukey_s[4] = hc_swap32_S (ukey[4]);
|
||||
ukey_s[5] = hc_swap32_S (ukey[5]);
|
||||
|
||||
aes192_ExpandKey (ks, ukey_s, s_te0, s_te1, s_te2, s_te3);
|
||||
|
||||
aes192_InvertKey (ks, s_te1, s_td0, s_td1, s_td2, s_td3);
|
||||
}
|
||||
|
||||
DECLSPEC void aes192_encrypt (const u32 *ks, const u32 *in, u32 *out, 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)
|
||||
{
|
||||
u32 in_s[4];
|
||||
|
||||
in_s[0] = hc_swap32_S (in[0]);
|
||||
in_s[1] = hc_swap32_S (in[1]);
|
||||
in_s[2] = hc_swap32_S (in[2]);
|
||||
in_s[3] = hc_swap32_S (in[3]);
|
||||
|
||||
u32 s0 = in_s[0] ^ ks[0];
|
||||
u32 s1 = in_s[1] ^ ks[1];
|
||||
u32 s2 = in_s[2] ^ ks[2];
|
||||
u32 s3 = in_s[3] ^ ks[3];
|
||||
|
||||
u32 t0;
|
||||
u32 t1;
|
||||
u32 t2;
|
||||
u32 t3;
|
||||
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[ 4];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[ 5];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[ 6];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[ 7];
|
||||
s0 = s_te0[t0 >> 24] ^ s_te1[(t1 >> 16) & 0xff] ^ s_te2[(t2 >> 8) & 0xff] ^ s_te3[t3 & 0xff] ^ ks[ 8];
|
||||
s1 = s_te0[t1 >> 24] ^ s_te1[(t2 >> 16) & 0xff] ^ s_te2[(t3 >> 8) & 0xff] ^ s_te3[t0 & 0xff] ^ ks[ 9];
|
||||
s2 = s_te0[t2 >> 24] ^ s_te1[(t3 >> 16) & 0xff] ^ s_te2[(t0 >> 8) & 0xff] ^ s_te3[t1 & 0xff] ^ ks[10];
|
||||
s3 = s_te0[t3 >> 24] ^ s_te1[(t0 >> 16) & 0xff] ^ s_te2[(t1 >> 8) & 0xff] ^ s_te3[t2 & 0xff] ^ ks[11];
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[12];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[13];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[14];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[15];
|
||||
s0 = s_te0[t0 >> 24] ^ s_te1[(t1 >> 16) & 0xff] ^ s_te2[(t2 >> 8) & 0xff] ^ s_te3[t3 & 0xff] ^ ks[16];
|
||||
s1 = s_te0[t1 >> 24] ^ s_te1[(t2 >> 16) & 0xff] ^ s_te2[(t3 >> 8) & 0xff] ^ s_te3[t0 & 0xff] ^ ks[17];
|
||||
s2 = s_te0[t2 >> 24] ^ s_te1[(t3 >> 16) & 0xff] ^ s_te2[(t0 >> 8) & 0xff] ^ s_te3[t1 & 0xff] ^ ks[18];
|
||||
s3 = s_te0[t3 >> 24] ^ s_te1[(t0 >> 16) & 0xff] ^ s_te2[(t1 >> 8) & 0xff] ^ s_te3[t2 & 0xff] ^ ks[19];
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[20];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[21];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[22];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[23];
|
||||
s0 = s_te0[t0 >> 24] ^ s_te1[(t1 >> 16) & 0xff] ^ s_te2[(t2 >> 8) & 0xff] ^ s_te3[t3 & 0xff] ^ ks[24];
|
||||
s1 = s_te0[t1 >> 24] ^ s_te1[(t2 >> 16) & 0xff] ^ s_te2[(t3 >> 8) & 0xff] ^ s_te3[t0 & 0xff] ^ ks[25];
|
||||
s2 = s_te0[t2 >> 24] ^ s_te1[(t3 >> 16) & 0xff] ^ s_te2[(t0 >> 8) & 0xff] ^ s_te3[t1 & 0xff] ^ ks[26];
|
||||
s3 = s_te0[t3 >> 24] ^ s_te1[(t0 >> 16) & 0xff] ^ s_te2[(t1 >> 8) & 0xff] ^ s_te3[t2 & 0xff] ^ ks[27];
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[28];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[29];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[30];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[31];
|
||||
s0 = s_te0[t0 >> 24] ^ s_te1[(t1 >> 16) & 0xff] ^ s_te2[(t2 >> 8) & 0xff] ^ s_te3[t3 & 0xff] ^ ks[32];
|
||||
s1 = s_te0[t1 >> 24] ^ s_te1[(t2 >> 16) & 0xff] ^ s_te2[(t3 >> 8) & 0xff] ^ s_te3[t0 & 0xff] ^ ks[33];
|
||||
s2 = s_te0[t2 >> 24] ^ s_te1[(t3 >> 16) & 0xff] ^ s_te2[(t0 >> 8) & 0xff] ^ s_te3[t1 & 0xff] ^ ks[34];
|
||||
s3 = s_te0[t3 >> 24] ^ s_te1[(t0 >> 16) & 0xff] ^ s_te2[(t1 >> 8) & 0xff] ^ s_te3[t2 & 0xff] ^ ks[35];
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[36];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[37];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[38];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[39];
|
||||
s0 = s_te0[t0 >> 24] ^ s_te1[(t1 >> 16) & 0xff] ^ s_te2[(t2 >> 8) & 0xff] ^ s_te3[t3 & 0xff] ^ ks[40];
|
||||
s1 = s_te0[t1 >> 24] ^ s_te1[(t2 >> 16) & 0xff] ^ s_te2[(t3 >> 8) & 0xff] ^ s_te3[t0 & 0xff] ^ ks[41];
|
||||
s2 = s_te0[t2 >> 24] ^ s_te1[(t3 >> 16) & 0xff] ^ s_te2[(t0 >> 8) & 0xff] ^ s_te3[t1 & 0xff] ^ ks[42];
|
||||
s3 = s_te0[t3 >> 24] ^ s_te1[(t0 >> 16) & 0xff] ^ s_te2[(t1 >> 8) & 0xff] ^ s_te3[t2 & 0xff] ^ ks[43];
|
||||
t0 = s_te0[s0 >> 24] ^ s_te1[(s1 >> 16) & 0xff] ^ s_te2[(s2 >> 8) & 0xff] ^ s_te3[s3 & 0xff] ^ ks[44];
|
||||
t1 = s_te0[s1 >> 24] ^ s_te1[(s2 >> 16) & 0xff] ^ s_te2[(s3 >> 8) & 0xff] ^ s_te3[s0 & 0xff] ^ ks[45];
|
||||
t2 = s_te0[s2 >> 24] ^ s_te1[(s3 >> 16) & 0xff] ^ s_te2[(s0 >> 8) & 0xff] ^ s_te3[s1 & 0xff] ^ ks[46];
|
||||
t3 = s_te0[s3 >> 24] ^ s_te1[(s0 >> 16) & 0xff] ^ s_te2[(s1 >> 8) & 0xff] ^ s_te3[s2 & 0xff] ^ ks[47];
|
||||
|
||||
out[0] = (s_te4[(t0 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_te4[(t1 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_te4[(t2 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_te4[(t3 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[48];
|
||||
|
||||
out[1] = (s_te4[(t1 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_te4[(t2 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_te4[(t3 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_te4[(t0 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[49];
|
||||
|
||||
out[2] = (s_te4[(t2 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_te4[(t3 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_te4[(t0 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_te4[(t1 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[50];
|
||||
|
||||
out[3] = (s_te4[(t3 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_te4[(t0 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_te4[(t1 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_te4[(t2 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[51];
|
||||
|
||||
out[0] = hc_swap32_S (out[0]);
|
||||
out[1] = hc_swap32_S (out[1]);
|
||||
out[2] = hc_swap32_S (out[2]);
|
||||
out[3] = hc_swap32_S (out[3]);
|
||||
}
|
||||
|
||||
DECLSPEC void aes192_decrypt (const u32 *ks, const u32 *in, u32 *out, 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)
|
||||
{
|
||||
u32 in_s[4];
|
||||
|
||||
in_s[0] = hc_swap32_S (in[0]);
|
||||
in_s[1] = hc_swap32_S (in[1]);
|
||||
in_s[2] = hc_swap32_S (in[2]);
|
||||
in_s[3] = hc_swap32_S (in[3]);
|
||||
|
||||
u32 s0 = in_s[0] ^ ks[0];
|
||||
u32 s1 = in_s[1] ^ ks[1];
|
||||
u32 s2 = in_s[2] ^ ks[2];
|
||||
u32 s3 = in_s[3] ^ ks[3];
|
||||
|
||||
u32 t0;
|
||||
u32 t1;
|
||||
u32 t2;
|
||||
u32 t3;
|
||||
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[ 4];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[ 5];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[ 6];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[ 7];
|
||||
s0 = s_td0[t0 >> 24] ^ s_td1[(t3 >> 16) & 0xff] ^ s_td2[(t2 >> 8) & 0xff] ^ s_td3[t1 & 0xff] ^ ks[ 8];
|
||||
s1 = s_td0[t1 >> 24] ^ s_td1[(t0 >> 16) & 0xff] ^ s_td2[(t3 >> 8) & 0xff] ^ s_td3[t2 & 0xff] ^ ks[ 9];
|
||||
s2 = s_td0[t2 >> 24] ^ s_td1[(t1 >> 16) & 0xff] ^ s_td2[(t0 >> 8) & 0xff] ^ s_td3[t3 & 0xff] ^ ks[10];
|
||||
s3 = s_td0[t3 >> 24] ^ s_td1[(t2 >> 16) & 0xff] ^ s_td2[(t1 >> 8) & 0xff] ^ s_td3[t0 & 0xff] ^ ks[11];
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[12];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[13];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[14];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[15];
|
||||
s0 = s_td0[t0 >> 24] ^ s_td1[(t3 >> 16) & 0xff] ^ s_td2[(t2 >> 8) & 0xff] ^ s_td3[t1 & 0xff] ^ ks[16];
|
||||
s1 = s_td0[t1 >> 24] ^ s_td1[(t0 >> 16) & 0xff] ^ s_td2[(t3 >> 8) & 0xff] ^ s_td3[t2 & 0xff] ^ ks[17];
|
||||
s2 = s_td0[t2 >> 24] ^ s_td1[(t1 >> 16) & 0xff] ^ s_td2[(t0 >> 8) & 0xff] ^ s_td3[t3 & 0xff] ^ ks[18];
|
||||
s3 = s_td0[t3 >> 24] ^ s_td1[(t2 >> 16) & 0xff] ^ s_td2[(t1 >> 8) & 0xff] ^ s_td3[t0 & 0xff] ^ ks[19];
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[20];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[21];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[22];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[23];
|
||||
s0 = s_td0[t0 >> 24] ^ s_td1[(t3 >> 16) & 0xff] ^ s_td2[(t2 >> 8) & 0xff] ^ s_td3[t1 & 0xff] ^ ks[24];
|
||||
s1 = s_td0[t1 >> 24] ^ s_td1[(t0 >> 16) & 0xff] ^ s_td2[(t3 >> 8) & 0xff] ^ s_td3[t2 & 0xff] ^ ks[25];
|
||||
s2 = s_td0[t2 >> 24] ^ s_td1[(t1 >> 16) & 0xff] ^ s_td2[(t0 >> 8) & 0xff] ^ s_td3[t3 & 0xff] ^ ks[26];
|
||||
s3 = s_td0[t3 >> 24] ^ s_td1[(t2 >> 16) & 0xff] ^ s_td2[(t1 >> 8) & 0xff] ^ s_td3[t0 & 0xff] ^ ks[27];
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[28];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[29];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[30];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[31];
|
||||
s0 = s_td0[t0 >> 24] ^ s_td1[(t3 >> 16) & 0xff] ^ s_td2[(t2 >> 8) & 0xff] ^ s_td3[t1 & 0xff] ^ ks[32];
|
||||
s1 = s_td0[t1 >> 24] ^ s_td1[(t0 >> 16) & 0xff] ^ s_td2[(t3 >> 8) & 0xff] ^ s_td3[t2 & 0xff] ^ ks[33];
|
||||
s2 = s_td0[t2 >> 24] ^ s_td1[(t1 >> 16) & 0xff] ^ s_td2[(t0 >> 8) & 0xff] ^ s_td3[t3 & 0xff] ^ ks[34];
|
||||
s3 = s_td0[t3 >> 24] ^ s_td1[(t2 >> 16) & 0xff] ^ s_td2[(t1 >> 8) & 0xff] ^ s_td3[t0 & 0xff] ^ ks[35];
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[36];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[37];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[38];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[39];
|
||||
s0 = s_td0[t0 >> 24] ^ s_td1[(t3 >> 16) & 0xff] ^ s_td2[(t2 >> 8) & 0xff] ^ s_td3[t1 & 0xff] ^ ks[40];
|
||||
s1 = s_td0[t1 >> 24] ^ s_td1[(t0 >> 16) & 0xff] ^ s_td2[(t3 >> 8) & 0xff] ^ s_td3[t2 & 0xff] ^ ks[41];
|
||||
s2 = s_td0[t2 >> 24] ^ s_td1[(t1 >> 16) & 0xff] ^ s_td2[(t0 >> 8) & 0xff] ^ s_td3[t3 & 0xff] ^ ks[42];
|
||||
s3 = s_td0[t3 >> 24] ^ s_td1[(t2 >> 16) & 0xff] ^ s_td2[(t1 >> 8) & 0xff] ^ s_td3[t0 & 0xff] ^ ks[43];
|
||||
t0 = s_td0[s0 >> 24] ^ s_td1[(s3 >> 16) & 0xff] ^ s_td2[(s2 >> 8) & 0xff] ^ s_td3[s1 & 0xff] ^ ks[44];
|
||||
t1 = s_td0[s1 >> 24] ^ s_td1[(s0 >> 16) & 0xff] ^ s_td2[(s3 >> 8) & 0xff] ^ s_td3[s2 & 0xff] ^ ks[45];
|
||||
t2 = s_td0[s2 >> 24] ^ s_td1[(s1 >> 16) & 0xff] ^ s_td2[(s0 >> 8) & 0xff] ^ s_td3[s3 & 0xff] ^ ks[46];
|
||||
t3 = s_td0[s3 >> 24] ^ s_td1[(s2 >> 16) & 0xff] ^ s_td2[(s1 >> 8) & 0xff] ^ s_td3[s0 & 0xff] ^ ks[47];
|
||||
|
||||
out[0] = (s_td4[(t0 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_td4[(t3 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_td4[(t2 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_td4[(t1 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[48];
|
||||
|
||||
out[1] = (s_td4[(t1 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_td4[(t0 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_td4[(t3 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_td4[(t2 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[49];
|
||||
|
||||
out[2] = (s_td4[(t2 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_td4[(t1 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_td4[(t0 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_td4[(t3 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[50];
|
||||
|
||||
out[3] = (s_td4[(t3 >> 24) & 0xff] & 0xff000000)
|
||||
^ (s_td4[(t2 >> 16) & 0xff] & 0x00ff0000)
|
||||
^ (s_td4[(t1 >> 8) & 0xff] & 0x0000ff00)
|
||||
^ (s_td4[(t0 >> 0) & 0xff] & 0x000000ff)
|
||||
^ ks[51];
|
||||
|
||||
out[0] = hc_swap32_S (out[0]);
|
||||
out[1] = hc_swap32_S (out[1]);
|
||||
out[2] = hc_swap32_S (out[2]);
|
||||
out[3] = hc_swap32_S (out[3]);
|
||||
}
|
||||
|
||||
// 256 bit key
|
||||
|
||||
DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3)
|
||||
@ -1547,6 +1930,72 @@ DECLSPEC void AES128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u
|
||||
out[3] = hc_swap32_S (out_s[3]);
|
||||
}
|
||||
|
||||
DECLSPEC void AES192_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3)
|
||||
{
|
||||
u32 ukey_s[6];
|
||||
|
||||
ukey_s[0] = hc_swap32_S (ukey[0]);
|
||||
ukey_s[1] = hc_swap32_S (ukey[1]);
|
||||
ukey_s[2] = hc_swap32_S (ukey[2]);
|
||||
ukey_s[3] = hc_swap32_S (ukey[3]);
|
||||
ukey_s[4] = hc_swap32_S (ukey[4]);
|
||||
ukey_s[5] = hc_swap32_S (ukey[5]);
|
||||
|
||||
aes192_set_encrypt_key (ks, ukey_s, s_te0, s_te1, s_te2, s_te3);
|
||||
}
|
||||
|
||||
DECLSPEC void AES192_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3)
|
||||
{
|
||||
u32 ukey_s[6];
|
||||
|
||||
ukey_s[0] = hc_swap32_S (ukey[0]);
|
||||
ukey_s[1] = hc_swap32_S (ukey[1]);
|
||||
ukey_s[2] = hc_swap32_S (ukey[2]);
|
||||
ukey_s[3] = hc_swap32_S (ukey[3]);
|
||||
ukey_s[4] = hc_swap32_S (ukey[4]);
|
||||
ukey_s[5] = hc_swap32_S (ukey[5]);
|
||||
|
||||
aes192_set_decrypt_key (ks, ukey_s, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
}
|
||||
|
||||
DECLSPEC void AES192_encrypt (const u32 *ks, const u32 *in, u32 *out, 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)
|
||||
{
|
||||
u32 in_s[4];
|
||||
|
||||
in_s[0] = hc_swap32_S (in[0]);
|
||||
in_s[1] = hc_swap32_S (in[1]);
|
||||
in_s[2] = hc_swap32_S (in[2]);
|
||||
in_s[3] = hc_swap32_S (in[3]);
|
||||
|
||||
u32 out_s[4];
|
||||
|
||||
aes192_encrypt (ks, in_s, out_s, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||
|
||||
out[0] = hc_swap32_S (out_s[0]);
|
||||
out[1] = hc_swap32_S (out_s[1]);
|
||||
out[2] = hc_swap32_S (out_s[2]);
|
||||
out[3] = hc_swap32_S (out_s[3]);
|
||||
}
|
||||
|
||||
DECLSPEC void AES192_decrypt (const u32 *ks, const u32 *in, u32 *out, 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)
|
||||
{
|
||||
u32 in_s[4];
|
||||
|
||||
in_s[0] = hc_swap32_S (in[0]);
|
||||
in_s[1] = hc_swap32_S (in[1]);
|
||||
in_s[2] = hc_swap32_S (in[2]);
|
||||
in_s[3] = hc_swap32_S (in[3]);
|
||||
|
||||
u32 out_s[4];
|
||||
|
||||
aes192_decrypt (ks, in_s, out_s, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] = hc_swap32_S (out_s[0]);
|
||||
out[1] = hc_swap32_S (out_s[1]);
|
||||
out[2] = hc_swap32_S (out_s[2]);
|
||||
out[3] = hc_swap32_S (out_s[3]);
|
||||
}
|
||||
|
||||
DECLSPEC void AES256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3)
|
||||
{
|
||||
u32 ukey_s[8];
|
||||
|
@ -12,6 +12,12 @@ DECLSPEC void aes128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_
|
||||
DECLSPEC void aes128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void aes128_encrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void aes192_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
DECLSPEC void aes192_InvertKey (u32 *ks, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void aes192_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
DECLSPEC void aes192_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void aes192_encrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void aes192_decrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void aes256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
@ -22,6 +28,10 @@ DECLSPEC void AES128_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_
|
||||
DECLSPEC void AES128_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void AES128_encrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void AES128_decrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void AES192_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
DECLSPEC void AES192_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void AES192_encrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void AES192_decrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
DECLSPEC void AES256_set_encrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3);
|
||||
DECLSPEC void AES256_set_decrypt_key (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3);
|
||||
DECLSPEC void AES256_encrypt (const u32 *ks, const u32 *in, u32 *out, 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);
|
||||
|
@ -66,22 +66,22 @@ KERNEL_FQ void m21000_mxx (KERN_ATTR_VECTOR ())
|
||||
|
||||
u32x final[32] = { 0 };
|
||||
|
||||
final[ 0] = h32_from_64_S (ctx0.h[0]);
|
||||
final[ 1] = l32_from_64_S (ctx0.h[0]);
|
||||
final[ 2] = h32_from_64_S (ctx0.h[1]);
|
||||
final[ 3] = l32_from_64_S (ctx0.h[1]);
|
||||
final[ 4] = h32_from_64_S (ctx0.h[2]);
|
||||
final[ 5] = l32_from_64_S (ctx0.h[2]);
|
||||
final[ 6] = h32_from_64_S (ctx0.h[3]);
|
||||
final[ 7] = l32_from_64_S (ctx0.h[3]);
|
||||
final[ 8] = h32_from_64_S (ctx0.h[4]);
|
||||
final[ 9] = l32_from_64_S (ctx0.h[4]);
|
||||
final[10] = h32_from_64_S (ctx0.h[5]);
|
||||
final[11] = l32_from_64_S (ctx0.h[5]);
|
||||
final[12] = h32_from_64_S (ctx0.h[6]);
|
||||
final[13] = l32_from_64_S (ctx0.h[6]);
|
||||
final[14] = h32_from_64_S (ctx0.h[7]);
|
||||
final[15] = l32_from_64_S (ctx0.h[7]);
|
||||
final[ 0] = h32_from_64 (ctx0.h[0]);
|
||||
final[ 1] = l32_from_64 (ctx0.h[0]);
|
||||
final[ 2] = h32_from_64 (ctx0.h[1]);
|
||||
final[ 3] = l32_from_64 (ctx0.h[1]);
|
||||
final[ 4] = h32_from_64 (ctx0.h[2]);
|
||||
final[ 5] = l32_from_64 (ctx0.h[2]);
|
||||
final[ 6] = h32_from_64 (ctx0.h[3]);
|
||||
final[ 7] = l32_from_64 (ctx0.h[3]);
|
||||
final[ 8] = h32_from_64 (ctx0.h[4]);
|
||||
final[ 9] = l32_from_64 (ctx0.h[4]);
|
||||
final[10] = h32_from_64 (ctx0.h[5]);
|
||||
final[11] = l32_from_64 (ctx0.h[5]);
|
||||
final[12] = h32_from_64 (ctx0.h[6]);
|
||||
final[13] = l32_from_64 (ctx0.h[6]);
|
||||
final[14] = h32_from_64 (ctx0.h[7]);
|
||||
final[15] = l32_from_64 (ctx0.h[7]);
|
||||
|
||||
sha512_update_vector (&ctx, final, 64);
|
||||
|
||||
@ -160,22 +160,22 @@ KERNEL_FQ void m21000_sxx (KERN_ATTR_VECTOR ())
|
||||
|
||||
u32x final[32] = { 0 };
|
||||
|
||||
final[ 0] = h32_from_64_S (ctx0.h[0]);
|
||||
final[ 1] = l32_from_64_S (ctx0.h[0]);
|
||||
final[ 2] = h32_from_64_S (ctx0.h[1]);
|
||||
final[ 3] = l32_from_64_S (ctx0.h[1]);
|
||||
final[ 4] = h32_from_64_S (ctx0.h[2]);
|
||||
final[ 5] = l32_from_64_S (ctx0.h[2]);
|
||||
final[ 6] = h32_from_64_S (ctx0.h[3]);
|
||||
final[ 7] = l32_from_64_S (ctx0.h[3]);
|
||||
final[ 8] = h32_from_64_S (ctx0.h[4]);
|
||||
final[ 9] = l32_from_64_S (ctx0.h[4]);
|
||||
final[10] = h32_from_64_S (ctx0.h[5]);
|
||||
final[11] = l32_from_64_S (ctx0.h[5]);
|
||||
final[12] = h32_from_64_S (ctx0.h[6]);
|
||||
final[13] = l32_from_64_S (ctx0.h[6]);
|
||||
final[14] = h32_from_64_S (ctx0.h[7]);
|
||||
final[15] = l32_from_64_S (ctx0.h[7]);
|
||||
final[ 0] = h32_from_64 (ctx0.h[0]);
|
||||
final[ 1] = l32_from_64 (ctx0.h[0]);
|
||||
final[ 2] = h32_from_64 (ctx0.h[1]);
|
||||
final[ 3] = l32_from_64 (ctx0.h[1]);
|
||||
final[ 4] = h32_from_64 (ctx0.h[2]);
|
||||
final[ 5] = l32_from_64 (ctx0.h[2]);
|
||||
final[ 6] = h32_from_64 (ctx0.h[3]);
|
||||
final[ 7] = l32_from_64 (ctx0.h[3]);
|
||||
final[ 8] = h32_from_64 (ctx0.h[4]);
|
||||
final[ 9] = l32_from_64 (ctx0.h[4]);
|
||||
final[10] = h32_from_64 (ctx0.h[5]);
|
||||
final[11] = l32_from_64 (ctx0.h[5]);
|
||||
final[12] = h32_from_64 (ctx0.h[6]);
|
||||
final[13] = l32_from_64 (ctx0.h[6]);
|
||||
final[14] = h32_from_64 (ctx0.h[7]);
|
||||
final[15] = l32_from_64 (ctx0.h[7]);
|
||||
|
||||
sha512_update_vector (&ctx, final, 64);
|
||||
|
||||
|
695
OpenCL/m23001_a0-optimized.cl
Normal file
695
OpenCL/m23001_a0-optimized.cl
Normal file
@ -0,0 +1,695 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp_optimized.h"
|
||||
#include "inc_rp_optimized.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23001_m04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_m08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_m16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
411
OpenCL/m23001_a0-pure.cl
Normal file
411
OpenCL/m23001_a0-pure.cl
Normal file
@ -0,0 +1,411 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23001_mxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_sxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
809
OpenCL/m23001_a1-optimized.cl
Normal file
809
OpenCL/m23001_a1-optimized.cl
Normal file
@ -0,0 +1,809 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23001_m04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_m08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_m16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_s16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
405
OpenCL/m23001_a1-pure.cl
Normal file
405
OpenCL/m23001_a1-pure.cl
Normal file
@ -0,0 +1,405 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23001_mxx (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_sxx (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1279
OpenCL/m23001_a3-optimized.cl
Normal file
1279
OpenCL/m23001_a3-optimized.cl
Normal file
File diff suppressed because it is too large
Load Diff
431
OpenCL/m23001_a3-pure.cl
Normal file
431
OpenCL/m23001_a3-pure.cl
Normal file
@ -0,0 +1,431 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23001_mxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23001_sxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[4];
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 44
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES128_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes128_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
801
OpenCL/m23002_a0-optimized.cl
Normal file
801
OpenCL/m23002_a0-optimized.cl
Normal file
@ -0,0 +1,801 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp_optimized.h"
|
||||
#include "inc_rp_optimized.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23002_m04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_m08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_m16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
517
OpenCL/m23002_a0-pure.cl
Normal file
517
OpenCL/m23002_a0-pure.cl
Normal file
@ -0,0 +1,517 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23002_mxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_sxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
915
OpenCL/m23002_a1-optimized.cl
Normal file
915
OpenCL/m23002_a1-optimized.cl
Normal file
@ -0,0 +1,915 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23002_m04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_m08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_m16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_s16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
511
OpenCL/m23002_a1-pure.cl
Normal file
511
OpenCL/m23002_a1-pure.cl
Normal file
@ -0,0 +1,511 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23002_mxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_sxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1385
OpenCL/m23002_a3-optimized.cl
Normal file
1385
OpenCL/m23002_a3-optimized.cl
Normal file
File diff suppressed because it is too large
Load Diff
537
OpenCL/m23002_a3-pure.cl
Normal file
537
OpenCL/m23002_a3-pure.cl
Normal file
@ -0,0 +1,537 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23002_mxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23002_sxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[6]; // 5 + 1 = 6 (20 bytes + 4 bytes = 24 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 52
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES192_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes192_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
805
OpenCL/m23003_a0-optimized.cl
Normal file
805
OpenCL/m23003_a0-optimized.cl
Normal file
@ -0,0 +1,805 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp_optimized.h"
|
||||
#include "inc_rp_optimized.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23003_m04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_m08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_m16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s04 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
u32x w0[4] = { 0 };
|
||||
u32x w1[4] = { 0 };
|
||||
u32x w2[4] = { 0 };
|
||||
u32x w3[4] = { 0 };
|
||||
|
||||
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
||||
|
||||
append_0x80_2x4_VV (w0, w1, out_len);
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = out_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s08 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s16 (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
}
|
521
OpenCL/m23003_a0-pure.cl
Normal file
521
OpenCL/m23003_a0-pure.cl
Normal file
@ -0,0 +1,521 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23003_mxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_sxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_ctx_t ctx;
|
||||
|
||||
sha1_init (&ctx);
|
||||
|
||||
sha1_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
919
OpenCL/m23003_a1-optimized.cl
Normal file
919
OpenCL/m23003_a1-optimized.cl
Normal file
@ -0,0 +1,919 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23003_m04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_m08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_m16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s04 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 pw_buf0[4];
|
||||
u32 pw_buf1[4];
|
||||
|
||||
pw_buf0[0] = pws[gid].i[0];
|
||||
pw_buf0[1] = pws[gid].i[1];
|
||||
pw_buf0[2] = pws[gid].i[2];
|
||||
pw_buf0[3] = pws[gid].i[3];
|
||||
pw_buf1[0] = pws[gid].i[4];
|
||||
pw_buf1[1] = pws[gid].i[5];
|
||||
pw_buf1[2] = pws[gid].i[6];
|
||||
pw_buf1[3] = pws[gid].i[7];
|
||||
|
||||
const u32 pw_l_len = pws[gid].pw_len & 63;
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
|
||||
|
||||
const u32x pw_len = (pw_l_len + pw_r_len) & 63;
|
||||
|
||||
/**
|
||||
* concat password candidate
|
||||
*/
|
||||
|
||||
u32x wordl0[4] = { 0 };
|
||||
u32x wordl1[4] = { 0 };
|
||||
u32x wordl2[4] = { 0 };
|
||||
u32x wordl3[4] = { 0 };
|
||||
|
||||
wordl0[0] = pw_buf0[0];
|
||||
wordl0[1] = pw_buf0[1];
|
||||
wordl0[2] = pw_buf0[2];
|
||||
wordl0[3] = pw_buf0[3];
|
||||
wordl1[0] = pw_buf1[0];
|
||||
wordl1[1] = pw_buf1[1];
|
||||
wordl1[2] = pw_buf1[2];
|
||||
wordl1[3] = pw_buf1[3];
|
||||
|
||||
u32x wordr0[4] = { 0 };
|
||||
u32x wordr1[4] = { 0 };
|
||||
u32x wordr2[4] = { 0 };
|
||||
u32x wordr3[4] = { 0 };
|
||||
|
||||
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
|
||||
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
|
||||
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
|
||||
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
|
||||
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
|
||||
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
|
||||
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
|
||||
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
|
||||
|
||||
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
|
||||
}
|
||||
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = wordl0[0] | wordr0[0];
|
||||
w0[1] = wordl0[1] | wordr0[1];
|
||||
w0[2] = wordl0[2] | wordr0[2];
|
||||
w0[3] = wordl0[3] | wordr0[3];
|
||||
w1[0] = wordl1[0] | wordr1[0];
|
||||
w1[1] = wordl1[1] | wordr1[1];
|
||||
w1[2] = wordl1[2] | wordr1[2];
|
||||
w1[3] = wordl1[3] | wordr1[3];
|
||||
w2[0] = wordl2[0] | wordr2[0];
|
||||
w2[1] = wordl2[1] | wordr2[1];
|
||||
w2[2] = wordl2[2] | wordr2[2];
|
||||
w2[3] = wordl2[3] | wordr2[3];
|
||||
w3[0] = wordl3[0] | wordr3[0];
|
||||
w3[1] = wordl3[1] | wordr3[1];
|
||||
w3[2] = wordl3[2] | wordr3[2];
|
||||
w3[3] = wordl3[3] | wordr3[3];
|
||||
|
||||
/**
|
||||
* sha1
|
||||
*/
|
||||
|
||||
u32x w0_t = hc_swap32 (w0[0]);
|
||||
u32x w1_t = hc_swap32 (w0[1]);
|
||||
u32x w2_t = hc_swap32 (w0[2]);
|
||||
u32x w3_t = hc_swap32 (w0[3]);
|
||||
u32x w4_t = hc_swap32 (w1[0]);
|
||||
u32x w5_t = hc_swap32 (w1[1]);
|
||||
u32x w6_t = hc_swap32 (w1[2]);
|
||||
u32x w7_t = hc_swap32 (w1[3]);
|
||||
u32x w8_t = hc_swap32 (w2[0]);
|
||||
u32x w9_t = hc_swap32 (w2[1]);
|
||||
u32x wa_t = hc_swap32 (w2[2]);
|
||||
u32x wb_t = hc_swap32 (w2[3]);
|
||||
u32x wc_t = hc_swap32 (w3[0]);
|
||||
u32x wd_t = hc_swap32 (w3[1]);
|
||||
u32x we_t = 0;
|
||||
u32x wf_t = pw_len * 8;
|
||||
|
||||
u32x a = SHA1M_A;
|
||||
u32x b = SHA1M_B;
|
||||
u32x c = SHA1M_C;
|
||||
u32x d = SHA1M_D;
|
||||
u32x e = SHA1M_E;
|
||||
|
||||
#undef K
|
||||
#define K SHA1C00
|
||||
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
||||
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
||||
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
||||
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
||||
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
||||
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C01
|
||||
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C02
|
||||
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
||||
|
||||
#undef K
|
||||
#define K SHA1C03
|
||||
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
||||
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
||||
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
||||
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
||||
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
||||
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
||||
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
||||
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
||||
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
||||
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
||||
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
||||
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
||||
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
||||
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
||||
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
||||
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
||||
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
||||
|
||||
a += SHA1M_A;
|
||||
b += SHA1M_B;
|
||||
c += SHA1M_C;
|
||||
d += SHA1M_D;
|
||||
e += SHA1M_E;
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ a;
|
||||
t0[1] = 0x36363636 ^ b;
|
||||
t0[2] = 0x36363636 ^ c;
|
||||
t0[3] = 0x36363636 ^ d;
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ e;
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ a;
|
||||
t0[1] = 0x5c5c5c5c ^ b;
|
||||
t0[2] = 0x5c5c5c5c ^ c;
|
||||
t0[3] = 0x5c5c5c5c ^ d;
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ e;
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s08 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_s16 (KERN_ATTR_ESALT (securezip_t))
|
||||
{
|
||||
}
|
515
OpenCL/m23003_a1-pure.cl
Normal file
515
OpenCL/m23003_a1-pure.cl
Normal file
@ -0,0 +1,515 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23003_mxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_sxx (KERN_ATTR_RULES_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
sha1_ctx_t ctx0;
|
||||
|
||||
sha1_init (&ctx0);
|
||||
|
||||
sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
sha1_ctx_t ctx = ctx0;
|
||||
|
||||
sha1_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
|
||||
|
||||
sha1_final (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1389
OpenCL/m23003_a3-optimized.cl
Normal file
1389
OpenCL/m23003_a3-optimized.cl
Normal file
File diff suppressed because it is too large
Load Diff
541
OpenCL/m23003_a3-pure.cl
Normal file
541
OpenCL/m23003_a3-pure.cl
Normal file
@ -0,0 +1,541 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha1.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#endif
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
KERNEL_FQ void m23003_mxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m23003_sxx (KERN_ATTR_VECTOR_ESALT (securezip_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
LOCAL_VK u32 s_td0[256];
|
||||
LOCAL_VK u32 s_td1[256];
|
||||
LOCAL_VK u32 s_td2[256];
|
||||
LOCAL_VK u32 s_td3[256];
|
||||
LOCAL_VK u32 s_td4[256];
|
||||
|
||||
LOCAL_VK u32 s_te0[256];
|
||||
LOCAL_VK u32 s_te1[256];
|
||||
LOCAL_VK u32 s_te2[256];
|
||||
LOCAL_VK u32 s_te3[256];
|
||||
LOCAL_VK u32 s_te4[256];
|
||||
|
||||
for (u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
SYNC_THREADS ();
|
||||
|
||||
#else
|
||||
|
||||
CONSTANT_AS u32a *s_td0 = td0;
|
||||
CONSTANT_AS u32a *s_td1 = td1;
|
||||
CONSTANT_AS u32a *s_td2 = td2;
|
||||
CONSTANT_AS u32a *s_td3 = td3;
|
||||
CONSTANT_AS u32a *s_td4 = td4;
|
||||
|
||||
CONSTANT_AS u32a *s_te0 = te0;
|
||||
CONSTANT_AS u32a *s_te1 = te1;
|
||||
CONSTANT_AS u32a *s_te2 = te2;
|
||||
CONSTANT_AS u32a *s_te3 = te3;
|
||||
CONSTANT_AS u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
sha1_ctx_vector_t ctx;
|
||||
|
||||
sha1_init_vector (&ctx);
|
||||
|
||||
sha1_update_vector (&ctx, w, pw_len);
|
||||
|
||||
sha1_final_vector (&ctx);
|
||||
|
||||
u32 t0[4];
|
||||
|
||||
t0[0] = 0x36363636 ^ ctx.h[0];
|
||||
t0[1] = 0x36363636 ^ ctx.h[1];
|
||||
t0[2] = 0x36363636 ^ ctx.h[2];
|
||||
t0[3] = 0x36363636 ^ ctx.h[3];
|
||||
|
||||
u32 t1[4];
|
||||
|
||||
t1[0] = 0x36363636 ^ ctx.h[4];
|
||||
t1[1] = 0x36363636;
|
||||
t1[2] = 0x36363636;
|
||||
t1[3] = 0x36363636;
|
||||
|
||||
u32 t2[4];
|
||||
|
||||
t2[0] = 0x36363636;
|
||||
t2[1] = 0x36363636;
|
||||
t2[2] = 0x36363636;
|
||||
t2[3] = 0x36363636;
|
||||
|
||||
u32 t3[4];
|
||||
|
||||
t3[0] = 0x36363636;
|
||||
t3[1] = 0x36363636;
|
||||
t3[2] = 0x36363636;
|
||||
t3[3] = 0x36363636;
|
||||
|
||||
u32 digest[5];
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
u32 key[8]; // 5 + 3 = 8 (20 bytes + 12 bytes = 32 bytes for the key)
|
||||
|
||||
key[0] = digest[0];
|
||||
key[1] = digest[1];
|
||||
key[2] = digest[2];
|
||||
key[3] = digest[3];
|
||||
key[4] = digest[4];
|
||||
|
||||
t0[0] = 0x5c5c5c5c ^ ctx.h[0];
|
||||
t0[1] = 0x5c5c5c5c ^ ctx.h[1];
|
||||
t0[2] = 0x5c5c5c5c ^ ctx.h[2];
|
||||
t0[3] = 0x5c5c5c5c ^ ctx.h[3];
|
||||
|
||||
t1[0] = 0x5c5c5c5c ^ ctx.h[4];
|
||||
t1[1] = 0x5c5c5c5c;
|
||||
t1[2] = 0x5c5c5c5c;
|
||||
t1[3] = 0x5c5c5c5c;
|
||||
|
||||
t2[0] = 0x5c5c5c5c;
|
||||
t2[1] = 0x5c5c5c5c;
|
||||
t2[2] = 0x5c5c5c5c;
|
||||
t2[3] = 0x5c5c5c5c;
|
||||
|
||||
t3[0] = 0x5c5c5c5c;
|
||||
t3[1] = 0x5c5c5c5c;
|
||||
t3[2] = 0x5c5c5c5c;
|
||||
t3[3] = 0x5c5c5c5c;
|
||||
|
||||
digest[0] = SHA1M_A;
|
||||
digest[1] = SHA1M_B;
|
||||
digest[2] = SHA1M_C;
|
||||
digest[3] = SHA1M_D;
|
||||
digest[4] = SHA1M_E;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
t0[0] = 0x80000000;
|
||||
t0[1] = 0;
|
||||
t0[2] = 0;
|
||||
t0[3] = 0;
|
||||
|
||||
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] = 64 * 8;
|
||||
|
||||
sha1_transform (t0, t1, t2, t3, digest);
|
||||
|
||||
key[5] = digest[0];
|
||||
key[6] = digest[1];
|
||||
key[7] = digest[2];
|
||||
|
||||
u32 iv[4];
|
||||
|
||||
iv[0] = esalt_bufs[digests_offset].data[28];
|
||||
iv[1] = esalt_bufs[digests_offset].data[29];
|
||||
iv[2] = esalt_bufs[digests_offset].data[30];
|
||||
iv[3] = esalt_bufs[digests_offset].data[31];
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = esalt_bufs[digests_offset].data[32];
|
||||
data[1] = esalt_bufs[digests_offset].data[33];
|
||||
data[2] = esalt_bufs[digests_offset].data[34];
|
||||
data[3] = esalt_bufs[digests_offset].data[35];
|
||||
|
||||
#define KEYLEN 60
|
||||
|
||||
u32 ks[KEYLEN];
|
||||
|
||||
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3);
|
||||
|
||||
u32 out[4];
|
||||
|
||||
aes256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
out[0] ^= iv[0];
|
||||
out[1] ^= iv[1];
|
||||
out[2] ^= iv[2];
|
||||
out[3] ^= iv[3];
|
||||
|
||||
if ((out[0] == 0x10101010) &&
|
||||
(out[1] == 0x10101010) &&
|
||||
(out[2] == 0x10101010) &&
|
||||
(out[3] == 0x10101010))
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -64,6 +64,9 @@
|
||||
- Added hash-mode: sha256($salt.$pass.$salt)
|
||||
- Added hash-mode: sha256(sha256_bin($pass))
|
||||
- Added hash-mode: sha256(sha256($pass).$salt)
|
||||
- Added hash-mode: SecureZIP AES-128
|
||||
- Added hash-mode: SecureZIP AES-192
|
||||
- Added hash-mode: SecureZIP AES-256
|
||||
- Added hash-mode: SolarWinds Orion
|
||||
- Added hash-mode: Telegram Desktop App Passcode (PBKDF2-HMAC-SHA1)
|
||||
- Added hash-mode: Telegram Mobile App Passcode (SHA256)
|
||||
@ -78,8 +81,9 @@
|
||||
|
||||
- Fixed buffer overflow in build_plain() function
|
||||
- Fixed buffer overflow in mp_add_cs_buf() function
|
||||
- Fixed copy/paste error leading to invalid "Integer overflow detected in keyspace of mask" in attack-mode 6 and 7
|
||||
- Fixed calculation of brain-session ID, only the first hash of the hashset was taken into account
|
||||
- Fixed cleanup of password candidate buffers on GPU set from autotune in case -n was used
|
||||
- Fixed copy/paste error leading to invalid "Integer overflow detected in keyspace of mask" in attack-mode 6 and 7
|
||||
- Fixed cracking multiple Office hashes (modes 9500, 9600) with the same salt
|
||||
- Fixed cracking of Blockchain, My Wallet (V1 and V2) hashes with unexpected decrypted data
|
||||
- Fixed cracking of Cisco-PIX and Cisco-ASA MD5 passwords in mask-attack mode if mask > length 16
|
||||
@ -101,9 +105,9 @@
|
||||
- Fixed race condition in maskfile mode by using a dedicated flag for restore execution
|
||||
- Fixed some memory leaks in case hashcat is shutting down due to some file error
|
||||
- Fixed some memory leaks in case mask-files are used in optimized mode
|
||||
- Fixed --status-json to correctly escape certain characters in hashes
|
||||
- Fixed the 7-Zip parser to allow the entire supported range of encrypted and decrypted data lengths
|
||||
- Fixed the validation of the --brain-client-features command line argument (only values 1, 2 or 3 are allowed)
|
||||
- Fixed --status-json to correctly escape certain characters in hashes
|
||||
|
||||
##
|
||||
## Improvements
|
||||
@ -118,7 +122,7 @@
|
||||
- File handling: Print a truncation warning when an oversized line is detected
|
||||
- My Wallet: Added additional plaintext pattern used in newer versions
|
||||
- Office cracking: Support hash format with second block data for 40-bit oldoffice files (eliminates false positives)
|
||||
- OpenCL Runtime: Added a warning if OpenCL runtime NEO, Beignet, POCL or MESA is detected and skip associated devices (override with --force)
|
||||
- OpenCL Runtime: Added a warning if OpenCL runtime NEO, Beignet, POCL (v1.4 or older) or MESA is detected and skip associated devices (override with --force)
|
||||
- OpenCL Runtime: Disable OpenCL kernel cache on Apple for Intel CPU (throws CL_BUILD_PROGRAM_FAILURE for no reason)
|
||||
- OpenCL Runtime: Do not run shared- and constant-memory size checks if their memory type is of type global memory (typically CPU)
|
||||
- OpenCL Runtime: Improve ROCm detection and make sure to not confuse with recent AMDGPU drivers
|
||||
|
@ -297,6 +297,9 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
|
||||
- PKZIP (Uncompressed)
|
||||
- PKZIP Master Key
|
||||
- PKZIP Master Key (6 byte optimization)
|
||||
- SecureZIP AES-128
|
||||
- SecureZIP AES-192
|
||||
- SecureZIP AES-256
|
||||
- iTunes backup < 10.0
|
||||
- iTunes backup >= 10.0
|
||||
- WinZip
|
||||
@ -344,6 +347,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
|
||||
- Apple
|
||||
- Intel
|
||||
- NVidia
|
||||
- POCL
|
||||
|
||||
##
|
||||
## Supported OpenCL device types
|
||||
|
@ -539,6 +539,7 @@ typedef enum parser_rc
|
||||
PARSER_BLOCK_SIZE = -39,
|
||||
PARSER_CIPHER = -40,
|
||||
PARSER_FILE_SIZE = -41,
|
||||
PARSER_HAVE_ERRNO = -100,
|
||||
PARSER_UNKNOWN_ERROR = -255
|
||||
|
||||
} parser_rc_t;
|
||||
|
398
src/autotune.c
398
src/autotune.c
@ -136,233 +136,227 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
device_param->kernel_accel = kernel_accel;
|
||||
device_param->kernel_loops = kernel_loops;
|
||||
|
||||
const u32 kernel_power = device_param->hardware_power * device_param->kernel_accel;
|
||||
|
||||
device_param->kernel_power = kernel_power;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// from here it's clear we are allowed to autotune
|
||||
// so let's init some fake words
|
||||
|
||||
const u32 kernel_power_max = device_param->hardware_power * kernel_accel_max;
|
||||
|
||||
int CL_rc;
|
||||
int CU_rc;
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
CU_rc = run_cuda_kernel_atinit (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, kernel_power_max);
|
||||
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = run_opencl_kernel_atinit (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, kernel_power_max);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
// from here it's clear we are allowed to autotune
|
||||
// so let's init some fake words
|
||||
|
||||
const u32 kernel_power_max = device_param->hardware_power * kernel_accel_max;
|
||||
|
||||
int CL_rc;
|
||||
int CU_rc;
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
if (straight_ctx->kernel_rules_cnt > 1)
|
||||
{
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
CU_rc = hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t));
|
||||
CU_rc = run_cuda_kernel_atinit (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, kernel_power_max);
|
||||
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do a pre-autotune test run to find out if kernel runtime is above some TDR limit
|
||||
|
||||
u32 kernel_loops_max_reduced = kernel_loops_max;
|
||||
|
||||
if (true)
|
||||
{
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min);
|
||||
|
||||
if (exec_msec > 2000)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Kernel minimum runtime larger than default TDR");
|
||||
|
||||
return -1;
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min);
|
||||
|
||||
const u32 mm = kernel_loops_max / kernel_loops_min;
|
||||
|
||||
if ((exec_msec * mm) > target_msec)
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
const u32 loops_valid = (const u32) (target_msec / exec_msec);
|
||||
CL_rc = run_opencl_kernel_atinit (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, kernel_power_max);
|
||||
|
||||
kernel_loops_max_reduced = kernel_loops_min * loops_valid;
|
||||
if (CL_rc == -1) return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// first find out highest kernel-loops that stays below target_msec
|
||||
|
||||
if (kernel_loops_min < kernel_loops_max)
|
||||
{
|
||||
for (kernel_loops = kernel_loops_max; kernel_loops > kernel_loops_min; kernel_loops >>= 1)
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
if (kernel_loops > kernel_loops_max_reduced) continue;
|
||||
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
||||
|
||||
if (exec_msec < target_msec) break;
|
||||
}
|
||||
}
|
||||
|
||||
// now the same for kernel-accel but with the new kernel-loops from previous loop set
|
||||
|
||||
#define STEPS_CNT 16
|
||||
|
||||
if (kernel_accel_min < kernel_accel_max)
|
||||
{
|
||||
for (int i = 0; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = 1U << i;
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
||||
|
||||
if (exec_msec > target_msec) break;
|
||||
|
||||
kernel_accel = kernel_accel_try;
|
||||
}
|
||||
}
|
||||
|
||||
// now find the middle balance between kernel_accel and kernel_loops
|
||||
// while respecting allowed ranges at the same time
|
||||
|
||||
if (kernel_accel < kernel_loops)
|
||||
{
|
||||
const u32 kernel_accel_orig = kernel_accel;
|
||||
const u32 kernel_loops_orig = kernel_loops;
|
||||
|
||||
double exec_msec_prev = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
for (int i = 1; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = kernel_accel_orig * (1U << i);
|
||||
const u32 kernel_loops_try = kernel_loops_orig / (1U << i);
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
||||
if (kernel_loops_try > kernel_loops_max) continue;
|
||||
if (kernel_loops_try < kernel_loops_min) break;
|
||||
|
||||
// do a real test
|
||||
|
||||
const double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
||||
|
||||
if (exec_msec_prev < exec_msec) break;
|
||||
|
||||
exec_msec_prev = exec_msec;
|
||||
|
||||
// so far, so good! save
|
||||
|
||||
kernel_accel = kernel_accel_try;
|
||||
kernel_loops = kernel_loops_try;
|
||||
|
||||
// too much if the next test is true
|
||||
|
||||
if (kernel_loops_try < kernel_accel_try) break;
|
||||
}
|
||||
}
|
||||
|
||||
double exec_msec_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
const u32 exec_left = (const u32) (target_msec / exec_msec_pre_final);
|
||||
|
||||
const u32 accel_left = kernel_accel_max / kernel_accel;
|
||||
|
||||
const u32 exec_accel_min = MIN (exec_left, accel_left); // we want that to be int
|
||||
|
||||
if (exec_accel_min >= 1)
|
||||
{
|
||||
// this is safe to not overflow kernel_accel_max because of accel_left
|
||||
|
||||
kernel_accel *= exec_accel_min;
|
||||
}
|
||||
|
||||
// start finding best thread count is easier.
|
||||
// it's either the preferred or the maximum thread count
|
||||
|
||||
/*
|
||||
const u32 kernel_threads_min = device_param->kernel_threads_min;
|
||||
const u32 kernel_threads_max = device_param->kernel_threads_max;
|
||||
|
||||
if (kernel_threads_min < kernel_threads_max)
|
||||
{
|
||||
const double exec_msec_max = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
u32 preferred_threads = 0;
|
||||
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
{
|
||||
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple1;
|
||||
}
|
||||
else
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple2;
|
||||
}
|
||||
|
||||
if ((preferred_threads >= kernel_threads_min) && (preferred_threads <= kernel_threads_max))
|
||||
{
|
||||
const double exec_msec_preferred = try_run_preferred (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
if (exec_msec_preferred < exec_msec_max)
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
{
|
||||
device_param->kernel_threads = preferred_threads;
|
||||
if (straight_ctx->kernel_rules_cnt > 1)
|
||||
{
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
CU_rc = hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t));
|
||||
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do a pre-autotune test run to find out if kernel runtime is above some TDR limit
|
||||
|
||||
u32 kernel_loops_max_reduced = kernel_loops_max;
|
||||
|
||||
if (true)
|
||||
{
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min);
|
||||
|
||||
if (exec_msec > 2000)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Kernel minimum runtime larger than default TDR");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min);
|
||||
|
||||
const u32 mm = kernel_loops_max / kernel_loops_min;
|
||||
|
||||
if ((exec_msec * mm) > target_msec)
|
||||
{
|
||||
const u32 loops_valid = (const u32) (target_msec / exec_msec);
|
||||
|
||||
kernel_loops_max_reduced = kernel_loops_min * loops_valid;
|
||||
}
|
||||
}
|
||||
|
||||
// first find out highest kernel-loops that stays below target_msec
|
||||
|
||||
if (kernel_loops_min < kernel_loops_max)
|
||||
{
|
||||
for (kernel_loops = kernel_loops_max; kernel_loops > kernel_loops_min; kernel_loops >>= 1)
|
||||
{
|
||||
if (kernel_loops > kernel_loops_max_reduced) continue;
|
||||
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
||||
|
||||
if (exec_msec < target_msec) break;
|
||||
}
|
||||
}
|
||||
|
||||
// now the same for kernel-accel but with the new kernel-loops from previous loop set
|
||||
|
||||
#define STEPS_CNT 16
|
||||
|
||||
if (kernel_accel_min < kernel_accel_max)
|
||||
{
|
||||
for (int i = 0; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = 1U << i;
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
||||
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
||||
|
||||
if (exec_msec > target_msec) break;
|
||||
|
||||
kernel_accel = kernel_accel_try;
|
||||
}
|
||||
}
|
||||
|
||||
// now find the middle balance between kernel_accel and kernel_loops
|
||||
// while respecting allowed ranges at the same time
|
||||
|
||||
if (kernel_accel < kernel_loops)
|
||||
{
|
||||
const u32 kernel_accel_orig = kernel_accel;
|
||||
const u32 kernel_loops_orig = kernel_loops;
|
||||
|
||||
double exec_msec_prev = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
for (int i = 1; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = kernel_accel_orig * (1U << i);
|
||||
const u32 kernel_loops_try = kernel_loops_orig / (1U << i);
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
||||
if (kernel_loops_try > kernel_loops_max) continue;
|
||||
if (kernel_loops_try < kernel_loops_min) break;
|
||||
|
||||
// do a real test
|
||||
|
||||
const double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
||||
|
||||
if (exec_msec_prev < exec_msec) break;
|
||||
|
||||
exec_msec_prev = exec_msec;
|
||||
|
||||
// so far, so good! save
|
||||
|
||||
kernel_accel = kernel_accel_try;
|
||||
kernel_loops = kernel_loops_try;
|
||||
|
||||
// too much if the next test is true
|
||||
|
||||
if (kernel_loops_try < kernel_accel_try) break;
|
||||
}
|
||||
}
|
||||
|
||||
double exec_msec_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
const u32 exec_left = (const u32) (target_msec / exec_msec_pre_final);
|
||||
|
||||
const u32 accel_left = kernel_accel_max / kernel_accel;
|
||||
|
||||
const u32 exec_accel_min = MIN (exec_left, accel_left); // we want that to be int
|
||||
|
||||
if (exec_accel_min >= 1)
|
||||
{
|
||||
// this is safe to not overflow kernel_accel_max because of accel_left
|
||||
|
||||
kernel_accel *= exec_accel_min;
|
||||
}
|
||||
|
||||
// start finding best thread count is easier.
|
||||
// it's either the preferred or the maximum thread count
|
||||
|
||||
/*
|
||||
const u32 kernel_threads_min = device_param->kernel_threads_min;
|
||||
const u32 kernel_threads_max = device_param->kernel_threads_max;
|
||||
|
||||
if (kernel_threads_min < kernel_threads_max)
|
||||
{
|
||||
const double exec_msec_max = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
u32 preferred_threads = 0;
|
||||
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
{
|
||||
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple1;
|
||||
}
|
||||
else
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preferred_threads = device_param->kernel_preferred_wgs_multiple2;
|
||||
}
|
||||
|
||||
if ((preferred_threads >= kernel_threads_min) && (preferred_threads <= kernel_threads_max))
|
||||
{
|
||||
const double exec_msec_preferred = try_run_preferred (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||
|
||||
if (exec_msec_preferred < exec_msec_max)
|
||||
{
|
||||
device_param->kernel_threads = preferred_threads;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
// reset them fake words
|
||||
// reset other buffers in case autotune cracked something
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
// reset them fake words
|
||||
int CU_rc;
|
||||
|
||||
CU_rc = run_cuda_kernel_memset (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, 0, device_param->size_pws);
|
||||
|
||||
if (CU_rc == -1) return -1;
|
||||
|
||||
// reset other buffers in case autotune cracked something
|
||||
|
||||
CU_rc = run_cuda_kernel_memset (hashcat_ctx, device_param, device_param->cuda_d_plain_bufs, 0, device_param->size_plains);
|
||||
|
||||
if (CU_rc == -1) return -1;
|
||||
@ -378,14 +372,12 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
// reset them fake words
|
||||
int CL_rc;
|
||||
|
||||
CL_rc = run_opencl_kernel_memset (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, 0, device_param->size_pws);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
|
||||
// reset other buffers in case autotune cracked something
|
||||
|
||||
CL_rc = run_opencl_kernel_memset (hashcat_ctx, device_param, device_param->opencl_d_plain_bufs, 0, device_param->size_plains);
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
|
136
src/backend.c
136
src/backend.c
@ -54,22 +54,16 @@ static int backend_ctx_find_alias_devices (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
||||
|
||||
// first identify all aliases
|
||||
|
||||
for (int backend_devices_cnt_src = 0; backend_devices_cnt_src < backend_ctx->backend_devices_cnt; backend_devices_cnt_src++)
|
||||
{
|
||||
hc_device_param_t *device_param_src = &backend_ctx->devices_param[backend_devices_cnt_src];
|
||||
|
||||
if (device_param_src->skipped == true) continue;
|
||||
|
||||
if (device_param_src->skipped_warning == true) continue;
|
||||
|
||||
for (int backend_devices_cnt_dst = backend_devices_cnt_src + 1; backend_devices_cnt_dst < backend_ctx->backend_devices_cnt; backend_devices_cnt_dst++)
|
||||
{
|
||||
hc_device_param_t *device_param_dst = &backend_ctx->devices_param[backend_devices_cnt_dst];
|
||||
|
||||
if (device_param_dst->skipped == true) continue;
|
||||
|
||||
if (device_param_dst->skipped_warning == true) continue;
|
||||
|
||||
if (is_same_device (device_param_src, device_param_dst) == false) continue;
|
||||
|
||||
device_param_src->device_id_alias_buf[device_param_src->device_id_alias_cnt] = device_param_dst->device_id;
|
||||
@ -77,18 +71,45 @@ static int backend_ctx_find_alias_devices (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
device_param_dst->device_id_alias_buf[device_param_dst->device_id_alias_cnt] = device_param_src->device_id;
|
||||
device_param_dst->device_id_alias_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (device_param_dst->is_opencl == true)
|
||||
// find the alias to skip
|
||||
|
||||
for (int backend_devices_pos = 0; backend_devices_pos < backend_ctx->backend_devices_cnt; backend_devices_pos++)
|
||||
{
|
||||
hc_device_param_t *backend_device = &backend_ctx->devices_param[backend_devices_pos];
|
||||
|
||||
if (backend_device->skipped == true) continue;
|
||||
|
||||
if (backend_device->skipped_warning == true) continue;
|
||||
|
||||
for (int device_id_alias_pos = 0; device_id_alias_pos < backend_device->device_id_alias_cnt; device_id_alias_pos++)
|
||||
{
|
||||
const int alias_pos = backend_device->device_id_alias_buf[device_id_alias_pos];
|
||||
|
||||
hc_device_param_t *alias_device = &backend_ctx->devices_param[alias_pos];
|
||||
|
||||
if (alias_device->skipped == true) continue;
|
||||
|
||||
if (alias_device->skipped_warning == true) continue;
|
||||
|
||||
// this lets CUDA devices survive over OpenCL
|
||||
|
||||
if (alias_device->is_cuda == true) continue;
|
||||
|
||||
// this lets native OpenCL runtime survive over generic OpenCL runtime
|
||||
|
||||
if (alias_device->opencl_device_type & CL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
if (device_param_dst->skipped == false)
|
||||
{
|
||||
device_param_dst->skipped = true;
|
||||
|
||||
backend_ctx->opencl_devices_active--;
|
||||
|
||||
backend_ctx->backend_devices_active--;
|
||||
}
|
||||
if (alias_device->opencl_platform_vendor_id == alias_device->opencl_device_vendor_id) continue;
|
||||
}
|
||||
|
||||
alias_device->skipped = true;
|
||||
|
||||
backend_ctx->opencl_devices_active--;
|
||||
|
||||
backend_ctx->backend_devices_active--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5972,23 +5993,61 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
device_param->device_local_mem_size = device_local_mem_size;
|
||||
|
||||
// If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
|
||||
// Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
|
||||
// This results in both utilizing it for 50%
|
||||
// However, Intel has much better SIMD control over their own hardware
|
||||
// It makes sense to give them full control over their own hardware
|
||||
// older POCL version and older LLVM versions are known to fail compiling kernels
|
||||
// we need to inform the user to update
|
||||
// https://github.com/hashcat/hashcat/issues/2344
|
||||
|
||||
if (opencl_device_type & CL_DEVICE_TYPE_CPU)
|
||||
if (opencl_platform_vendor_id == VENDOR_ID_POCL)
|
||||
{
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_INTEL)
|
||||
{
|
||||
if (user_options->force == false)
|
||||
{
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "* Device #%u: Not a native Intel OpenCL runtime. Expect massive speed loss.", device_id + 1);
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, " You can use --force to override, but do not report related errors.");
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, NULL);
|
||||
char *pocl_version_ptr = strstr (opencl_platform_version, "pocl ");
|
||||
char *llvm_version_ptr = strstr (opencl_platform_version, "LLVM ");
|
||||
|
||||
device_param->skipped = true;
|
||||
if ((pocl_version_ptr != NULL) && (llvm_version_ptr != NULL))
|
||||
{
|
||||
bool pocl_skip = false;
|
||||
|
||||
int pocl_maj = 0;
|
||||
int pocl_min = 0;
|
||||
|
||||
const int res1 = sscanf (pocl_version_ptr, "pocl %d.%d", &pocl_maj, &pocl_min);
|
||||
|
||||
if (res1 == 2)
|
||||
{
|
||||
const int pocl_version = (pocl_maj * 100) + pocl_min;
|
||||
|
||||
if (pocl_version < 105)
|
||||
{
|
||||
pocl_skip = true;
|
||||
}
|
||||
}
|
||||
|
||||
int llvm_maj = 0;
|
||||
int llvm_min = 0;
|
||||
|
||||
const int res2 = sscanf (llvm_version_ptr, "LLVM %d.%d", &llvm_maj, &llvm_min);
|
||||
|
||||
if (res2 == 2)
|
||||
{
|
||||
const int llvm_version = (llvm_maj * 100) + llvm_min;
|
||||
|
||||
if (llvm_version < 900)
|
||||
{
|
||||
pocl_skip = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pocl_skip == true)
|
||||
{
|
||||
if (user_options->force == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: Outdated POCL OpenCL driver detected!", device_id + 1);
|
||||
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "This OpenCL driver has been marked as likely to fail kernel compilation or to produce false negatives.");
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
||||
if (user_options->quiet == false) event_log_warning (hashcat_ctx, NULL);
|
||||
|
||||
device_param->skipped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6001,14 +6060,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|| (strstr (opencl_device_version_lower, " neo"))
|
||||
|| (strstr (opencl_device_version_lower, "beignet "))
|
||||
|| (strstr (opencl_device_version_lower, " beignet"))
|
||||
|| (strstr (opencl_device_version_lower, "pocl "))
|
||||
|| (strstr (opencl_device_version_lower, " pocl"))
|
||||
|| (strstr (opencl_device_version_lower, "mesa "))
|
||||
|| (strstr (opencl_device_version_lower, " mesa")))
|
||||
{
|
||||
// NEO: https://github.com/hashcat/hashcat/issues/2342
|
||||
// BEIGNET: https://github.com/hashcat/hashcat/issues/2243
|
||||
// POCL: https://github.com/hashcat/hashcat/issues/2344
|
||||
// MESA: https://github.com/hashcat/hashcat/issues/2269
|
||||
|
||||
if (user_options->force == false)
|
||||
@ -6262,7 +6318,9 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
if (r == 2)
|
||||
{
|
||||
if (version_maj >= 440)
|
||||
// nvidia 441.x looks ok
|
||||
|
||||
if (version_maj == 440)
|
||||
{
|
||||
if (version_min >= 64)
|
||||
{
|
||||
@ -6541,10 +6599,10 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
backend_ctx->backend_devices_cnt = cuda_devices_cnt + opencl_devices_cnt;
|
||||
backend_ctx->backend_devices_active = cuda_devices_active + opencl_devices_active;
|
||||
|
||||
// find duplicate devices (typically CUDA and OpenCL)
|
||||
// find duplicate devices
|
||||
|
||||
if ((cuda_devices_cnt > 0) && (opencl_devices_cnt > 0))
|
||||
{
|
||||
//if ((cuda_devices_cnt > 0) && (opencl_devices_cnt > 0))
|
||||
//{
|
||||
// using force here enables both devices, which is the worst possible outcome
|
||||
// many users force by default, so this is not a good idea
|
||||
|
||||
@ -6552,7 +6610,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
//{
|
||||
backend_ctx_find_alias_devices (hashcat_ctx);
|
||||
//{
|
||||
}
|
||||
//}
|
||||
|
||||
if (backend_ctx->backend_devices_active == 0)
|
||||
{
|
||||
|
@ -1486,12 +1486,14 @@ bool brain_server_read_hash_dumps (brain_server_dbs_t *brain_server_dbs, const c
|
||||
{
|
||||
brain_server_dbs->hash_cnt = 0;
|
||||
|
||||
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
if (chdir (path) == -1)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", path, strerror (errno));
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
DIR *dirp = opendir (path);
|
||||
|
||||
@ -1683,12 +1685,14 @@ bool brain_server_read_attack_dumps (brain_server_dbs_t *brain_server_dbs, const
|
||||
{
|
||||
brain_server_dbs->attack_cnt = 0;
|
||||
|
||||
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
if (chdir (path) == -1)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", path, strerror (errno));
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
DIR *dirp = opendir (path);
|
||||
|
||||
|
@ -72,7 +72,7 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode)
|
||||
{
|
||||
lseek (fd_tmp, 0, SEEK_SET);
|
||||
|
||||
if (read (fd_tmp, check, sizeof(check)) > 0)
|
||||
if (read (fd_tmp, check, sizeof (check)) > 0)
|
||||
{
|
||||
if (check[0] == 0x1f && check[1] == 0x8b && check[2] == 0x08 && check[3] == 0x08) fp->is_gzip = true;
|
||||
if (check[0] == 0x50 && check[1] == 0x4b && check[2] == 0x03 && check[3] == 0x04) fp->is_zip = true;
|
||||
@ -131,7 +131,47 @@ size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined (_WIN)
|
||||
|
||||
// 4 GB fread () limit for windows systems ?
|
||||
// see: https://social.msdn.microsoft.com/Forums/vstudio/en-US/7c913001-227e-439b-bf07-54369ba07994/fwrite-issues-with-large-data-write
|
||||
|
||||
#define GIGABYTE (1024u * 1024u * 1024u)
|
||||
|
||||
if (((size * nmemb) / GIGABYTE) < 4)
|
||||
{
|
||||
n = fread (ptr, size, nmemb, fp->pfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((size / GIGABYTE) > 3) return -1;
|
||||
|
||||
size_t elements_max = (3u * GIGABYTE) / size;
|
||||
size_t elements_left = nmemb;
|
||||
|
||||
size_t off = 0;
|
||||
|
||||
n = 0;
|
||||
|
||||
while (elements_left > 0)
|
||||
{
|
||||
size_t elements_cur = elements_max;
|
||||
|
||||
if (elements_left < elements_max) elements_cur = elements_left;
|
||||
|
||||
size_t ret = fread (ptr + off, size, elements_cur, fp->pfp);
|
||||
|
||||
if (ret != elements_cur) return -1;
|
||||
|
||||
n += ret;
|
||||
off += ret * size;
|
||||
|
||||
elements_left -= ret;
|
||||
}
|
||||
}
|
||||
#else
|
||||
n = fread (ptr, size, nmemb, fp->pfp);
|
||||
#endif
|
||||
}
|
||||
|
||||
return n;
|
||||
@ -152,10 +192,48 @@ size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
||||
}
|
||||
else
|
||||
{
|
||||
n = fwrite (ptr, size, nmemb, fp->pfp);
|
||||
}
|
||||
#if defined (_WIN)
|
||||
|
||||
if (n != nmemb) return -1;
|
||||
// 4 GB fwrite () limit for windows systems ?
|
||||
// see: https://social.msdn.microsoft.com/Forums/vstudio/en-US/7c913001-227e-439b-bf07-54369ba07994/fwrite-issues-with-large-data-write
|
||||
|
||||
#define GIGABYTE (1024u * 1024u * 1024u)
|
||||
|
||||
if (((size * nmemb) / GIGABYTE) < 4)
|
||||
{
|
||||
n = fwrite (ptr, size, nmemb, fp->pfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((size / GIGABYTE) > 3) return -1;
|
||||
|
||||
size_t elements_max = (3u * GIGABYTE) / size;
|
||||
size_t elements_left = nmemb;
|
||||
|
||||
size_t off = 0;
|
||||
|
||||
n = 0;
|
||||
|
||||
while (elements_left > 0)
|
||||
{
|
||||
size_t elements_cur = elements_max;
|
||||
|
||||
if (elements_left < elements_max) elements_cur = elements_left;
|
||||
|
||||
size_t ret = fwrite (ptr + off, size, elements_cur, fp->pfp);
|
||||
|
||||
if (ret != elements_cur) return -1;
|
||||
|
||||
n += ret;
|
||||
off += ret * size;
|
||||
|
||||
elements_left -= ret;
|
||||
}
|
||||
}
|
||||
#else
|
||||
n = fwrite (ptr, size, nmemb, fp->pfp);
|
||||
#endif
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -258,6 +258,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
|
||||
* A workaround is to chdir() to the OpenCL folder,
|
||||
* then compile the kernels,
|
||||
* then chdir() back to where we came from so we need to save it first
|
||||
* - temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
*/
|
||||
|
||||
char *cwd = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
@ -450,6 +451,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
|
||||
hcfree (cpath);
|
||||
|
||||
//if (getenv ("TMP") == NULL)
|
||||
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
if (true)
|
||||
{
|
||||
char *tmp;
|
||||
@ -458,6 +460,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
|
||||
|
||||
putenv (tmp);
|
||||
}
|
||||
*/
|
||||
|
||||
#if defined (_WIN)
|
||||
|
||||
|
43
src/hashes.c
43
src/hashes.c
@ -182,8 +182,8 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", new_hashfile, strerror (errno));
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -194,8 +194,8 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
event_log_error (hashcat_ctx, "%s: %s", new_hashfile, strerror (errno));
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -256,8 +256,8 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
event_log_error (hashcat_ctx, "%s: %s", new_hashfile, strerror (errno));
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -270,8 +270,8 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Rename file '%s' to '%s': %s", hashfile, old_hashfile, strerror (errno));
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -282,16 +282,16 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Rename file '%s' to '%s': %s", new_hashfile, hashfile, strerror (errno));
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
unlink (old_hashfile);
|
||||
|
||||
free (new_hashfile);
|
||||
free (old_hashfile);
|
||||
hcfree (new_hashfile);
|
||||
hcfree (old_hashfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -735,21 +735,28 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const int binary_count = module_ctx->module_hash_binary_count (hashes);
|
||||
|
||||
if (binary_count == 0)
|
||||
if (binary_count > 0)
|
||||
{
|
||||
hashes_avail = binary_count;
|
||||
}
|
||||
else if (binary_count == 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "No hashes loaded.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (binary_count == -1)
|
||||
else if (binary_count == PARSER_HAVE_ERRNO)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (binary_count));
|
||||
|
||||
hashes_avail = binary_count;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1289,6 +1296,10 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
hashes_cnt = hashes_parsed;
|
||||
}
|
||||
else if (hashes_parsed == 0)
|
||||
{
|
||||
event_log_warning (hashcat_ctx, "No hashes loaded.");
|
||||
}
|
||||
else if (hashes_parsed == PARSER_HAVE_ERRNO)
|
||||
{
|
||||
event_log_warning (hashcat_ctx, "Hashfile '%s': %s", hashes->hashfile, strerror (errno));
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, u32 max_check)
|
||||
hashlist_format = i;
|
||||
}
|
||||
|
||||
free (formats_cnt);
|
||||
hcfree (formats_cnt);
|
||||
|
||||
return hashlist_format;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
char *in = (char *) hcmalloc (sizeof (hccapx_t));
|
||||
|
||||
@ -467,7 +467,7 @@ int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat (hashes->hashfile, &st) == -1) return -1;
|
||||
if (stat (hashes->hashfile, &st) == -1) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
return st.st_size / sizeof (hccapx_t);
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
char *in = (char *) hcmalloc (sizeof (hccapx_t));
|
||||
|
||||
@ -442,7 +442,7 @@ int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat (hashes->hashfile, &st) == -1) return -1;
|
||||
if (stat (hashes->hashfile, &st) == -1) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
return st.st_size / sizeof (hccapx_t);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -199,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -155,7 +155,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -199,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -153,7 +153,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -197,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -137,7 +137,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -137,7 +137,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -135,7 +135,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -179,7 +179,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -136,7 +136,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -136,7 +136,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -136,7 +136,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -149,7 +149,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -193,7 +193,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -149,7 +149,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -193,7 +193,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -149,7 +149,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
@ -193,7 +193,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -210,7 +210,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -210,7 +210,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -210,7 +210,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -165,7 +165,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -209,7 +209,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -167,7 +167,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -211,7 +211,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -167,7 +167,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -211,7 +211,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -167,7 +167,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -211,7 +211,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -228,7 +228,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -228,7 +228,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -228,7 +228,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -186,7 +186,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -230,7 +230,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -186,7 +186,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -230,7 +230,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -186,7 +186,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -230,7 +230,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -169,7 +169,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -213,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -169,7 +169,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -213,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -169,7 +169,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
@ -213,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
keyfile = strtok_r ((char *) NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free (keyfiles);
|
||||
hcfree (keyfiles);
|
||||
}
|
||||
|
||||
// keyboard layout mapping
|
||||
|
@ -178,6 +178,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[2] = 0;
|
||||
salt->salt_buf[3] = 0;
|
||||
|
||||
salt->salt_len = 8;
|
||||
|
||||
salt->salt_buf_pc[0] = salt->salt_buf[0];
|
||||
salt->salt_buf_pc[1] = salt->salt_buf[1];
|
||||
|
||||
|
@ -139,6 +139,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[2] = 0;
|
||||
salt->salt_buf[3] = 0;
|
||||
|
||||
salt->salt_len = 8;
|
||||
|
||||
salt->salt_buf_pc[0] = salt->salt_buf[0];
|
||||
salt->salt_buf_pc[1] = salt->salt_buf[1];
|
||||
|
||||
|
@ -26,8 +26,8 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_SELF_TEST_DISABLE
|
||||
| OPTS_TYPE_BINARY_HASHFILE;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "tbd";
|
||||
static const char *ST_PASS = NULL;
|
||||
static const char *ST_HASH = NULL;
|
||||
|
||||
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
|
||||
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
|
||||
@ -377,7 +377,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
struct luks_phdr hdr;
|
||||
|
||||
|
@ -197,9 +197,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
// alias
|
||||
|
||||
const u8 *alias_pos = token.buf[6];
|
||||
|
||||
strncpy ((char *) jks_sha1->alias, (const char *) alias_pos, 64);
|
||||
memcpy ((char *) jks_sha1->alias, (const char *) token.buf[6], token.len[6]);
|
||||
|
||||
// fake salt
|
||||
|
||||
@ -237,6 +235,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
u8 *der = (u8 *) jks_sha1->der;
|
||||
|
||||
char alias[65] = { 0 };
|
||||
|
||||
memcpy (alias, (char *) jks_sha1->alias, 64);
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s*%08X%08X%08X%08X%08X*%08X%08X%08X%08X%08X*%s*%02X*%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X*%s",
|
||||
SIGNATURE_JKS_SHA1,
|
||||
byte_swap_32 (jks_sha1->checksum[0]),
|
||||
@ -265,7 +267,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
der[17],
|
||||
der[18],
|
||||
der[19],
|
||||
(char *) jks_sha1->alias
|
||||
alias
|
||||
);
|
||||
|
||||
return line_len;
|
||||
|
@ -242,6 +242,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[1] = krb5tgs->checksum[1];
|
||||
salt->salt_buf[2] = krb5tgs->checksum[2];
|
||||
|
||||
salt->salt_len = 12;
|
||||
|
||||
salt->salt_iter = 4096 - 1;
|
||||
|
||||
digest[0] = krb5tgs->checksum[0];
|
||||
|
@ -242,6 +242,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[1] = krb5tgs->checksum[1];
|
||||
salt->salt_buf[2] = krb5tgs->checksum[2];
|
||||
|
||||
salt->salt_len = 12;
|
||||
|
||||
salt->salt_iter = 4096 - 1;
|
||||
|
||||
digest[0] = krb5tgs->checksum[0];
|
||||
|
@ -188,6 +188,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[1] = krb5pa->checksum[1];
|
||||
salt->salt_buf[2] = krb5pa->checksum[2];
|
||||
|
||||
salt->salt_len = 12;
|
||||
|
||||
salt->salt_iter = 4096 - 1;
|
||||
|
||||
digest[0] = krb5pa->checksum[0];
|
||||
|
@ -188,6 +188,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
salt->salt_buf[1] = krb5pa->checksum[1];
|
||||
salt->salt_buf[2] = krb5pa->checksum[2];
|
||||
|
||||
salt->salt_len = 12;
|
||||
|
||||
salt->salt_iter = 4096 - 1;
|
||||
|
||||
digest[0] = krb5pa->checksum[0];
|
||||
|
@ -171,7 +171,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
const bool r = is_hccapx (&fp);
|
||||
|
||||
@ -258,7 +258,7 @@ int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
const bool r = is_hccapx (&fp);
|
||||
|
||||
|
@ -172,7 +172,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
const bool r = is_hccapx (&fp);
|
||||
|
||||
@ -259,7 +259,7 @@ int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO);
|
||||
|
||||
const bool r = is_hccapx (&fp);
|
||||
|
||||
|
315
src/modules/module_23001.c
Normal file
315
src/modules/module_23001.c
Normal file
@ -0,0 +1,315 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "modules.h"
|
||||
#include "bitops.h"
|
||||
#include "convert.h"
|
||||
#include "shared.h"
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 0;
|
||||
static const u32 DGST_POS1 = 1;
|
||||
static const u32 DGST_POS2 = 2;
|
||||
static const u32 DGST_POS3 = 3;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_4;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "SecureZIP AES-128";
|
||||
static const u64 KERN_TYPE = 23001;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_PRECOMPUTE_INIT
|
||||
| OPTI_TYPE_NOT_ITERATED
|
||||
| OPTI_TYPE_NOT_SALTED;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE
|
||||
| OPTS_TYPE_PT_ADD80
|
||||
| OPTS_TYPE_PT_ADDBITS15;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$zip3$*0*1*128*0*b4630625c92b6e7848f6fd86*df2f62611b3d02d2c7e05a48dad57c7d93b0bac1362261ab533807afb69db856676aa6e350320130b5cbf27c55a48c0f75739654ac312f1cf5c37149557fc88a92c7e3dde8d23edd2b839036e88092a708b7e818bf1b6de92f0efb5cce184cceb11db6b3ca0527d0bdf1f1137ee6660d9890928cd80542ac1f439515519147c14d965b5ba107c6227f971e3e115170bf*0*0*0*file.txt";
|
||||
|
||||
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
|
||||
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
|
||||
u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; }
|
||||
u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; }
|
||||
u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; }
|
||||
u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; }
|
||||
u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; }
|
||||
const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; }
|
||||
u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; }
|
||||
u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; }
|
||||
u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; }
|
||||
u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; }
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
static const char *SIGNATURE_SECUREZIP = "$zip3$";
|
||||
|
||||
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
const u64 esalt_size = (const u64) sizeof (securezip_t);
|
||||
|
||||
return esalt_size;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
securezip_t *securezip = (securezip_t *) esalt_buf;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 11;
|
||||
|
||||
token.signatures_cnt = 1;
|
||||
token.signatures_buf[0] = SIGNATURE_SECUREZIP;
|
||||
|
||||
token.len_min[0] = 6;
|
||||
token.len_max[0] = 6;
|
||||
token.sep[0] = '*';
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_SIGNATURE;
|
||||
|
||||
token.len_min[1] = 1;
|
||||
token.len_max[1] = 1;
|
||||
token.sep[1] = '*';
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[2] = 1;
|
||||
token.len_max[2] = 1;
|
||||
token.sep[2] = '*';
|
||||
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[3] = 3;
|
||||
token.len_max[3] = 3;
|
||||
token.sep[3] = '*';
|
||||
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[4] = 1;
|
||||
token.len_max[4] = 1;
|
||||
token.sep[4] = '*';
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[5] = 0;
|
||||
token.len_max[5] = 32;
|
||||
token.sep[5] = '*';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[6] = 288;
|
||||
token.len_max[6] = 288;
|
||||
token.sep[6] = '*';
|
||||
token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[7] = 1;
|
||||
token.len_max[7] = 1;
|
||||
token.sep[7] = '*';
|
||||
token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[8] = 1;
|
||||
token.len_max[8] = 1;
|
||||
token.sep[8] = '*';
|
||||
token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[9] = 1;
|
||||
token.len_max[9] = 1;
|
||||
token.sep[9] = '*';
|
||||
token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[10] = 0;
|
||||
token.len_max[10] = 64;
|
||||
token.sep[10] = '*';
|
||||
token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
const u8 *version_pos = token.buf[ 1];
|
||||
const u8 *type_pos = token.buf[ 2];
|
||||
const u8 *bit_len_pos = token.buf[ 3];
|
||||
const u8 *unused1_pos = token.buf[ 4];
|
||||
const u8 *iv_pos = token.buf[ 5];
|
||||
const u8 *data_pos = token.buf[ 6];
|
||||
const u8 *unused2_pos = token.buf[ 7];
|
||||
const u8 *unused3_pos = token.buf[ 8];
|
||||
const u8 *unused4_pos = token.buf[ 9];
|
||||
const u8 *file_pos = token.buf[10];
|
||||
|
||||
if (version_pos[0] != '0') return (PARSER_HASH_ENCODING); // version 0
|
||||
if (type_pos[0] != '1') return (PARSER_HASH_ENCODING); // AES
|
||||
|
||||
const u32 bit_len = hc_strtoul ((const char *) bit_len_pos, NULL, 10);
|
||||
|
||||
if (bit_len != 128) return (PARSER_HASH_ENCODING);
|
||||
|
||||
if (unused1_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused2_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused3_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused4_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
|
||||
// IV:
|
||||
|
||||
u8 *iv = (u8 *) securezip->iv;
|
||||
|
||||
securezip->iv_len = hex_decode (iv_pos, token.len[5], iv);
|
||||
|
||||
// data:
|
||||
|
||||
u32 *data = securezip->data;
|
||||
|
||||
hex_decode (data_pos, token.len[6], (u8 *) data);
|
||||
|
||||
// file:
|
||||
|
||||
u8 *file = (u8 *) securezip->file;
|
||||
|
||||
memcpy (file, file_pos, token.len[10]);
|
||||
|
||||
file[63] = 0;
|
||||
|
||||
// fake salt:
|
||||
|
||||
salt->salt_buf[0] = iv[0];
|
||||
salt->salt_buf[1] = iv[1];
|
||||
salt->salt_buf[2] = iv[2];
|
||||
salt->salt_buf[3] = iv[3];
|
||||
|
||||
salt->salt_len = 16;
|
||||
|
||||
// fake digest:
|
||||
|
||||
digest[0] = data[0];
|
||||
digest[1] = data[1];
|
||||
digest[2] = data[2];
|
||||
digest[3] = data[3];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
const securezip_t *securezip = (const securezip_t *) esalt_buf;
|
||||
|
||||
// IV:
|
||||
|
||||
u8 iv[33] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->iv, securezip->iv_len, iv);
|
||||
|
||||
// data:
|
||||
|
||||
u8 data[289] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->data, 144, data);
|
||||
|
||||
// file:
|
||||
|
||||
const u8 *file_ptr = (const u8 *) securezip->file;
|
||||
|
||||
u8 file[65] = { 0 };
|
||||
|
||||
memcpy (file, file_ptr, 64);
|
||||
|
||||
int out_len = snprintf (line_buf, line_size, "%s*0*1*128*0*%s*%s*0*0*0*%s",
|
||||
SIGNATURE_SECUREZIP,
|
||||
iv,
|
||||
data,
|
||||
file
|
||||
);
|
||||
|
||||
return out_len;
|
||||
}
|
||||
|
||||
void module_init (module_ctx_t *module_ctx)
|
||||
{
|
||||
module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT;
|
||||
module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT;
|
||||
|
||||
module_ctx->module_attack_exec = module_attack_exec;
|
||||
module_ctx->module_benchmark_esalt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_mask = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_build_plain_postprocess = MODULE_DEFAULT;
|
||||
module_ctx->module_deep_comp_kernel = MODULE_DEFAULT;
|
||||
module_ctx->module_dgst_pos0 = module_dgst_pos0;
|
||||
module_ctx->module_dgst_pos1 = module_dgst_pos1;
|
||||
module_ctx->module_dgst_pos2 = module_dgst_pos2;
|
||||
module_ctx->module_dgst_pos3 = module_dgst_pos3;
|
||||
module_ctx->module_dgst_size = module_dgst_size;
|
||||
module_ctx->module_dictstat_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_esalt_size = module_esalt_size;
|
||||
module_ctx->module_extra_buffer_size = MODULE_DEFAULT;
|
||||
module_ctx->module_extra_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_forced_outfile_format = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_count = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_parse = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_save = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode = module_hash_decode;
|
||||
module_ctx->module_hash_encode_status = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode = module_hash_encode;
|
||||
module_ctx->module_hash_init_selftest = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_mode = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_category = module_hash_category;
|
||||
module_ctx->module_hash_name = module_hash_name;
|
||||
module_ctx->module_hashes_count_min = MODULE_DEFAULT;
|
||||
module_ctx->module_hashes_count_max = MODULE_DEFAULT;
|
||||
module_ctx->module_hlfmt_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_hook12 = MODULE_DEFAULT;
|
||||
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_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;
|
||||
module_ctx->module_kernel_loops_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_loops_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kern_type = module_kern_type;
|
||||
module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;
|
||||
module_ctx->module_opti_type = module_opti_type;
|
||||
module_ctx->module_opts_type = module_opts_type;
|
||||
module_ctx->module_outfile_check_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_custom_check = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
|
||||
module_ctx->module_pwdump_column = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_max = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_max = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_type = module_salt_type;
|
||||
module_ctx->module_separator = MODULE_DEFAULT;
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
315
src/modules/module_23002.c
Normal file
315
src/modules/module_23002.c
Normal file
@ -0,0 +1,315 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "modules.h"
|
||||
#include "bitops.h"
|
||||
#include "convert.h"
|
||||
#include "shared.h"
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 0;
|
||||
static const u32 DGST_POS1 = 1;
|
||||
static const u32 DGST_POS2 = 2;
|
||||
static const u32 DGST_POS3 = 3;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_4;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "SecureZIP AES-192";
|
||||
static const u64 KERN_TYPE = 23002;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_PRECOMPUTE_INIT
|
||||
| OPTI_TYPE_NOT_ITERATED
|
||||
| OPTI_TYPE_NOT_SALTED;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE
|
||||
| OPTS_TYPE_PT_ADD80
|
||||
| OPTS_TYPE_PT_ADDBITS15;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$zip3$*0*1*192*0*53ff2de8c280778e1e0ab997*603eb37dbab9ea109e2c405e37d8cae1ec89e1e0d0b9ce5bf55d1b571c343b6a3df35fe381c30249cb0738a9b956ba8e52dfc5552894296300446a771032776c811ff8a71d9bb3c4d6c37016c027e41fea2d157d5b0ce17804b1d7c1606b7c1121d37851bd705e001f2cd755bbf305966d129a17c1d48ff8e87cfa41f479090cd456527db7d1d43f9020ad8e73f851a5*0*0*0*file.txt";
|
||||
|
||||
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
|
||||
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
|
||||
u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; }
|
||||
u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; }
|
||||
u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; }
|
||||
u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; }
|
||||
u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; }
|
||||
const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; }
|
||||
u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; }
|
||||
u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; }
|
||||
u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; }
|
||||
u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; }
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
static const char *SIGNATURE_SECUREZIP = "$zip3$";
|
||||
|
||||
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
const u64 esalt_size = (const u64) sizeof (securezip_t);
|
||||
|
||||
return esalt_size;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
securezip_t *securezip = (securezip_t *) esalt_buf;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 11;
|
||||
|
||||
token.signatures_cnt = 1;
|
||||
token.signatures_buf[0] = SIGNATURE_SECUREZIP;
|
||||
|
||||
token.len_min[0] = 6;
|
||||
token.len_max[0] = 6;
|
||||
token.sep[0] = '*';
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_SIGNATURE;
|
||||
|
||||
token.len_min[1] = 1;
|
||||
token.len_max[1] = 1;
|
||||
token.sep[1] = '*';
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[2] = 1;
|
||||
token.len_max[2] = 1;
|
||||
token.sep[2] = '*';
|
||||
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[3] = 3;
|
||||
token.len_max[3] = 3;
|
||||
token.sep[3] = '*';
|
||||
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[4] = 1;
|
||||
token.len_max[4] = 1;
|
||||
token.sep[4] = '*';
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[5] = 0;
|
||||
token.len_max[5] = 32;
|
||||
token.sep[5] = '*';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[6] = 288;
|
||||
token.len_max[6] = 288;
|
||||
token.sep[6] = '*';
|
||||
token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[7] = 1;
|
||||
token.len_max[7] = 1;
|
||||
token.sep[7] = '*';
|
||||
token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[8] = 1;
|
||||
token.len_max[8] = 1;
|
||||
token.sep[8] = '*';
|
||||
token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[9] = 1;
|
||||
token.len_max[9] = 1;
|
||||
token.sep[9] = '*';
|
||||
token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[10] = 0;
|
||||
token.len_max[10] = 64;
|
||||
token.sep[10] = '*';
|
||||
token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
const u8 *version_pos = token.buf[ 1];
|
||||
const u8 *type_pos = token.buf[ 2];
|
||||
const u8 *bit_len_pos = token.buf[ 3];
|
||||
const u8 *unused1_pos = token.buf[ 4];
|
||||
const u8 *iv_pos = token.buf[ 5];
|
||||
const u8 *data_pos = token.buf[ 6];
|
||||
const u8 *unused2_pos = token.buf[ 7];
|
||||
const u8 *unused3_pos = token.buf[ 8];
|
||||
const u8 *unused4_pos = token.buf[ 9];
|
||||
const u8 *file_pos = token.buf[10];
|
||||
|
||||
if (version_pos[0] != '0') return (PARSER_HASH_ENCODING); // version 0
|
||||
if (type_pos[0] != '1') return (PARSER_HASH_ENCODING); // AES
|
||||
|
||||
const u32 bit_len = hc_strtoul ((const char *) bit_len_pos, NULL, 10);
|
||||
|
||||
if (bit_len != 192) return (PARSER_HASH_ENCODING);
|
||||
|
||||
if (unused1_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused2_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused3_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused4_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
|
||||
// IV:
|
||||
|
||||
u8 *iv = (u8 *) securezip->iv;
|
||||
|
||||
securezip->iv_len = hex_decode (iv_pos, token.len[5], iv);
|
||||
|
||||
// data:
|
||||
|
||||
u32 *data = securezip->data;
|
||||
|
||||
hex_decode (data_pos, token.len[6], (u8 *) data);
|
||||
|
||||
// file:
|
||||
|
||||
u8 *file = (u8 *) securezip->file;
|
||||
|
||||
memcpy (file, file_pos, token.len[10]);
|
||||
|
||||
file[63] = 0;
|
||||
|
||||
// fake salt:
|
||||
|
||||
salt->salt_buf[0] = iv[0];
|
||||
salt->salt_buf[1] = iv[1];
|
||||
salt->salt_buf[2] = iv[2];
|
||||
salt->salt_buf[3] = iv[3];
|
||||
|
||||
salt->salt_len = 16;
|
||||
|
||||
// fake digest:
|
||||
|
||||
digest[0] = data[0];
|
||||
digest[1] = data[1];
|
||||
digest[2] = data[2];
|
||||
digest[3] = data[3];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
const securezip_t *securezip = (const securezip_t *) esalt_buf;
|
||||
|
||||
// IV:
|
||||
|
||||
u8 iv[33] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->iv, securezip->iv_len, iv);
|
||||
|
||||
// data:
|
||||
|
||||
u8 data[289] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->data, 144, data);
|
||||
|
||||
// file:
|
||||
|
||||
const u8 *file_ptr = (const u8 *) securezip->file;
|
||||
|
||||
u8 file[65] = { 0 };
|
||||
|
||||
memcpy (file, file_ptr, 64);
|
||||
|
||||
int out_len = snprintf (line_buf, line_size, "%s*0*1*192*0*%s*%s*0*0*0*%s",
|
||||
SIGNATURE_SECUREZIP,
|
||||
iv,
|
||||
data,
|
||||
file
|
||||
);
|
||||
|
||||
return out_len;
|
||||
}
|
||||
|
||||
void module_init (module_ctx_t *module_ctx)
|
||||
{
|
||||
module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT;
|
||||
module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT;
|
||||
|
||||
module_ctx->module_attack_exec = module_attack_exec;
|
||||
module_ctx->module_benchmark_esalt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_mask = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_build_plain_postprocess = MODULE_DEFAULT;
|
||||
module_ctx->module_deep_comp_kernel = MODULE_DEFAULT;
|
||||
module_ctx->module_dgst_pos0 = module_dgst_pos0;
|
||||
module_ctx->module_dgst_pos1 = module_dgst_pos1;
|
||||
module_ctx->module_dgst_pos2 = module_dgst_pos2;
|
||||
module_ctx->module_dgst_pos3 = module_dgst_pos3;
|
||||
module_ctx->module_dgst_size = module_dgst_size;
|
||||
module_ctx->module_dictstat_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_esalt_size = module_esalt_size;
|
||||
module_ctx->module_extra_buffer_size = MODULE_DEFAULT;
|
||||
module_ctx->module_extra_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_forced_outfile_format = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_count = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_parse = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_save = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode = module_hash_decode;
|
||||
module_ctx->module_hash_encode_status = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode = module_hash_encode;
|
||||
module_ctx->module_hash_init_selftest = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_mode = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_category = module_hash_category;
|
||||
module_ctx->module_hash_name = module_hash_name;
|
||||
module_ctx->module_hashes_count_min = MODULE_DEFAULT;
|
||||
module_ctx->module_hashes_count_max = MODULE_DEFAULT;
|
||||
module_ctx->module_hlfmt_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_hook12 = MODULE_DEFAULT;
|
||||
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_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;
|
||||
module_ctx->module_kernel_loops_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_loops_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kern_type = module_kern_type;
|
||||
module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;
|
||||
module_ctx->module_opti_type = module_opti_type;
|
||||
module_ctx->module_opts_type = module_opts_type;
|
||||
module_ctx->module_outfile_check_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_custom_check = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
|
||||
module_ctx->module_pwdump_column = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_max = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_max = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_type = module_salt_type;
|
||||
module_ctx->module_separator = MODULE_DEFAULT;
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
315
src/modules/module_23003.c
Normal file
315
src/modules/module_23003.c
Normal file
@ -0,0 +1,315 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "modules.h"
|
||||
#include "bitops.h"
|
||||
#include "convert.h"
|
||||
#include "shared.h"
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 0;
|
||||
static const u32 DGST_POS1 = 1;
|
||||
static const u32 DGST_POS2 = 2;
|
||||
static const u32 DGST_POS3 = 3;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_4;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "SecureZIP AES-256";
|
||||
static const u64 KERN_TYPE = 23003;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_PRECOMPUTE_INIT
|
||||
| OPTI_TYPE_NOT_ITERATED
|
||||
| OPTI_TYPE_NOT_SALTED;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE
|
||||
| OPTS_TYPE_PT_ADD80
|
||||
| OPTS_TYPE_PT_ADDBITS15;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$zip3$*0*1*256*0*39bff47df6152a0214d7a967*65ff418ffb3b1198cccdef0327c03750f328d6dd5287e00e4c467f33b92a6ef40a74bb11b5afad61a6c3c9b279d8bd7961e96af7b470c36fc186fd3cfe059107021c9dea0cf206692f727eeca71f18f5b0b6ee1f702b648bba01aa21c7b7f3f0f7d547838aad46868155a04214f22feef7b31d7a15e1abe6dba5e569c62ee640783bb4a54054c2c69e93ece9f1a2af9d*0*0*0*file.txt";
|
||||
|
||||
u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; }
|
||||
u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; }
|
||||
u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; }
|
||||
u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; }
|
||||
u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; }
|
||||
u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; }
|
||||
u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; }
|
||||
const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; }
|
||||
u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; }
|
||||
u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; }
|
||||
u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; }
|
||||
u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; }
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
typedef struct securezip
|
||||
{
|
||||
u32 data[36];
|
||||
u32 file[16];
|
||||
u32 iv[4];
|
||||
u32 iv_len;
|
||||
|
||||
} securezip_t;
|
||||
|
||||
static const char *SIGNATURE_SECUREZIP = "$zip3$";
|
||||
|
||||
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
const u64 esalt_size = (const u64) sizeof (securezip_t);
|
||||
|
||||
return esalt_size;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
securezip_t *securezip = (securezip_t *) esalt_buf;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 11;
|
||||
|
||||
token.signatures_cnt = 1;
|
||||
token.signatures_buf[0] = SIGNATURE_SECUREZIP;
|
||||
|
||||
token.len_min[0] = 6;
|
||||
token.len_max[0] = 6;
|
||||
token.sep[0] = '*';
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_SIGNATURE;
|
||||
|
||||
token.len_min[1] = 1;
|
||||
token.len_max[1] = 1;
|
||||
token.sep[1] = '*';
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[2] = 1;
|
||||
token.len_max[2] = 1;
|
||||
token.sep[2] = '*';
|
||||
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[3] = 3;
|
||||
token.len_max[3] = 3;
|
||||
token.sep[3] = '*';
|
||||
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[4] = 1;
|
||||
token.len_max[4] = 1;
|
||||
token.sep[4] = '*';
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[5] = 0;
|
||||
token.len_max[5] = 32;
|
||||
token.sep[5] = '*';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[6] = 288;
|
||||
token.len_max[6] = 288;
|
||||
token.sep[6] = '*';
|
||||
token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[7] = 1;
|
||||
token.len_max[7] = 1;
|
||||
token.sep[7] = '*';
|
||||
token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[8] = 1;
|
||||
token.len_max[8] = 1;
|
||||
token.sep[8] = '*';
|
||||
token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[9] = 1;
|
||||
token.len_max[9] = 1;
|
||||
token.sep[9] = '*';
|
||||
token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_DIGIT;
|
||||
|
||||
token.len_min[10] = 0;
|
||||
token.len_max[10] = 64;
|
||||
token.sep[10] = '*';
|
||||
token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
const u8 *version_pos = token.buf[ 1];
|
||||
const u8 *type_pos = token.buf[ 2];
|
||||
const u8 *bit_len_pos = token.buf[ 3];
|
||||
const u8 *unused1_pos = token.buf[ 4];
|
||||
const u8 *iv_pos = token.buf[ 5];
|
||||
const u8 *data_pos = token.buf[ 6];
|
||||
const u8 *unused2_pos = token.buf[ 7];
|
||||
const u8 *unused3_pos = token.buf[ 8];
|
||||
const u8 *unused4_pos = token.buf[ 9];
|
||||
const u8 *file_pos = token.buf[10];
|
||||
|
||||
if (version_pos[0] != '0') return (PARSER_HASH_ENCODING); // version 0
|
||||
if (type_pos[0] != '1') return (PARSER_HASH_ENCODING); // AES
|
||||
|
||||
const u32 bit_len = hc_strtoul ((const char *) bit_len_pos, NULL, 10);
|
||||
|
||||
if (bit_len != 256) return (PARSER_HASH_ENCODING);
|
||||
|
||||
if (unused1_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused2_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused3_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
if (unused4_pos[0] != '0') return (PARSER_HASH_ENCODING);
|
||||
|
||||
// IV:
|
||||
|
||||
u8 *iv = (u8 *) securezip->iv;
|
||||
|
||||
securezip->iv_len = hex_decode (iv_pos, token.len[5], iv);
|
||||
|
||||
// data:
|
||||
|
||||
u32 *data = securezip->data;
|
||||
|
||||
hex_decode (data_pos, token.len[6], (u8 *) data);
|
||||
|
||||
// file:
|
||||
|
||||
u8 *file = (u8 *) securezip->file;
|
||||
|
||||
memcpy (file, file_pos, token.len[10]);
|
||||
|
||||
file[63] = 0;
|
||||
|
||||
// fake salt:
|
||||
|
||||
salt->salt_buf[0] = iv[0];
|
||||
salt->salt_buf[1] = iv[1];
|
||||
salt->salt_buf[2] = iv[2];
|
||||
salt->salt_buf[3] = iv[3];
|
||||
|
||||
salt->salt_len = 16;
|
||||
|
||||
// fake digest:
|
||||
|
||||
digest[0] = data[0];
|
||||
digest[1] = data[1];
|
||||
digest[2] = data[2];
|
||||
digest[3] = data[3];
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
const securezip_t *securezip = (const securezip_t *) esalt_buf;
|
||||
|
||||
// IV:
|
||||
|
||||
u8 iv[33] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->iv, securezip->iv_len, iv);
|
||||
|
||||
// data:
|
||||
|
||||
u8 data[289] = { 0 };
|
||||
|
||||
hex_encode ((u8 *) securezip->data, 144, data);
|
||||
|
||||
// file:
|
||||
|
||||
const u8 *file_ptr = (const u8 *) securezip->file;
|
||||
|
||||
u8 file[65] = { 0 };
|
||||
|
||||
memcpy (file, file_ptr, 64);
|
||||
|
||||
int out_len = snprintf (line_buf, line_size, "%s*0*1*256*0*%s*%s*0*0*0*%s",
|
||||
SIGNATURE_SECUREZIP,
|
||||
iv,
|
||||
data,
|
||||
file
|
||||
);
|
||||
|
||||
return out_len;
|
||||
}
|
||||
|
||||
void module_init (module_ctx_t *module_ctx)
|
||||
{
|
||||
module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT;
|
||||
module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT;
|
||||
|
||||
module_ctx->module_attack_exec = module_attack_exec;
|
||||
module_ctx->module_benchmark_esalt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_mask = MODULE_DEFAULT;
|
||||
module_ctx->module_benchmark_salt = MODULE_DEFAULT;
|
||||
module_ctx->module_build_plain_postprocess = MODULE_DEFAULT;
|
||||
module_ctx->module_deep_comp_kernel = MODULE_DEFAULT;
|
||||
module_ctx->module_dgst_pos0 = module_dgst_pos0;
|
||||
module_ctx->module_dgst_pos1 = module_dgst_pos1;
|
||||
module_ctx->module_dgst_pos2 = module_dgst_pos2;
|
||||
module_ctx->module_dgst_pos3 = module_dgst_pos3;
|
||||
module_ctx->module_dgst_size = module_dgst_size;
|
||||
module_ctx->module_dictstat_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_esalt_size = module_esalt_size;
|
||||
module_ctx->module_extra_buffer_size = MODULE_DEFAULT;
|
||||
module_ctx->module_extra_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_forced_outfile_format = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_count = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_parse = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_binary_save = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_decode = module_hash_decode;
|
||||
module_ctx->module_hash_encode_status = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode_potfile = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_encode = module_hash_encode;
|
||||
module_ctx->module_hash_init_selftest = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_mode = MODULE_DEFAULT;
|
||||
module_ctx->module_hash_category = module_hash_category;
|
||||
module_ctx->module_hash_name = module_hash_name;
|
||||
module_ctx->module_hashes_count_min = MODULE_DEFAULT;
|
||||
module_ctx->module_hashes_count_max = MODULE_DEFAULT;
|
||||
module_ctx->module_hlfmt_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_hook12 = MODULE_DEFAULT;
|
||||
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_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;
|
||||
module_ctx->module_kernel_loops_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_loops_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_max = MODULE_DEFAULT;
|
||||
module_ctx->module_kernel_threads_min = MODULE_DEFAULT;
|
||||
module_ctx->module_kern_type = module_kern_type;
|
||||
module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;
|
||||
module_ctx->module_opti_type = module_opti_type;
|
||||
module_ctx->module_opts_type = module_opts_type;
|
||||
module_ctx->module_outfile_check_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_custom_check = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
|
||||
module_ctx->module_pwdump_column = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_max = MODULE_DEFAULT;
|
||||
module_ctx->module_pw_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_max = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_min = MODULE_DEFAULT;
|
||||
module_ctx->module_salt_type = module_salt_type;
|
||||
module_ctx->module_separator = MODULE_DEFAULT;
|
||||
module_ctx->module_st_hash = module_st_hash;
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
@ -511,7 +511,7 @@ void setup_environment_variables (const folder_config_t *folder_config)
|
||||
|
||||
putenv (display);
|
||||
|
||||
free (display);
|
||||
hcfree (display);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
tmp_buf2[tmp_len] = 0;
|
||||
|
||||
free (tmp_buf);
|
||||
hcfree (tmp_buf);
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
@ -343,7 +343,7 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char *tmp_buf2 = strdup (tmp_buf);
|
||||
|
||||
free (tmp_buf);
|
||||
hcfree (tmp_buf);
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
@ -1097,14 +1097,14 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limited: %s", tmp_display, display_left);
|
||||
|
||||
free (display_left);
|
||||
hcfree (display_left);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limit exceeded", tmp_display);
|
||||
}
|
||||
|
||||
free (tmp_display);
|
||||
hcfree (tmp_display);
|
||||
}
|
||||
|
||||
return display;
|
||||
|
@ -1068,7 +1068,7 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
|
||||
printf (" \"rejected\": %" PRIu64 ",", hashcat_status->progress_rejected);
|
||||
printf (" \"devices\": [");
|
||||
|
||||
free (target_json_encoded);
|
||||
hcfree (target_json_encoded);
|
||||
|
||||
int device_num = 0;
|
||||
|
||||
|
@ -2760,12 +2760,14 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
* default building options
|
||||
*/
|
||||
|
||||
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
if (chdir (folder_config->cpath_real) == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", folder_config->cpath_real, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
// include check
|
||||
// this test needs to be done manually because of macOS opencl runtime
|
||||
@ -2792,9 +2794,13 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
for (int i = 0; files_names[i] != NULL; i++)
|
||||
{
|
||||
if (hc_path_read (files_names[i]) == false)
|
||||
char *temp_filename = NULL;
|
||||
|
||||
hc_asprintf (&temp_filename, "%s/%s", folder_config->cpath_real, files_names[i]);
|
||||
|
||||
if (hc_path_read (temp_filename) == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", files_names[i], strerror (errno));
|
||||
event_log_error (hashcat_ctx, "%s: %s", temp_filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2802,6 +2808,7 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// return back to the folder we came from initially (workaround)
|
||||
|
||||
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
||||
#if defined (_WIN)
|
||||
if (chdir ("..") == -1)
|
||||
{
|
||||
@ -2817,6 +2824,7 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
193
tools/test_modules/m23001.pm
Normal file
193
tools/test_modules/m23001.pm
Normal file
@ -0,0 +1,193 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA qw (sha1);
|
||||
use Crypt::CBC;
|
||||
|
||||
sub module_constraints { [[0, 256], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift; # unused since unsalted algo
|
||||
my $iv = shift;
|
||||
my $data = shift;
|
||||
my $file = shift;
|
||||
|
||||
my $bit_len = 128;
|
||||
my $key_len = $bit_len / 8;
|
||||
|
||||
my $is_decrypt = defined ($data);
|
||||
|
||||
my $padding = "none"; # for decryption we need this to "keep" the padding bytes
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$padding = "standard";
|
||||
|
||||
# generate some additional random hash data:
|
||||
|
||||
my $iv_len = random_number (1, 16);
|
||||
|
||||
$iv = random_bytes ($iv_len);
|
||||
|
||||
$data = random_bytes (128);
|
||||
|
||||
$file = random_lowercase_string (random_number (1, 16));
|
||||
|
||||
$file .= ".txt";
|
||||
}
|
||||
|
||||
my $iv_mod = $iv;
|
||||
|
||||
$iv_mod .= "\x00" x (16 - length ($iv_mod));
|
||||
|
||||
|
||||
# start of main algo:
|
||||
|
||||
my $digest = sha1 ($word);
|
||||
|
||||
my $buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x36")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x36" x 44;
|
||||
|
||||
my $key = sha1 ($buf);
|
||||
|
||||
|
||||
$buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x5c")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x5c" x 44;
|
||||
|
||||
# final key:
|
||||
|
||||
$key = $key . sha1 ($buf);
|
||||
|
||||
$key = substr ($key, 0, $key_len);
|
||||
|
||||
my $aes = Crypt::CBC->new ({
|
||||
cipher => "Crypt::Rijndael",
|
||||
key => $key,
|
||||
iv => $iv_mod,
|
||||
keysize => $key_len,
|
||||
literal_key => 1,
|
||||
header => "none",
|
||||
padding => $padding,
|
||||
});
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$data = $aes->encrypt ($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $data_decrypted = $aes->decrypt ($data);
|
||||
|
||||
# the password is wrong if the decrypted data does not have the expected padding bytes:
|
||||
|
||||
if (substr ($data_decrypted, -16) ne "\x10" x 16)
|
||||
{
|
||||
$data = "fake"; # fake data
|
||||
}
|
||||
}
|
||||
|
||||
my $iv_padded = $iv;
|
||||
|
||||
if (length ($iv_padded) < 12)
|
||||
{
|
||||
$iv_padded .= "\x00" x (12 - length ($iv_padded));
|
||||
}
|
||||
|
||||
my $hash = sprintf ("\$zip3\$*0*1*%i*0*%s*%s*0*0*0*%s", $bit_len, unpack ("H*", $iv_padded), unpack ("H*", $data), $file);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
return unless (substr ($line, 0, 11) eq "\$zip3\$*0*1*");
|
||||
|
||||
my $idx1 = index ($line, ":");
|
||||
|
||||
return unless ($idx1 >= 11);
|
||||
|
||||
my $hash = substr ($line, 0, $idx1);
|
||||
my $word = substr ($line, $idx1 + 1);
|
||||
|
||||
# bit_len:
|
||||
|
||||
$idx1 = index ($hash, "*", 11);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $bit_len = substr ($hash, 11, $idx1 - 11);
|
||||
|
||||
$bit_len = int ($bit_len);
|
||||
|
||||
return unless ($bit_len == 128);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 2) eq "0*");
|
||||
|
||||
# iv:
|
||||
|
||||
my $idx2 = index ($hash, "*", $idx1 + 3);
|
||||
|
||||
return unless ($idx2 > 0);
|
||||
|
||||
my $iv = substr ($hash, $idx1 + 3, $idx2 - $idx1 - 3);
|
||||
|
||||
return unless ($iv =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($iv) % 2) == 0);
|
||||
|
||||
# data:
|
||||
|
||||
$idx1 = index ($hash, "*", $idx2 + 1);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $data = substr ($hash, $idx2 + 1, $idx1 - $idx2 - 1);
|
||||
|
||||
return unless ($data =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($data) % 2) == 0);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 6) eq "0*0*0*");
|
||||
|
||||
# file:
|
||||
|
||||
my $file = substr ($hash, $idx1 + 7);
|
||||
|
||||
# convert to hex:
|
||||
|
||||
$iv = pack ("H*", $iv);
|
||||
$data = pack ("H*", $data);
|
||||
|
||||
my $word_packed = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word_packed, "", $iv, $data, $file);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
193
tools/test_modules/m23002.pm
Normal file
193
tools/test_modules/m23002.pm
Normal file
@ -0,0 +1,193 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA qw (sha1);
|
||||
use Crypt::CBC;
|
||||
|
||||
sub module_constraints { [[0, 256], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift; # unused since unsalted algo
|
||||
my $iv = shift;
|
||||
my $data = shift;
|
||||
my $file = shift;
|
||||
|
||||
my $bit_len = 192;
|
||||
my $key_len = $bit_len / 8;
|
||||
|
||||
my $is_decrypt = defined ($data);
|
||||
|
||||
my $padding = "none"; # for decryption we need this to "keep" the padding bytes
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$padding = "standard";
|
||||
|
||||
# generate some additional random hash data:
|
||||
|
||||
my $iv_len = random_number (1, 16);
|
||||
|
||||
$iv = random_bytes ($iv_len);
|
||||
|
||||
$data = random_bytes (128);
|
||||
|
||||
$file = random_lowercase_string (random_number (1, 16));
|
||||
|
||||
$file .= ".txt";
|
||||
}
|
||||
|
||||
my $iv_mod = $iv;
|
||||
|
||||
$iv_mod .= "\x00" x (16 - length ($iv_mod));
|
||||
|
||||
|
||||
# start of main algo:
|
||||
|
||||
my $digest = sha1 ($word);
|
||||
|
||||
my $buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x36")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x36" x 44;
|
||||
|
||||
my $key = sha1 ($buf);
|
||||
|
||||
|
||||
$buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x5c")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x5c" x 44;
|
||||
|
||||
# final key:
|
||||
|
||||
$key = $key . sha1 ($buf);
|
||||
|
||||
$key = substr ($key, 0, $key_len);
|
||||
|
||||
my $aes = Crypt::CBC->new ({
|
||||
cipher => "Crypt::Rijndael",
|
||||
key => $key,
|
||||
iv => $iv_mod,
|
||||
keysize => $key_len,
|
||||
literal_key => 1,
|
||||
header => "none",
|
||||
padding => $padding,
|
||||
});
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$data = $aes->encrypt ($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $data_decrypted = $aes->decrypt ($data);
|
||||
|
||||
# the password is wrong if the decrypted data does not have the expected padding bytes:
|
||||
|
||||
if (substr ($data_decrypted, -16) ne "\x10" x 16)
|
||||
{
|
||||
$data = "fake"; # fake data
|
||||
}
|
||||
}
|
||||
|
||||
my $iv_padded = $iv;
|
||||
|
||||
if (length ($iv_padded) < 12)
|
||||
{
|
||||
$iv_padded .= "\x00" x (12 - length ($iv_padded));
|
||||
}
|
||||
|
||||
my $hash = sprintf ("\$zip3\$*0*1*%i*0*%s*%s*0*0*0*%s", $bit_len, unpack ("H*", $iv_padded), unpack ("H*", $data), $file);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
return unless (substr ($line, 0, 11) eq "\$zip3\$*0*1*");
|
||||
|
||||
my $idx1 = index ($line, ":");
|
||||
|
||||
return unless ($idx1 >= 11);
|
||||
|
||||
my $hash = substr ($line, 0, $idx1);
|
||||
my $word = substr ($line, $idx1 + 1);
|
||||
|
||||
# bit_len:
|
||||
|
||||
$idx1 = index ($hash, "*", 11);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $bit_len = substr ($hash, 11, $idx1 - 11);
|
||||
|
||||
$bit_len = int ($bit_len);
|
||||
|
||||
return unless ($bit_len == 192);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 2) eq "0*");
|
||||
|
||||
# iv:
|
||||
|
||||
my $idx2 = index ($hash, "*", $idx1 + 3);
|
||||
|
||||
return unless ($idx2 > 0);
|
||||
|
||||
my $iv = substr ($hash, $idx1 + 3, $idx2 - $idx1 - 3);
|
||||
|
||||
return unless ($iv =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($iv) % 2) == 0);
|
||||
|
||||
# data:
|
||||
|
||||
$idx1 = index ($hash, "*", $idx2 + 1);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $data = substr ($hash, $idx2 + 1, $idx1 - $idx2 - 1);
|
||||
|
||||
return unless ($data =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($data) % 2) == 0);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 6) eq "0*0*0*");
|
||||
|
||||
# file:
|
||||
|
||||
my $file = substr ($hash, $idx1 + 7);
|
||||
|
||||
# convert to hex:
|
||||
|
||||
$iv = pack ("H*", $iv);
|
||||
$data = pack ("H*", $data);
|
||||
|
||||
my $word_packed = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word_packed, "", $iv, $data, $file);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
193
tools/test_modules/m23003.pm
Normal file
193
tools/test_modules/m23003.pm
Normal file
@ -0,0 +1,193 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA qw (sha1);
|
||||
use Crypt::CBC;
|
||||
|
||||
sub module_constraints { [[0, 256], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift; # unused since unsalted algo
|
||||
my $iv = shift;
|
||||
my $data = shift;
|
||||
my $file = shift;
|
||||
|
||||
my $bit_len = 256;
|
||||
my $key_len = $bit_len / 8;
|
||||
|
||||
my $is_decrypt = defined ($data);
|
||||
|
||||
my $padding = "none"; # for decryption we need this to "keep" the padding bytes
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$padding = "standard";
|
||||
|
||||
# generate some additional random hash data:
|
||||
|
||||
my $iv_len = random_number (1, 16);
|
||||
|
||||
$iv = random_bytes ($iv_len);
|
||||
|
||||
$data = random_bytes (128);
|
||||
|
||||
$file = random_lowercase_string (random_number (1, 16));
|
||||
|
||||
$file .= ".txt";
|
||||
}
|
||||
|
||||
my $iv_mod = $iv;
|
||||
|
||||
$iv_mod .= "\x00" x (16 - length ($iv_mod));
|
||||
|
||||
|
||||
# start of main algo:
|
||||
|
||||
my $digest = sha1 ($word);
|
||||
|
||||
my $buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x36")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x36" x 44;
|
||||
|
||||
my $key = sha1 ($buf);
|
||||
|
||||
|
||||
$buf = "";
|
||||
|
||||
for (my $i = 0; $i < 20; $i++)
|
||||
{
|
||||
$buf .= chr (ord (substr ($digest, $i, 1)) ^ ord ("\x5c")); # or just ^ 0x36
|
||||
}
|
||||
|
||||
$buf .= "\x5c" x 44;
|
||||
|
||||
# final key:
|
||||
|
||||
$key = $key . sha1 ($buf);
|
||||
|
||||
$key = substr ($key, 0, $key_len);
|
||||
|
||||
my $aes = Crypt::CBC->new ({
|
||||
cipher => "Crypt::Rijndael",
|
||||
key => $key,
|
||||
iv => $iv_mod,
|
||||
keysize => $key_len,
|
||||
literal_key => 1,
|
||||
header => "none",
|
||||
padding => $padding,
|
||||
});
|
||||
|
||||
if ($is_decrypt == 0)
|
||||
{
|
||||
$data = $aes->encrypt ($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $data_decrypted = $aes->decrypt ($data);
|
||||
|
||||
# the password is wrong if the decrypted data does not have the expected padding bytes:
|
||||
|
||||
if (substr ($data_decrypted, -16) ne "\x10" x 16)
|
||||
{
|
||||
$data = "fake"; # fake data
|
||||
}
|
||||
}
|
||||
|
||||
my $iv_padded = $iv;
|
||||
|
||||
if (length ($iv_padded) < 12)
|
||||
{
|
||||
$iv_padded .= "\x00" x (12 - length ($iv_padded));
|
||||
}
|
||||
|
||||
my $hash = sprintf ("\$zip3\$*0*1*%i*0*%s*%s*0*0*0*%s", $bit_len, unpack ("H*", $iv_padded), unpack ("H*", $data), $file);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
return unless (substr ($line, 0, 11) eq "\$zip3\$*0*1*");
|
||||
|
||||
my $idx1 = index ($line, ":");
|
||||
|
||||
return unless ($idx1 >= 11);
|
||||
|
||||
my $hash = substr ($line, 0, $idx1);
|
||||
my $word = substr ($line, $idx1 + 1);
|
||||
|
||||
# bit_len:
|
||||
|
||||
$idx1 = index ($hash, "*", 11);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $bit_len = substr ($hash, 11, $idx1 - 11);
|
||||
|
||||
$bit_len = int ($bit_len);
|
||||
|
||||
return unless ($bit_len == 256);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 2) eq "0*");
|
||||
|
||||
# iv:
|
||||
|
||||
my $idx2 = index ($hash, "*", $idx1 + 3);
|
||||
|
||||
return unless ($idx2 > 0);
|
||||
|
||||
my $iv = substr ($hash, $idx1 + 3, $idx2 - $idx1 - 3);
|
||||
|
||||
return unless ($iv =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($iv) % 2) == 0);
|
||||
|
||||
# data:
|
||||
|
||||
$idx1 = index ($hash, "*", $idx2 + 1);
|
||||
|
||||
return unless ($idx1 > 0);
|
||||
|
||||
my $data = substr ($hash, $idx2 + 1, $idx1 - $idx2 - 1);
|
||||
|
||||
return unless ($data =~ m/^[0-9a-fA-F]+$/);
|
||||
return unless ((length ($data) % 2) == 0);
|
||||
|
||||
# unused:
|
||||
|
||||
return unless (substr ($hash, $idx1 + 1, 6) eq "0*0*0*");
|
||||
|
||||
# file:
|
||||
|
||||
my $file = substr ($hash, $idx1 + 7);
|
||||
|
||||
# convert to hex:
|
||||
|
||||
$iv = pack ("H*", $iv);
|
||||
$data = pack ("H*", $data);
|
||||
|
||||
my $word_packed = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word_packed, "", $iv, $data, $file);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user