Add DiskCryptor modules for 1024 bit and 1536 and support for Serpent and Twofish. Be careful, untested yet!
This commit is contained in:
+312
-16
@@ -1,4 +1,4 @@
|
||||
DECLSPEC void xts_mul2 (u32 *in, u32 *out)
|
||||
DECLSPEC void dcrp_xts_mul2 (u32 *in, u32 *out)
|
||||
{
|
||||
const u32 c = in[3] >> 31;
|
||||
|
||||
@@ -10,7 +10,7 @@ DECLSPEC void xts_mul2 (u32 *in, u32 *out)
|
||||
out[0] ^= c * 0x87;
|
||||
}
|
||||
|
||||
DECLSPEC void aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
DECLSPEC void dcrp_aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
@@ -22,10 +22,10 @@ DECLSPEC void aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32
|
||||
|
||||
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
|
||||
|
||||
xts_mul2 (T, T);
|
||||
xts_mul2 (T, T);
|
||||
xts_mul2 (T, T);
|
||||
xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
|
||||
out[0] ^= T[0];
|
||||
out[1] ^= T[1];
|
||||
@@ -41,7 +41,71 @@ DECLSPEC void aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32
|
||||
out[3] ^= T[3];
|
||||
}
|
||||
|
||||
DECLSPEC int decrypt_and_check (GLOBAL_AS const u32 *encrypted_data, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
DECLSPEC void dcrp_serpent256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)
|
||||
{
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
out[3] = in[3];
|
||||
|
||||
serpent256_set_key (ks, ukey2);
|
||||
serpent256_encrypt (ks, S, T);
|
||||
|
||||
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
|
||||
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
|
||||
out[0] ^= T[0];
|
||||
out[1] ^= T[1];
|
||||
out[2] ^= T[2];
|
||||
out[3] ^= T[3];
|
||||
|
||||
serpent256_set_key (ks, ukey1);
|
||||
serpent256_decrypt (ks, out, out);
|
||||
|
||||
out[0] ^= T[0];
|
||||
out[1] ^= T[1];
|
||||
out[2] ^= T[2];
|
||||
out[3] ^= T[3];
|
||||
}
|
||||
|
||||
DECLSPEC void dcrp_twofish256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk)
|
||||
{
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
out[3] = in[3];
|
||||
|
||||
twofish256_set_key (sk, lk, ukey2);
|
||||
twofish256_encrypt (sk, lk, S, T);
|
||||
|
||||
// skip four blocks (the starting position + 64 raw salt bytes that were replaced after encryption):
|
||||
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
dcrp_xts_mul2 (T, T);
|
||||
|
||||
out[0] ^= T[0];
|
||||
out[1] ^= T[1];
|
||||
out[2] ^= T[2];
|
||||
out[3] ^= T[3];
|
||||
|
||||
twofish256_set_key (sk, lk, ukey1);
|
||||
twofish256_decrypt (sk, lk, out, out);
|
||||
|
||||
out[0] ^= T[0];
|
||||
out[1] ^= T[1];
|
||||
out[2] ^= T[2];
|
||||
out[3] ^= T[3];
|
||||
}
|
||||
|
||||
// 512 bit
|
||||
|
||||
DECLSPEC int dcrp_verify_header_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
u32 ks_aes[60];
|
||||
|
||||
@@ -51,20 +115,252 @@ DECLSPEC int decrypt_and_check (GLOBAL_AS const u32 *encrypted_data, const u32 *
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = encrypted_data[0];
|
||||
data[1] = encrypted_data[1];
|
||||
data[2] = encrypted_data[2];
|
||||
data[3] = encrypted_data[3];
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 out[4];
|
||||
u32 tmp[4];
|
||||
|
||||
aes256_decrypt_xts (ukey1, ukey2, data, out, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
dcrp_aes256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
if (out[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((out[2] != 0x00040002) && (out[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((out[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLSPEC int dcrp_verify_header_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2)
|
||||
{
|
||||
u32 ks_serpent[140];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_serpent[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_serpent256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_serpent, ks_serpent);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLSPEC int dcrp_verify_header_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2)
|
||||
{
|
||||
u32 sk_twofish[4];
|
||||
u32 lk_twofish[40];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_twofish[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_twofish256_decrypt_xts (ukey1, ukey2, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 1024 bit
|
||||
|
||||
DECLSPEC int dcrp_verify_header_aes_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
u32 ks_aes[60];
|
||||
|
||||
u32 sk_twofish[4];
|
||||
u32 lk_twofish[40];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_aes[4] = { 0 };
|
||||
u32 T_twofish[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_aes256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
dcrp_twofish256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLSPEC int dcrp_verify_header_serpent_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
u32 ks_serpent[140];
|
||||
u32 ks_aes[60];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_serpent[4] = { 0 };
|
||||
u32 T_aes[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_serpent256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_serpent, ks_serpent);
|
||||
dcrp_aes256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLSPEC int dcrp_verify_header_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
|
||||
{
|
||||
u32 sk_twofish[4];
|
||||
u32 lk_twofish[40];
|
||||
|
||||
u32 ks_serpent[140];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_twofish[4] = { 0 };
|
||||
u32 T_serpent[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_twofish256_decrypt_xts (ukey2, ukey4, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
|
||||
dcrp_serpent256_decrypt_xts (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 1536 bit
|
||||
|
||||
DECLSPEC int dcrp_verify_header_aes_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
u32 ks_aes[60];
|
||||
|
||||
u32 sk_twofish[4];
|
||||
u32 lk_twofish[40];
|
||||
|
||||
u32 ks_serpent[140];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_aes[4] = { 0 };
|
||||
u32 T_twofish[4] = { 0 };
|
||||
u32 T_serpent[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_aes256_decrypt_xts (ukey3, ukey6, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
dcrp_twofish256_decrypt_xts (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
|
||||
dcrp_serpent256_decrypt_xts (ukey1, ukey4, tmp, tmp, S, T_serpent, ks_serpent);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DECLSPEC int dcrp_verify_header_serpent_twofish_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4)
|
||||
{
|
||||
u32 ks_serpent[140];
|
||||
|
||||
u32 sk_twofish[4];
|
||||
u32 lk_twofish[40];
|
||||
|
||||
u32 ks_aes[60];
|
||||
|
||||
u32 S[4] = { 1, 0, 0, 0 }; // this weird offset / sector ID. found by lot of research by philsmd
|
||||
|
||||
u32 T_serpent[4] = { 0 };
|
||||
u32 T_twofish[4] = { 0 };
|
||||
u32 T_aes[4] = { 0 };
|
||||
|
||||
u32 data[4];
|
||||
|
||||
data[0] = data_buf[0];
|
||||
data[1] = data_buf[1];
|
||||
data[2] = data_buf[2];
|
||||
data[3] = data_buf[3];
|
||||
|
||||
u32 tmp[4];
|
||||
|
||||
dcrp_serpent256_decrypt_xts (ukey3, ukey6, data, tmp, S, T_serpent, ks_serpent);
|
||||
dcrp_twofish256_decrypt_xts (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
|
||||
dcrp_aes256_decrypt_xts (ukey1, ukey4, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
|
||||
|
||||
if (tmp[0] != 0x50524344) return 0; // signature / magic: "DCRP"
|
||||
|
||||
if ((tmp[2] != 0x00040002) && (tmp[2] != 0x00050002)) return 0; // header version 0x0002 and flags either 0x04 or 0x05
|
||||
|
||||
if ((tmp[3] & 0xffff) != 0) return 0; // remaining 2 bytes of 0x00000004 / 0x00000005 => must be 0x0000
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _INC_DISKCRYPTOR_XTS_H
|
||||
#define _INC_DISKCRYPTOR_XTS_H
|
||||
|
||||
DECLSPEC void dcrp_xts_mul2 (u32 *in, u32 *out);
|
||||
DECLSPEC void dcrp_aes256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
DECLSPEC void dcrp_serpent256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks);
|
||||
DECLSPEC void dcrp_twofish256_decrypt_xts (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk);
|
||||
DECLSPEC int dcrp_verify_header_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
DECLSPEC int dcrp_verify_header_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2);
|
||||
DECLSPEC int dcrp_verify_header_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2);
|
||||
DECLSPEC int dcrp_verify_header_aes_twofish (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
DECLSPEC int dcrp_verify_header_serpent_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
DECLSPEC int dcrp_verify_header_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
|
||||
DECLSPEC int dcrp_verify_header_aes_twofish_serpent (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
DECLSPEC int dcrp_verify_header_serpent_twofish_aes (GLOBAL_AS const u32 *data_buf, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4);
|
||||
|
||||
#endif // _INC_DISKCRYPTOR_XTS_H
|
||||
@@ -11,8 +11,9 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_hash_sha512.cl"
|
||||
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_cipher_serpent.cl"
|
||||
#include "inc_cipher_twofish.cl"
|
||||
#include "inc_diskcryptor_xts.cl"
|
||||
#endif
|
||||
|
||||
@@ -21,8 +22,8 @@ typedef struct pbkdf2_sha512_tmp
|
||||
u64 ipad[8];
|
||||
u64 opad[8];
|
||||
|
||||
u64 dgst[16];
|
||||
u64 out[16];
|
||||
u64 dgst[32];
|
||||
u64 out[32];
|
||||
|
||||
} pbkdf2_sha512_tmp_t;
|
||||
|
||||
@@ -90,7 +91,7 @@ DECLSPEC static void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3,
|
||||
sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest);
|
||||
}
|
||||
|
||||
KERNEL_FQ void m19800_init (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
KERNEL_FQ void m19811_init (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@@ -194,7 +195,7 @@ KERNEL_FQ void m19800_init (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcrypt
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m19800_loop (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
KERNEL_FQ void m19811_loop (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
|
||||
@@ -320,7 +321,7 @@ KERNEL_FQ void m19800_loop (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcrypt
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m19800_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
KERNEL_FQ void m19811_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcryptor_esalt_t))
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
@@ -403,7 +404,23 @@ KERNEL_FQ void m19800_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha512_tmp_t, diskcrypt
|
||||
|
||||
#define il_pos 0
|
||||
|
||||
if (decrypt_and_check (digests_buf[digests_offset].digest_buf, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
if (dcrp_verify_header_aes (digests_buf[digests_offset].digest_buf, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (dcrp_verify_header_serpent (digests_buf[digests_offset].digest_buf, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset, gid, il_pos, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (dcrp_verify_header_twofish (digests_buf[digests_offset].digest_buf, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
|
||||
{
|
||||
Reference in New Issue
Block a user