1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-05-08 18:08:51 +00:00
This commit is contained in:
Sein Coray 2019-03-18 17:47:42 +01:00
commit 836c91c8c2
No known key found for this signature in database
GPG Key ID: 44C4180EA69758EC
405 changed files with 20651 additions and 6480 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,7 @@ __constant const u32a c_sbox[256] =
#define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff) #define extract_byte(x,n) (((x) >> (8 * (n))) & 0xff)
DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y);
DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y) DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y)
{ {
u32 b[8]; u32 b[8];
@ -89,6 +90,7 @@ DECLSPEC void cam_feistel (const u32 *x, const u32 *k, u32 *y)
y[1] ^= tmp[1]; y[1] ^= tmp[1];
} }
DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr);
DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr) DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr)
{ {
u32 t[4]; u32 t[4];
@ -125,6 +127,7 @@ DECLSPEC void cam_fl (u32 *x, const u32 *kl, const u32 *kr)
x[3] = swap32_S (t[3]); x[3] = swap32_S (t[3]);
} }
DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey) DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey)
{ {
const u32 sigma[12] = const u32 sigma[12] =
@ -260,6 +263,7 @@ DECLSPEC void camellia256_set_key (u32 *ks, const u32 *ukey)
ks[67] = cam_rotate (14, 15, 15); ks[67] = cam_rotate (14, 15, 15);
} }
DECLSPEC void camellia256_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void camellia256_encrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void camellia256_encrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
out[0] = in[0] ^ ks[0]; out[0] = in[0] ^ ks[0];
@ -312,6 +316,7 @@ DECLSPEC void camellia256_encrypt (const u32 *ks, const u32 *in, u32 *out)
out[3] = tmp[1] ^ ks[67]; out[3] = tmp[1] ^ ks[67];
} }
DECLSPEC void camellia256_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void camellia256_decrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void camellia256_decrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
out[0] = in[0] ^ ks[64]; out[0] = in[0] ^ ks[64];

524
OpenCL/inc_cipher_des.cl Normal file
View File

@ -0,0 +1,524 @@
__constant u32a c_SPtrans[8][64] =
{
{
/* nibble 0 */
0x02080800, 0x00080000, 0x02000002, 0x02080802,
0x02000000, 0x00080802, 0x00080002, 0x02000002,
0x00080802, 0x02080800, 0x02080000, 0x00000802,
0x02000802, 0x02000000, 0x00000000, 0x00080002,
0x00080000, 0x00000002, 0x02000800, 0x00080800,
0x02080802, 0x02080000, 0x00000802, 0x02000800,
0x00000002, 0x00000800, 0x00080800, 0x02080002,
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
/* nibble 1 */
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
/* nibble 2 */
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
/* nibble 3 */
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
/* nibble 4 */
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
/* nibble 5 */
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
/* nibble 6 */
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
/* nibble 7 */
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
},
};
__constant u32a c_skb[8][64] =
{
{
0x00000000, 0x00000010, 0x20000000, 0x20000010,
0x00010000, 0x00010010, 0x20010000, 0x20010010,
0x00000800, 0x00000810, 0x20000800, 0x20000810,
0x00010800, 0x00010810, 0x20010800, 0x20010810,
0x00000020, 0x00000030, 0x20000020, 0x20000030,
0x00010020, 0x00010030, 0x20010020, 0x20010030,
0x00000820, 0x00000830, 0x20000820, 0x20000830,
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
#define PERM_OP(a,b,n,m) \
{ \
u32x t; \
t = a >> n; \
t = t ^ b; \
t = t & m; \
b = b ^ t; \
t = t << n; \
a = a ^ t; \
}
#define HPERM_OP(a,n,m) \
{ \
u32x t; \
t = a << (16 + n); \
t = t ^ a; \
t = t & m; \
a = a ^ t; \
t = t >> (16 + n); \
a = a ^ t; \
}
#define DES_IP(l,r) \
{ \
PERM_OP (r, l, 4, 0x0f0f0f0f); \
PERM_OP (l, r, 16, 0x0000ffff); \
PERM_OP (r, l, 2, 0x33333333); \
PERM_OP (l, r, 8, 0x00ff00ff); \
PERM_OP (r, l, 1, 0x55555555); \
}
#define DES_FP(l,r) \
{ \
PERM_OP (l, r, 1, 0x55555555); \
PERM_OP (r, l, 8, 0x00ff00ff); \
PERM_OP (l, r, 2, 0x33333333); \
PERM_OP (r, l, 16, 0x0000ffff); \
PERM_OP (l, r, 4, 0x0f0f0f0f); \
}
#if VECT_SIZE == 1
#define DES_BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define DES_BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{
u32x r = data[0];
u32x l = data[1];
DES_IP (r, l);
r = rotl32 (r, 3u);
l = rotl32 (l, 3u);
for (u32 i = 0; i < 16; i += 2)
{
u32x u;
u32x t;
u = Kc[i + 0] ^ r;
t = Kd[i + 0] ^ rotl32 (r, 28u);
l ^= DES_BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i + 1] ^ l;
t = Kd[i + 1] ^ rotl32 (l, 28u);
r ^= DES_BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = rotl32 (l, 29u);
r = rotl32 (r, 29u);
DES_FP (r, l);
iv[0] = l;
iv[1] = r;
}
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]);
DECLSPEC void _des_crypt_decrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64])
{
u32x r = data[0];
u32x l = data[1];
DES_IP (r, l);
r = rotl32 (r, 3u);
l = rotl32 (l, 3u);
for (u32 i = 16; i > 0; i -= 2)
{
u32x u;
u32x t;
u = Kc[i - 1] ^ r;
t = Kd[i - 1] ^ rotl32 (r, 28u);
l ^= DES_BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i - 2] ^ l;
t = Kd[i - 2] ^ rotl32 (l, 28u);
r ^= DES_BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| DES_BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| DES_BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| DES_BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| DES_BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| DES_BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| DES_BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| DES_BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = rotl32 (l, 29u);
r = rotl32 (r, 29u);
DES_FP (r, l);
iv[0] = l;
iv[1] = r;
}
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]);
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64])
{
PERM_OP (d, c, 4, 0x0f0f0f0f);
HPERM_OP (c, 2, 0xcccc0000);
HPERM_OP (d, 2, 0xcccc0000);
PERM_OP (d, c, 1, 0x55555555);
PERM_OP (c, d, 8, 0x00ff00ff);
PERM_OP (d, c, 1, 0x55555555);
d = ((d & 0x000000ff) << 16)
| ((d & 0x0000ff00) << 0)
| ((d & 0x00ff0000) >> 16)
| ((c & 0xf0000000) >> 4);
c = c & 0x0fffffff;
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
{
c = ((c >> 1) | (c << 27));
d = ((d >> 1) | (d << 27));
}
else
{
c = ((c >> 2) | (c << 26));
d = ((d >> 2) | (d << 26));
}
c = c & 0x0fffffff;
d = d & 0x0fffffff;
const u32x c00 = (c >> 0) & 0x0000003f;
const u32x c06 = (c >> 6) & 0x00383003;
const u32x c07 = (c >> 7) & 0x0000003c;
const u32x c13 = (c >> 13) & 0x0000060f;
const u32x c20 = (c >> 20) & 0x00000001;
u32x s = DES_BOX (((c00 >> 0) & 0xff), 0, s_skb)
| DES_BOX (((c06 >> 0) & 0xff)
|((c07 >> 0) & 0xff), 1, s_skb)
| DES_BOX (((c13 >> 0) & 0xff)
|((c06 >> 8) & 0xff), 2, s_skb)
| DES_BOX (((c20 >> 0) & 0xff)
|((c13 >> 8) & 0xff)
|((c06 >> 16) & 0xff), 3, s_skb);
const u32x d00 = (d >> 0) & 0x00003c3f;
const u32x d07 = (d >> 7) & 0x00003f03;
const u32x d21 = (d >> 21) & 0x0000000f;
const u32x d22 = (d >> 22) & 0x00000030;
u32x t = DES_BOX (((d00 >> 0) & 0xff), 4, s_skb)
| DES_BOX (((d07 >> 0) & 0xff)
|((d00 >> 8) & 0xff), 5, s_skb)
| DES_BOX (((d07 >> 8) & 0xff), 6, s_skb)
| DES_BOX (((d21 >> 0) & 0xff)
|((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
Kc[i] = rotl32 (Kc[i], 2u);
Kd[i] = rotl32 (Kd[i], 2u);
}
}

View File

@ -101,6 +101,7 @@ __constant const u32a k_sbox_inv[256] =
x &= 0xff; \ x &= 0xff; \
} }
DECLSPEC void kuznyechik_linear (u32 *w);
DECLSPEC void kuznyechik_linear (u32 *w) DECLSPEC void kuznyechik_linear (u32 *w)
{ {
// used in k_xor macro // used in k_xor macro
@ -137,6 +138,7 @@ DECLSPEC void kuznyechik_linear (u32 *w)
} }
} }
DECLSPEC void kuznyechik_linear_inv (u32 *w);
DECLSPEC void kuznyechik_linear_inv (u32 *w) DECLSPEC void kuznyechik_linear_inv (u32 *w)
{ {
// used in k_xor macro // used in k_xor macro
@ -174,6 +176,7 @@ DECLSPEC void kuznyechik_linear_inv (u32 *w)
} }
} }
DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey) DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey)
{ {
u32 counter[4]; u32 counter[4];
@ -248,6 +251,7 @@ DECLSPEC void kuznyechik_set_key (u32 *ks, const u32 *ukey)
} }
} }
DECLSPEC void kuznyechik_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void kuznyechik_encrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void kuznyechik_encrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
out[0] = in[0]; out[0] = in[0];
@ -273,6 +277,7 @@ DECLSPEC void kuznyechik_encrypt (const u32 *ks, const u32 *in, u32 *out)
out[3] ^= ks[4 * 9 + 3]; out[3] ^= ks[4 * 9 + 3];
} }
DECLSPEC void kuznyechik_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void kuznyechik_decrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void kuznyechik_decrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
out[0] = in[0]; out[0] = in[0];

View File

@ -403,33 +403,149 @@
// 128 bit key // 128 bit key
DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey)
{ {
#ifdef _unroll ks[ 0] = ukey[0];
#pragma unroll ks[ 1] = ukey[1];
#endif ks[ 2] = ukey[2];
for (int i = 0; i < 4; i++) ks[ 3] = ukey[3];
{ ks[ 4] = 1;
ks[i] = ukey[i]; ks[ 5] = 0;
} ks[ 6] = 0;
ks[ 7] = 0;
#ifdef _unroll ks[ 8] = rotl32_S ((ks[ 7] ^ ks[ 5] ^ ks[ 3] ^ ks[ 0] ^ 0x9e3779b9 ^ 0), 11);
#pragma unroll ks[ 9] = rotl32_S ((ks[ 8] ^ ks[ 6] ^ ks[ 4] ^ ks[ 1] ^ 0x9e3779b9 ^ 1), 11);
#endif ks[ 10] = rotl32_S ((ks[ 9] ^ ks[ 7] ^ ks[ 5] ^ ks[ 2] ^ 0x9e3779b9 ^ 2), 11);
for (int i = 4; i < 8; i++) ks[ 11] = rotl32_S ((ks[ 10] ^ ks[ 8] ^ ks[ 6] ^ ks[ 3] ^ 0x9e3779b9 ^ 3), 11);
{ ks[ 12] = rotl32_S ((ks[ 11] ^ ks[ 9] ^ ks[ 7] ^ ks[ 4] ^ 0x9e3779b9 ^ 4), 11);
ks[i] = 0; ks[ 13] = rotl32_S ((ks[ 12] ^ ks[ 10] ^ ks[ 8] ^ ks[ 5] ^ 0x9e3779b9 ^ 5), 11);
} ks[ 14] = rotl32_S ((ks[ 13] ^ ks[ 11] ^ ks[ 9] ^ ks[ 6] ^ 0x9e3779b9 ^ 6), 11);
ks[ 15] = rotl32_S ((ks[ 14] ^ ks[ 12] ^ ks[ 10] ^ ks[ 7] ^ 0x9e3779b9 ^ 7), 11);
ks[4] = 1; ks[ 16] = rotl32_S ((ks[ 15] ^ ks[ 13] ^ ks[ 11] ^ ks[ 8] ^ 0x9e3779b9 ^ 8), 11);
ks[ 17] = rotl32_S ((ks[ 16] ^ ks[ 14] ^ ks[ 12] ^ ks[ 9] ^ 0x9e3779b9 ^ 9), 11);
#ifdef _unroll ks[ 18] = rotl32_S ((ks[ 17] ^ ks[ 15] ^ ks[ 13] ^ ks[ 10] ^ 0x9e3779b9 ^ 10), 11);
#pragma unroll ks[ 19] = rotl32_S ((ks[ 18] ^ ks[ 16] ^ ks[ 14] ^ ks[ 11] ^ 0x9e3779b9 ^ 11), 11);
#endif ks[ 20] = rotl32_S ((ks[ 19] ^ ks[ 17] ^ ks[ 15] ^ ks[ 12] ^ 0x9e3779b9 ^ 12), 11);
for (int i = 0; i < 132; i++) ks[ 21] = rotl32_S ((ks[ 20] ^ ks[ 18] ^ ks[ 16] ^ ks[ 13] ^ 0x9e3779b9 ^ 13), 11);
{ ks[ 22] = rotl32_S ((ks[ 21] ^ ks[ 19] ^ ks[ 17] ^ ks[ 14] ^ 0x9e3779b9 ^ 14), 11);
ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); ks[ 23] = rotl32_S ((ks[ 22] ^ ks[ 20] ^ ks[ 18] ^ ks[ 15] ^ 0x9e3779b9 ^ 15), 11);
} ks[ 24] = rotl32_S ((ks[ 23] ^ ks[ 21] ^ ks[ 19] ^ ks[ 16] ^ 0x9e3779b9 ^ 16), 11);
ks[ 25] = rotl32_S ((ks[ 24] ^ ks[ 22] ^ ks[ 20] ^ ks[ 17] ^ 0x9e3779b9 ^ 17), 11);
ks[ 26] = rotl32_S ((ks[ 25] ^ ks[ 23] ^ ks[ 21] ^ ks[ 18] ^ 0x9e3779b9 ^ 18), 11);
ks[ 27] = rotl32_S ((ks[ 26] ^ ks[ 24] ^ ks[ 22] ^ ks[ 19] ^ 0x9e3779b9 ^ 19), 11);
ks[ 28] = rotl32_S ((ks[ 27] ^ ks[ 25] ^ ks[ 23] ^ ks[ 20] ^ 0x9e3779b9 ^ 20), 11);
ks[ 29] = rotl32_S ((ks[ 28] ^ ks[ 26] ^ ks[ 24] ^ ks[ 21] ^ 0x9e3779b9 ^ 21), 11);
ks[ 30] = rotl32_S ((ks[ 29] ^ ks[ 27] ^ ks[ 25] ^ ks[ 22] ^ 0x9e3779b9 ^ 22), 11);
ks[ 31] = rotl32_S ((ks[ 30] ^ ks[ 28] ^ ks[ 26] ^ ks[ 23] ^ 0x9e3779b9 ^ 23), 11);
ks[ 32] = rotl32_S ((ks[ 31] ^ ks[ 29] ^ ks[ 27] ^ ks[ 24] ^ 0x9e3779b9 ^ 24), 11);
ks[ 33] = rotl32_S ((ks[ 32] ^ ks[ 30] ^ ks[ 28] ^ ks[ 25] ^ 0x9e3779b9 ^ 25), 11);
ks[ 34] = rotl32_S ((ks[ 33] ^ ks[ 31] ^ ks[ 29] ^ ks[ 26] ^ 0x9e3779b9 ^ 26), 11);
ks[ 35] = rotl32_S ((ks[ 34] ^ ks[ 32] ^ ks[ 30] ^ ks[ 27] ^ 0x9e3779b9 ^ 27), 11);
ks[ 36] = rotl32_S ((ks[ 35] ^ ks[ 33] ^ ks[ 31] ^ ks[ 28] ^ 0x9e3779b9 ^ 28), 11);
ks[ 37] = rotl32_S ((ks[ 36] ^ ks[ 34] ^ ks[ 32] ^ ks[ 29] ^ 0x9e3779b9 ^ 29), 11);
ks[ 38] = rotl32_S ((ks[ 37] ^ ks[ 35] ^ ks[ 33] ^ ks[ 30] ^ 0x9e3779b9 ^ 30), 11);
ks[ 39] = rotl32_S ((ks[ 38] ^ ks[ 36] ^ ks[ 34] ^ ks[ 31] ^ 0x9e3779b9 ^ 31), 11);
ks[ 40] = rotl32_S ((ks[ 39] ^ ks[ 37] ^ ks[ 35] ^ ks[ 32] ^ 0x9e3779b9 ^ 32), 11);
ks[ 41] = rotl32_S ((ks[ 40] ^ ks[ 38] ^ ks[ 36] ^ ks[ 33] ^ 0x9e3779b9 ^ 33), 11);
ks[ 42] = rotl32_S ((ks[ 41] ^ ks[ 39] ^ ks[ 37] ^ ks[ 34] ^ 0x9e3779b9 ^ 34), 11);
ks[ 43] = rotl32_S ((ks[ 42] ^ ks[ 40] ^ ks[ 38] ^ ks[ 35] ^ 0x9e3779b9 ^ 35), 11);
ks[ 44] = rotl32_S ((ks[ 43] ^ ks[ 41] ^ ks[ 39] ^ ks[ 36] ^ 0x9e3779b9 ^ 36), 11);
ks[ 45] = rotl32_S ((ks[ 44] ^ ks[ 42] ^ ks[ 40] ^ ks[ 37] ^ 0x9e3779b9 ^ 37), 11);
ks[ 46] = rotl32_S ((ks[ 45] ^ ks[ 43] ^ ks[ 41] ^ ks[ 38] ^ 0x9e3779b9 ^ 38), 11);
ks[ 47] = rotl32_S ((ks[ 46] ^ ks[ 44] ^ ks[ 42] ^ ks[ 39] ^ 0x9e3779b9 ^ 39), 11);
ks[ 48] = rotl32_S ((ks[ 47] ^ ks[ 45] ^ ks[ 43] ^ ks[ 40] ^ 0x9e3779b9 ^ 40), 11);
ks[ 49] = rotl32_S ((ks[ 48] ^ ks[ 46] ^ ks[ 44] ^ ks[ 41] ^ 0x9e3779b9 ^ 41), 11);
ks[ 50] = rotl32_S ((ks[ 49] ^ ks[ 47] ^ ks[ 45] ^ ks[ 42] ^ 0x9e3779b9 ^ 42), 11);
ks[ 51] = rotl32_S ((ks[ 50] ^ ks[ 48] ^ ks[ 46] ^ ks[ 43] ^ 0x9e3779b9 ^ 43), 11);
ks[ 52] = rotl32_S ((ks[ 51] ^ ks[ 49] ^ ks[ 47] ^ ks[ 44] ^ 0x9e3779b9 ^ 44), 11);
ks[ 53] = rotl32_S ((ks[ 52] ^ ks[ 50] ^ ks[ 48] ^ ks[ 45] ^ 0x9e3779b9 ^ 45), 11);
ks[ 54] = rotl32_S ((ks[ 53] ^ ks[ 51] ^ ks[ 49] ^ ks[ 46] ^ 0x9e3779b9 ^ 46), 11);
ks[ 55] = rotl32_S ((ks[ 54] ^ ks[ 52] ^ ks[ 50] ^ ks[ 47] ^ 0x9e3779b9 ^ 47), 11);
ks[ 56] = rotl32_S ((ks[ 55] ^ ks[ 53] ^ ks[ 51] ^ ks[ 48] ^ 0x9e3779b9 ^ 48), 11);
ks[ 57] = rotl32_S ((ks[ 56] ^ ks[ 54] ^ ks[ 52] ^ ks[ 49] ^ 0x9e3779b9 ^ 49), 11);
ks[ 58] = rotl32_S ((ks[ 57] ^ ks[ 55] ^ ks[ 53] ^ ks[ 50] ^ 0x9e3779b9 ^ 50), 11);
ks[ 59] = rotl32_S ((ks[ 58] ^ ks[ 56] ^ ks[ 54] ^ ks[ 51] ^ 0x9e3779b9 ^ 51), 11);
ks[ 60] = rotl32_S ((ks[ 59] ^ ks[ 57] ^ ks[ 55] ^ ks[ 52] ^ 0x9e3779b9 ^ 52), 11);
ks[ 61] = rotl32_S ((ks[ 60] ^ ks[ 58] ^ ks[ 56] ^ ks[ 53] ^ 0x9e3779b9 ^ 53), 11);
ks[ 62] = rotl32_S ((ks[ 61] ^ ks[ 59] ^ ks[ 57] ^ ks[ 54] ^ 0x9e3779b9 ^ 54), 11);
ks[ 63] = rotl32_S ((ks[ 62] ^ ks[ 60] ^ ks[ 58] ^ ks[ 55] ^ 0x9e3779b9 ^ 55), 11);
ks[ 64] = rotl32_S ((ks[ 63] ^ ks[ 61] ^ ks[ 59] ^ ks[ 56] ^ 0x9e3779b9 ^ 56), 11);
ks[ 65] = rotl32_S ((ks[ 64] ^ ks[ 62] ^ ks[ 60] ^ ks[ 57] ^ 0x9e3779b9 ^ 57), 11);
ks[ 66] = rotl32_S ((ks[ 65] ^ ks[ 63] ^ ks[ 61] ^ ks[ 58] ^ 0x9e3779b9 ^ 58), 11);
ks[ 67] = rotl32_S ((ks[ 66] ^ ks[ 64] ^ ks[ 62] ^ ks[ 59] ^ 0x9e3779b9 ^ 59), 11);
ks[ 68] = rotl32_S ((ks[ 67] ^ ks[ 65] ^ ks[ 63] ^ ks[ 60] ^ 0x9e3779b9 ^ 60), 11);
ks[ 69] = rotl32_S ((ks[ 68] ^ ks[ 66] ^ ks[ 64] ^ ks[ 61] ^ 0x9e3779b9 ^ 61), 11);
ks[ 70] = rotl32_S ((ks[ 69] ^ ks[ 67] ^ ks[ 65] ^ ks[ 62] ^ 0x9e3779b9 ^ 62), 11);
ks[ 71] = rotl32_S ((ks[ 70] ^ ks[ 68] ^ ks[ 66] ^ ks[ 63] ^ 0x9e3779b9 ^ 63), 11);
ks[ 72] = rotl32_S ((ks[ 71] ^ ks[ 69] ^ ks[ 67] ^ ks[ 64] ^ 0x9e3779b9 ^ 64), 11);
ks[ 73] = rotl32_S ((ks[ 72] ^ ks[ 70] ^ ks[ 68] ^ ks[ 65] ^ 0x9e3779b9 ^ 65), 11);
ks[ 74] = rotl32_S ((ks[ 73] ^ ks[ 71] ^ ks[ 69] ^ ks[ 66] ^ 0x9e3779b9 ^ 66), 11);
ks[ 75] = rotl32_S ((ks[ 74] ^ ks[ 72] ^ ks[ 70] ^ ks[ 67] ^ 0x9e3779b9 ^ 67), 11);
ks[ 76] = rotl32_S ((ks[ 75] ^ ks[ 73] ^ ks[ 71] ^ ks[ 68] ^ 0x9e3779b9 ^ 68), 11);
ks[ 77] = rotl32_S ((ks[ 76] ^ ks[ 74] ^ ks[ 72] ^ ks[ 69] ^ 0x9e3779b9 ^ 69), 11);
ks[ 78] = rotl32_S ((ks[ 77] ^ ks[ 75] ^ ks[ 73] ^ ks[ 70] ^ 0x9e3779b9 ^ 70), 11);
ks[ 79] = rotl32_S ((ks[ 78] ^ ks[ 76] ^ ks[ 74] ^ ks[ 71] ^ 0x9e3779b9 ^ 71), 11);
ks[ 80] = rotl32_S ((ks[ 79] ^ ks[ 77] ^ ks[ 75] ^ ks[ 72] ^ 0x9e3779b9 ^ 72), 11);
ks[ 81] = rotl32_S ((ks[ 80] ^ ks[ 78] ^ ks[ 76] ^ ks[ 73] ^ 0x9e3779b9 ^ 73), 11);
ks[ 82] = rotl32_S ((ks[ 81] ^ ks[ 79] ^ ks[ 77] ^ ks[ 74] ^ 0x9e3779b9 ^ 74), 11);
ks[ 83] = rotl32_S ((ks[ 82] ^ ks[ 80] ^ ks[ 78] ^ ks[ 75] ^ 0x9e3779b9 ^ 75), 11);
ks[ 84] = rotl32_S ((ks[ 83] ^ ks[ 81] ^ ks[ 79] ^ ks[ 76] ^ 0x9e3779b9 ^ 76), 11);
ks[ 85] = rotl32_S ((ks[ 84] ^ ks[ 82] ^ ks[ 80] ^ ks[ 77] ^ 0x9e3779b9 ^ 77), 11);
ks[ 86] = rotl32_S ((ks[ 85] ^ ks[ 83] ^ ks[ 81] ^ ks[ 78] ^ 0x9e3779b9 ^ 78), 11);
ks[ 87] = rotl32_S ((ks[ 86] ^ ks[ 84] ^ ks[ 82] ^ ks[ 79] ^ 0x9e3779b9 ^ 79), 11);
ks[ 88] = rotl32_S ((ks[ 87] ^ ks[ 85] ^ ks[ 83] ^ ks[ 80] ^ 0x9e3779b9 ^ 80), 11);
ks[ 89] = rotl32_S ((ks[ 88] ^ ks[ 86] ^ ks[ 84] ^ ks[ 81] ^ 0x9e3779b9 ^ 81), 11);
ks[ 90] = rotl32_S ((ks[ 89] ^ ks[ 87] ^ ks[ 85] ^ ks[ 82] ^ 0x9e3779b9 ^ 82), 11);
ks[ 91] = rotl32_S ((ks[ 90] ^ ks[ 88] ^ ks[ 86] ^ ks[ 83] ^ 0x9e3779b9 ^ 83), 11);
ks[ 92] = rotl32_S ((ks[ 91] ^ ks[ 89] ^ ks[ 87] ^ ks[ 84] ^ 0x9e3779b9 ^ 84), 11);
ks[ 93] = rotl32_S ((ks[ 92] ^ ks[ 90] ^ ks[ 88] ^ ks[ 85] ^ 0x9e3779b9 ^ 85), 11);
ks[ 94] = rotl32_S ((ks[ 93] ^ ks[ 91] ^ ks[ 89] ^ ks[ 86] ^ 0x9e3779b9 ^ 86), 11);
ks[ 95] = rotl32_S ((ks[ 94] ^ ks[ 92] ^ ks[ 90] ^ ks[ 87] ^ 0x9e3779b9 ^ 87), 11);
ks[ 96] = rotl32_S ((ks[ 95] ^ ks[ 93] ^ ks[ 91] ^ ks[ 88] ^ 0x9e3779b9 ^ 88), 11);
ks[ 97] = rotl32_S ((ks[ 96] ^ ks[ 94] ^ ks[ 92] ^ ks[ 89] ^ 0x9e3779b9 ^ 89), 11);
ks[ 98] = rotl32_S ((ks[ 97] ^ ks[ 95] ^ ks[ 93] ^ ks[ 90] ^ 0x9e3779b9 ^ 90), 11);
ks[ 99] = rotl32_S ((ks[ 98] ^ ks[ 96] ^ ks[ 94] ^ ks[ 91] ^ 0x9e3779b9 ^ 91), 11);
ks[100] = rotl32_S ((ks[ 99] ^ ks[ 97] ^ ks[ 95] ^ ks[ 92] ^ 0x9e3779b9 ^ 92), 11);
ks[101] = rotl32_S ((ks[100] ^ ks[ 98] ^ ks[ 96] ^ ks[ 93] ^ 0x9e3779b9 ^ 93), 11);
ks[102] = rotl32_S ((ks[101] ^ ks[ 99] ^ ks[ 97] ^ ks[ 94] ^ 0x9e3779b9 ^ 94), 11);
ks[103] = rotl32_S ((ks[102] ^ ks[100] ^ ks[ 98] ^ ks[ 95] ^ 0x9e3779b9 ^ 95), 11);
ks[104] = rotl32_S ((ks[103] ^ ks[101] ^ ks[ 99] ^ ks[ 96] ^ 0x9e3779b9 ^ 96), 11);
ks[105] = rotl32_S ((ks[104] ^ ks[102] ^ ks[100] ^ ks[ 97] ^ 0x9e3779b9 ^ 97), 11);
ks[106] = rotl32_S ((ks[105] ^ ks[103] ^ ks[101] ^ ks[ 98] ^ 0x9e3779b9 ^ 98), 11);
ks[107] = rotl32_S ((ks[106] ^ ks[104] ^ ks[102] ^ ks[ 99] ^ 0x9e3779b9 ^ 99), 11);
ks[108] = rotl32_S ((ks[107] ^ ks[105] ^ ks[103] ^ ks[100] ^ 0x9e3779b9 ^ 100), 11);
ks[109] = rotl32_S ((ks[108] ^ ks[106] ^ ks[104] ^ ks[101] ^ 0x9e3779b9 ^ 101), 11);
ks[110] = rotl32_S ((ks[109] ^ ks[107] ^ ks[105] ^ ks[102] ^ 0x9e3779b9 ^ 102), 11);
ks[111] = rotl32_S ((ks[110] ^ ks[108] ^ ks[106] ^ ks[103] ^ 0x9e3779b9 ^ 103), 11);
ks[112] = rotl32_S ((ks[111] ^ ks[109] ^ ks[107] ^ ks[104] ^ 0x9e3779b9 ^ 104), 11);
ks[113] = rotl32_S ((ks[112] ^ ks[110] ^ ks[108] ^ ks[105] ^ 0x9e3779b9 ^ 105), 11);
ks[114] = rotl32_S ((ks[113] ^ ks[111] ^ ks[109] ^ ks[106] ^ 0x9e3779b9 ^ 106), 11);
ks[115] = rotl32_S ((ks[114] ^ ks[112] ^ ks[110] ^ ks[107] ^ 0x9e3779b9 ^ 107), 11);
ks[116] = rotl32_S ((ks[115] ^ ks[113] ^ ks[111] ^ ks[108] ^ 0x9e3779b9 ^ 108), 11);
ks[117] = rotl32_S ((ks[116] ^ ks[114] ^ ks[112] ^ ks[109] ^ 0x9e3779b9 ^ 109), 11);
ks[118] = rotl32_S ((ks[117] ^ ks[115] ^ ks[113] ^ ks[110] ^ 0x9e3779b9 ^ 110), 11);
ks[119] = rotl32_S ((ks[118] ^ ks[116] ^ ks[114] ^ ks[111] ^ 0x9e3779b9 ^ 111), 11);
ks[120] = rotl32_S ((ks[119] ^ ks[117] ^ ks[115] ^ ks[112] ^ 0x9e3779b9 ^ 112), 11);
ks[121] = rotl32_S ((ks[120] ^ ks[118] ^ ks[116] ^ ks[113] ^ 0x9e3779b9 ^ 113), 11);
ks[122] = rotl32_S ((ks[121] ^ ks[119] ^ ks[117] ^ ks[114] ^ 0x9e3779b9 ^ 114), 11);
ks[123] = rotl32_S ((ks[122] ^ ks[120] ^ ks[118] ^ ks[115] ^ 0x9e3779b9 ^ 115), 11);
ks[124] = rotl32_S ((ks[123] ^ ks[121] ^ ks[119] ^ ks[116] ^ 0x9e3779b9 ^ 116), 11);
ks[125] = rotl32_S ((ks[124] ^ ks[122] ^ ks[120] ^ ks[117] ^ 0x9e3779b9 ^ 117), 11);
ks[126] = rotl32_S ((ks[125] ^ ks[123] ^ ks[121] ^ ks[118] ^ 0x9e3779b9 ^ 118), 11);
ks[127] = rotl32_S ((ks[126] ^ ks[124] ^ ks[122] ^ ks[119] ^ 0x9e3779b9 ^ 119), 11);
ks[128] = rotl32_S ((ks[127] ^ ks[125] ^ ks[123] ^ ks[120] ^ 0x9e3779b9 ^ 120), 11);
ks[129] = rotl32_S ((ks[128] ^ ks[126] ^ ks[124] ^ ks[121] ^ 0x9e3779b9 ^ 121), 11);
ks[130] = rotl32_S ((ks[129] ^ ks[127] ^ ks[125] ^ ks[122] ^ 0x9e3779b9 ^ 122), 11);
ks[131] = rotl32_S ((ks[130] ^ ks[128] ^ ks[126] ^ ks[123] ^ 0x9e3779b9 ^ 123), 11);
ks[132] = rotl32_S ((ks[131] ^ ks[129] ^ ks[127] ^ ks[124] ^ 0x9e3779b9 ^ 124), 11);
ks[133] = rotl32_S ((ks[132] ^ ks[130] ^ ks[128] ^ ks[125] ^ 0x9e3779b9 ^ 125), 11);
ks[134] = rotl32_S ((ks[133] ^ ks[131] ^ ks[129] ^ ks[126] ^ 0x9e3779b9 ^ 126), 11);
ks[135] = rotl32_S ((ks[134] ^ ks[132] ^ ks[130] ^ ks[127] ^ 0x9e3779b9 ^ 127), 11);
ks[136] = rotl32_S ((ks[135] ^ ks[133] ^ ks[131] ^ ks[128] ^ 0x9e3779b9 ^ 128), 11);
ks[137] = rotl32_S ((ks[136] ^ ks[134] ^ ks[132] ^ ks[129] ^ 0x9e3779b9 ^ 129), 11);
ks[138] = rotl32_S ((ks[137] ^ ks[135] ^ ks[133] ^ ks[130] ^ 0x9e3779b9 ^ 130), 11);
ks[139] = rotl32_S ((ks[138] ^ ks[136] ^ ks[134] ^ ks[131] ^ 0x9e3779b9 ^ 131), 11);
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;
u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
@ -469,6 +585,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey)
k_set(32,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(32,e,f,g,h); k_set(32,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(32,e,f,g,h);
} }
DECLSPEC void serpent128_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent128_encrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void serpent128_encrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;
@ -519,6 +636,7 @@ DECLSPEC void serpent128_encrypt (const u32 *ks, const u32 *in, u32 *out)
out[3] = d; out[3] = d;
} }
DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;
@ -571,23 +689,149 @@ DECLSPEC void serpent128_decrypt (const u32 *ks, const u32 *in, u32 *out)
// 256 bit key // 256 bit key
DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey);
DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey) DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey)
{ {
#ifdef _unroll ks[ 0] = ukey[0];
#pragma unroll ks[ 1] = ukey[1];
#endif ks[ 2] = ukey[2];
for (int i = 0; i < 8; i++) ks[ 3] = ukey[3];
{ ks[ 4] = ukey[4];
ks[i] = ukey[i]; ks[ 5] = ukey[5];
} ks[ 6] = ukey[6];
ks[ 7] = ukey[7];
#ifdef _unroll ks[ 8] = rotl32_S ((ks[ 7] ^ ks[ 5] ^ ks[ 3] ^ ks[ 0] ^ 0x9e3779b9 ^ 0), 11);
#pragma unroll ks[ 9] = rotl32_S ((ks[ 8] ^ ks[ 6] ^ ks[ 4] ^ ks[ 1] ^ 0x9e3779b9 ^ 1), 11);
#endif ks[ 10] = rotl32_S ((ks[ 9] ^ ks[ 7] ^ ks[ 5] ^ ks[ 2] ^ 0x9e3779b9 ^ 2), 11);
for (int i = 0; i < 132; i++) ks[ 11] = rotl32_S ((ks[ 10] ^ ks[ 8] ^ ks[ 6] ^ ks[ 3] ^ 0x9e3779b9 ^ 3), 11);
{ ks[ 12] = rotl32_S ((ks[ 11] ^ ks[ 9] ^ ks[ 7] ^ ks[ 4] ^ 0x9e3779b9 ^ 4), 11);
ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); ks[ 13] = rotl32_S ((ks[ 12] ^ ks[ 10] ^ ks[ 8] ^ ks[ 5] ^ 0x9e3779b9 ^ 5), 11);
} ks[ 14] = rotl32_S ((ks[ 13] ^ ks[ 11] ^ ks[ 9] ^ ks[ 6] ^ 0x9e3779b9 ^ 6), 11);
ks[ 15] = rotl32_S ((ks[ 14] ^ ks[ 12] ^ ks[ 10] ^ ks[ 7] ^ 0x9e3779b9 ^ 7), 11);
ks[ 16] = rotl32_S ((ks[ 15] ^ ks[ 13] ^ ks[ 11] ^ ks[ 8] ^ 0x9e3779b9 ^ 8), 11);
ks[ 17] = rotl32_S ((ks[ 16] ^ ks[ 14] ^ ks[ 12] ^ ks[ 9] ^ 0x9e3779b9 ^ 9), 11);
ks[ 18] = rotl32_S ((ks[ 17] ^ ks[ 15] ^ ks[ 13] ^ ks[ 10] ^ 0x9e3779b9 ^ 10), 11);
ks[ 19] = rotl32_S ((ks[ 18] ^ ks[ 16] ^ ks[ 14] ^ ks[ 11] ^ 0x9e3779b9 ^ 11), 11);
ks[ 20] = rotl32_S ((ks[ 19] ^ ks[ 17] ^ ks[ 15] ^ ks[ 12] ^ 0x9e3779b9 ^ 12), 11);
ks[ 21] = rotl32_S ((ks[ 20] ^ ks[ 18] ^ ks[ 16] ^ ks[ 13] ^ 0x9e3779b9 ^ 13), 11);
ks[ 22] = rotl32_S ((ks[ 21] ^ ks[ 19] ^ ks[ 17] ^ ks[ 14] ^ 0x9e3779b9 ^ 14), 11);
ks[ 23] = rotl32_S ((ks[ 22] ^ ks[ 20] ^ ks[ 18] ^ ks[ 15] ^ 0x9e3779b9 ^ 15), 11);
ks[ 24] = rotl32_S ((ks[ 23] ^ ks[ 21] ^ ks[ 19] ^ ks[ 16] ^ 0x9e3779b9 ^ 16), 11);
ks[ 25] = rotl32_S ((ks[ 24] ^ ks[ 22] ^ ks[ 20] ^ ks[ 17] ^ 0x9e3779b9 ^ 17), 11);
ks[ 26] = rotl32_S ((ks[ 25] ^ ks[ 23] ^ ks[ 21] ^ ks[ 18] ^ 0x9e3779b9 ^ 18), 11);
ks[ 27] = rotl32_S ((ks[ 26] ^ ks[ 24] ^ ks[ 22] ^ ks[ 19] ^ 0x9e3779b9 ^ 19), 11);
ks[ 28] = rotl32_S ((ks[ 27] ^ ks[ 25] ^ ks[ 23] ^ ks[ 20] ^ 0x9e3779b9 ^ 20), 11);
ks[ 29] = rotl32_S ((ks[ 28] ^ ks[ 26] ^ ks[ 24] ^ ks[ 21] ^ 0x9e3779b9 ^ 21), 11);
ks[ 30] = rotl32_S ((ks[ 29] ^ ks[ 27] ^ ks[ 25] ^ ks[ 22] ^ 0x9e3779b9 ^ 22), 11);
ks[ 31] = rotl32_S ((ks[ 30] ^ ks[ 28] ^ ks[ 26] ^ ks[ 23] ^ 0x9e3779b9 ^ 23), 11);
ks[ 32] = rotl32_S ((ks[ 31] ^ ks[ 29] ^ ks[ 27] ^ ks[ 24] ^ 0x9e3779b9 ^ 24), 11);
ks[ 33] = rotl32_S ((ks[ 32] ^ ks[ 30] ^ ks[ 28] ^ ks[ 25] ^ 0x9e3779b9 ^ 25), 11);
ks[ 34] = rotl32_S ((ks[ 33] ^ ks[ 31] ^ ks[ 29] ^ ks[ 26] ^ 0x9e3779b9 ^ 26), 11);
ks[ 35] = rotl32_S ((ks[ 34] ^ ks[ 32] ^ ks[ 30] ^ ks[ 27] ^ 0x9e3779b9 ^ 27), 11);
ks[ 36] = rotl32_S ((ks[ 35] ^ ks[ 33] ^ ks[ 31] ^ ks[ 28] ^ 0x9e3779b9 ^ 28), 11);
ks[ 37] = rotl32_S ((ks[ 36] ^ ks[ 34] ^ ks[ 32] ^ ks[ 29] ^ 0x9e3779b9 ^ 29), 11);
ks[ 38] = rotl32_S ((ks[ 37] ^ ks[ 35] ^ ks[ 33] ^ ks[ 30] ^ 0x9e3779b9 ^ 30), 11);
ks[ 39] = rotl32_S ((ks[ 38] ^ ks[ 36] ^ ks[ 34] ^ ks[ 31] ^ 0x9e3779b9 ^ 31), 11);
ks[ 40] = rotl32_S ((ks[ 39] ^ ks[ 37] ^ ks[ 35] ^ ks[ 32] ^ 0x9e3779b9 ^ 32), 11);
ks[ 41] = rotl32_S ((ks[ 40] ^ ks[ 38] ^ ks[ 36] ^ ks[ 33] ^ 0x9e3779b9 ^ 33), 11);
ks[ 42] = rotl32_S ((ks[ 41] ^ ks[ 39] ^ ks[ 37] ^ ks[ 34] ^ 0x9e3779b9 ^ 34), 11);
ks[ 43] = rotl32_S ((ks[ 42] ^ ks[ 40] ^ ks[ 38] ^ ks[ 35] ^ 0x9e3779b9 ^ 35), 11);
ks[ 44] = rotl32_S ((ks[ 43] ^ ks[ 41] ^ ks[ 39] ^ ks[ 36] ^ 0x9e3779b9 ^ 36), 11);
ks[ 45] = rotl32_S ((ks[ 44] ^ ks[ 42] ^ ks[ 40] ^ ks[ 37] ^ 0x9e3779b9 ^ 37), 11);
ks[ 46] = rotl32_S ((ks[ 45] ^ ks[ 43] ^ ks[ 41] ^ ks[ 38] ^ 0x9e3779b9 ^ 38), 11);
ks[ 47] = rotl32_S ((ks[ 46] ^ ks[ 44] ^ ks[ 42] ^ ks[ 39] ^ 0x9e3779b9 ^ 39), 11);
ks[ 48] = rotl32_S ((ks[ 47] ^ ks[ 45] ^ ks[ 43] ^ ks[ 40] ^ 0x9e3779b9 ^ 40), 11);
ks[ 49] = rotl32_S ((ks[ 48] ^ ks[ 46] ^ ks[ 44] ^ ks[ 41] ^ 0x9e3779b9 ^ 41), 11);
ks[ 50] = rotl32_S ((ks[ 49] ^ ks[ 47] ^ ks[ 45] ^ ks[ 42] ^ 0x9e3779b9 ^ 42), 11);
ks[ 51] = rotl32_S ((ks[ 50] ^ ks[ 48] ^ ks[ 46] ^ ks[ 43] ^ 0x9e3779b9 ^ 43), 11);
ks[ 52] = rotl32_S ((ks[ 51] ^ ks[ 49] ^ ks[ 47] ^ ks[ 44] ^ 0x9e3779b9 ^ 44), 11);
ks[ 53] = rotl32_S ((ks[ 52] ^ ks[ 50] ^ ks[ 48] ^ ks[ 45] ^ 0x9e3779b9 ^ 45), 11);
ks[ 54] = rotl32_S ((ks[ 53] ^ ks[ 51] ^ ks[ 49] ^ ks[ 46] ^ 0x9e3779b9 ^ 46), 11);
ks[ 55] = rotl32_S ((ks[ 54] ^ ks[ 52] ^ ks[ 50] ^ ks[ 47] ^ 0x9e3779b9 ^ 47), 11);
ks[ 56] = rotl32_S ((ks[ 55] ^ ks[ 53] ^ ks[ 51] ^ ks[ 48] ^ 0x9e3779b9 ^ 48), 11);
ks[ 57] = rotl32_S ((ks[ 56] ^ ks[ 54] ^ ks[ 52] ^ ks[ 49] ^ 0x9e3779b9 ^ 49), 11);
ks[ 58] = rotl32_S ((ks[ 57] ^ ks[ 55] ^ ks[ 53] ^ ks[ 50] ^ 0x9e3779b9 ^ 50), 11);
ks[ 59] = rotl32_S ((ks[ 58] ^ ks[ 56] ^ ks[ 54] ^ ks[ 51] ^ 0x9e3779b9 ^ 51), 11);
ks[ 60] = rotl32_S ((ks[ 59] ^ ks[ 57] ^ ks[ 55] ^ ks[ 52] ^ 0x9e3779b9 ^ 52), 11);
ks[ 61] = rotl32_S ((ks[ 60] ^ ks[ 58] ^ ks[ 56] ^ ks[ 53] ^ 0x9e3779b9 ^ 53), 11);
ks[ 62] = rotl32_S ((ks[ 61] ^ ks[ 59] ^ ks[ 57] ^ ks[ 54] ^ 0x9e3779b9 ^ 54), 11);
ks[ 63] = rotl32_S ((ks[ 62] ^ ks[ 60] ^ ks[ 58] ^ ks[ 55] ^ 0x9e3779b9 ^ 55), 11);
ks[ 64] = rotl32_S ((ks[ 63] ^ ks[ 61] ^ ks[ 59] ^ ks[ 56] ^ 0x9e3779b9 ^ 56), 11);
ks[ 65] = rotl32_S ((ks[ 64] ^ ks[ 62] ^ ks[ 60] ^ ks[ 57] ^ 0x9e3779b9 ^ 57), 11);
ks[ 66] = rotl32_S ((ks[ 65] ^ ks[ 63] ^ ks[ 61] ^ ks[ 58] ^ 0x9e3779b9 ^ 58), 11);
ks[ 67] = rotl32_S ((ks[ 66] ^ ks[ 64] ^ ks[ 62] ^ ks[ 59] ^ 0x9e3779b9 ^ 59), 11);
ks[ 68] = rotl32_S ((ks[ 67] ^ ks[ 65] ^ ks[ 63] ^ ks[ 60] ^ 0x9e3779b9 ^ 60), 11);
ks[ 69] = rotl32_S ((ks[ 68] ^ ks[ 66] ^ ks[ 64] ^ ks[ 61] ^ 0x9e3779b9 ^ 61), 11);
ks[ 70] = rotl32_S ((ks[ 69] ^ ks[ 67] ^ ks[ 65] ^ ks[ 62] ^ 0x9e3779b9 ^ 62), 11);
ks[ 71] = rotl32_S ((ks[ 70] ^ ks[ 68] ^ ks[ 66] ^ ks[ 63] ^ 0x9e3779b9 ^ 63), 11);
ks[ 72] = rotl32_S ((ks[ 71] ^ ks[ 69] ^ ks[ 67] ^ ks[ 64] ^ 0x9e3779b9 ^ 64), 11);
ks[ 73] = rotl32_S ((ks[ 72] ^ ks[ 70] ^ ks[ 68] ^ ks[ 65] ^ 0x9e3779b9 ^ 65), 11);
ks[ 74] = rotl32_S ((ks[ 73] ^ ks[ 71] ^ ks[ 69] ^ ks[ 66] ^ 0x9e3779b9 ^ 66), 11);
ks[ 75] = rotl32_S ((ks[ 74] ^ ks[ 72] ^ ks[ 70] ^ ks[ 67] ^ 0x9e3779b9 ^ 67), 11);
ks[ 76] = rotl32_S ((ks[ 75] ^ ks[ 73] ^ ks[ 71] ^ ks[ 68] ^ 0x9e3779b9 ^ 68), 11);
ks[ 77] = rotl32_S ((ks[ 76] ^ ks[ 74] ^ ks[ 72] ^ ks[ 69] ^ 0x9e3779b9 ^ 69), 11);
ks[ 78] = rotl32_S ((ks[ 77] ^ ks[ 75] ^ ks[ 73] ^ ks[ 70] ^ 0x9e3779b9 ^ 70), 11);
ks[ 79] = rotl32_S ((ks[ 78] ^ ks[ 76] ^ ks[ 74] ^ ks[ 71] ^ 0x9e3779b9 ^ 71), 11);
ks[ 80] = rotl32_S ((ks[ 79] ^ ks[ 77] ^ ks[ 75] ^ ks[ 72] ^ 0x9e3779b9 ^ 72), 11);
ks[ 81] = rotl32_S ((ks[ 80] ^ ks[ 78] ^ ks[ 76] ^ ks[ 73] ^ 0x9e3779b9 ^ 73), 11);
ks[ 82] = rotl32_S ((ks[ 81] ^ ks[ 79] ^ ks[ 77] ^ ks[ 74] ^ 0x9e3779b9 ^ 74), 11);
ks[ 83] = rotl32_S ((ks[ 82] ^ ks[ 80] ^ ks[ 78] ^ ks[ 75] ^ 0x9e3779b9 ^ 75), 11);
ks[ 84] = rotl32_S ((ks[ 83] ^ ks[ 81] ^ ks[ 79] ^ ks[ 76] ^ 0x9e3779b9 ^ 76), 11);
ks[ 85] = rotl32_S ((ks[ 84] ^ ks[ 82] ^ ks[ 80] ^ ks[ 77] ^ 0x9e3779b9 ^ 77), 11);
ks[ 86] = rotl32_S ((ks[ 85] ^ ks[ 83] ^ ks[ 81] ^ ks[ 78] ^ 0x9e3779b9 ^ 78), 11);
ks[ 87] = rotl32_S ((ks[ 86] ^ ks[ 84] ^ ks[ 82] ^ ks[ 79] ^ 0x9e3779b9 ^ 79), 11);
ks[ 88] = rotl32_S ((ks[ 87] ^ ks[ 85] ^ ks[ 83] ^ ks[ 80] ^ 0x9e3779b9 ^ 80), 11);
ks[ 89] = rotl32_S ((ks[ 88] ^ ks[ 86] ^ ks[ 84] ^ ks[ 81] ^ 0x9e3779b9 ^ 81), 11);
ks[ 90] = rotl32_S ((ks[ 89] ^ ks[ 87] ^ ks[ 85] ^ ks[ 82] ^ 0x9e3779b9 ^ 82), 11);
ks[ 91] = rotl32_S ((ks[ 90] ^ ks[ 88] ^ ks[ 86] ^ ks[ 83] ^ 0x9e3779b9 ^ 83), 11);
ks[ 92] = rotl32_S ((ks[ 91] ^ ks[ 89] ^ ks[ 87] ^ ks[ 84] ^ 0x9e3779b9 ^ 84), 11);
ks[ 93] = rotl32_S ((ks[ 92] ^ ks[ 90] ^ ks[ 88] ^ ks[ 85] ^ 0x9e3779b9 ^ 85), 11);
ks[ 94] = rotl32_S ((ks[ 93] ^ ks[ 91] ^ ks[ 89] ^ ks[ 86] ^ 0x9e3779b9 ^ 86), 11);
ks[ 95] = rotl32_S ((ks[ 94] ^ ks[ 92] ^ ks[ 90] ^ ks[ 87] ^ 0x9e3779b9 ^ 87), 11);
ks[ 96] = rotl32_S ((ks[ 95] ^ ks[ 93] ^ ks[ 91] ^ ks[ 88] ^ 0x9e3779b9 ^ 88), 11);
ks[ 97] = rotl32_S ((ks[ 96] ^ ks[ 94] ^ ks[ 92] ^ ks[ 89] ^ 0x9e3779b9 ^ 89), 11);
ks[ 98] = rotl32_S ((ks[ 97] ^ ks[ 95] ^ ks[ 93] ^ ks[ 90] ^ 0x9e3779b9 ^ 90), 11);
ks[ 99] = rotl32_S ((ks[ 98] ^ ks[ 96] ^ ks[ 94] ^ ks[ 91] ^ 0x9e3779b9 ^ 91), 11);
ks[100] = rotl32_S ((ks[ 99] ^ ks[ 97] ^ ks[ 95] ^ ks[ 92] ^ 0x9e3779b9 ^ 92), 11);
ks[101] = rotl32_S ((ks[100] ^ ks[ 98] ^ ks[ 96] ^ ks[ 93] ^ 0x9e3779b9 ^ 93), 11);
ks[102] = rotl32_S ((ks[101] ^ ks[ 99] ^ ks[ 97] ^ ks[ 94] ^ 0x9e3779b9 ^ 94), 11);
ks[103] = rotl32_S ((ks[102] ^ ks[100] ^ ks[ 98] ^ ks[ 95] ^ 0x9e3779b9 ^ 95), 11);
ks[104] = rotl32_S ((ks[103] ^ ks[101] ^ ks[ 99] ^ ks[ 96] ^ 0x9e3779b9 ^ 96), 11);
ks[105] = rotl32_S ((ks[104] ^ ks[102] ^ ks[100] ^ ks[ 97] ^ 0x9e3779b9 ^ 97), 11);
ks[106] = rotl32_S ((ks[105] ^ ks[103] ^ ks[101] ^ ks[ 98] ^ 0x9e3779b9 ^ 98), 11);
ks[107] = rotl32_S ((ks[106] ^ ks[104] ^ ks[102] ^ ks[ 99] ^ 0x9e3779b9 ^ 99), 11);
ks[108] = rotl32_S ((ks[107] ^ ks[105] ^ ks[103] ^ ks[100] ^ 0x9e3779b9 ^ 100), 11);
ks[109] = rotl32_S ((ks[108] ^ ks[106] ^ ks[104] ^ ks[101] ^ 0x9e3779b9 ^ 101), 11);
ks[110] = rotl32_S ((ks[109] ^ ks[107] ^ ks[105] ^ ks[102] ^ 0x9e3779b9 ^ 102), 11);
ks[111] = rotl32_S ((ks[110] ^ ks[108] ^ ks[106] ^ ks[103] ^ 0x9e3779b9 ^ 103), 11);
ks[112] = rotl32_S ((ks[111] ^ ks[109] ^ ks[107] ^ ks[104] ^ 0x9e3779b9 ^ 104), 11);
ks[113] = rotl32_S ((ks[112] ^ ks[110] ^ ks[108] ^ ks[105] ^ 0x9e3779b9 ^ 105), 11);
ks[114] = rotl32_S ((ks[113] ^ ks[111] ^ ks[109] ^ ks[106] ^ 0x9e3779b9 ^ 106), 11);
ks[115] = rotl32_S ((ks[114] ^ ks[112] ^ ks[110] ^ ks[107] ^ 0x9e3779b9 ^ 107), 11);
ks[116] = rotl32_S ((ks[115] ^ ks[113] ^ ks[111] ^ ks[108] ^ 0x9e3779b9 ^ 108), 11);
ks[117] = rotl32_S ((ks[116] ^ ks[114] ^ ks[112] ^ ks[109] ^ 0x9e3779b9 ^ 109), 11);
ks[118] = rotl32_S ((ks[117] ^ ks[115] ^ ks[113] ^ ks[110] ^ 0x9e3779b9 ^ 110), 11);
ks[119] = rotl32_S ((ks[118] ^ ks[116] ^ ks[114] ^ ks[111] ^ 0x9e3779b9 ^ 111), 11);
ks[120] = rotl32_S ((ks[119] ^ ks[117] ^ ks[115] ^ ks[112] ^ 0x9e3779b9 ^ 112), 11);
ks[121] = rotl32_S ((ks[120] ^ ks[118] ^ ks[116] ^ ks[113] ^ 0x9e3779b9 ^ 113), 11);
ks[122] = rotl32_S ((ks[121] ^ ks[119] ^ ks[117] ^ ks[114] ^ 0x9e3779b9 ^ 114), 11);
ks[123] = rotl32_S ((ks[122] ^ ks[120] ^ ks[118] ^ ks[115] ^ 0x9e3779b9 ^ 115), 11);
ks[124] = rotl32_S ((ks[123] ^ ks[121] ^ ks[119] ^ ks[116] ^ 0x9e3779b9 ^ 116), 11);
ks[125] = rotl32_S ((ks[124] ^ ks[122] ^ ks[120] ^ ks[117] ^ 0x9e3779b9 ^ 117), 11);
ks[126] = rotl32_S ((ks[125] ^ ks[123] ^ ks[121] ^ ks[118] ^ 0x9e3779b9 ^ 118), 11);
ks[127] = rotl32_S ((ks[126] ^ ks[124] ^ ks[122] ^ ks[119] ^ 0x9e3779b9 ^ 119), 11);
ks[128] = rotl32_S ((ks[127] ^ ks[125] ^ ks[123] ^ ks[120] ^ 0x9e3779b9 ^ 120), 11);
ks[129] = rotl32_S ((ks[128] ^ ks[126] ^ ks[124] ^ ks[121] ^ 0x9e3779b9 ^ 121), 11);
ks[130] = rotl32_S ((ks[129] ^ ks[127] ^ ks[125] ^ ks[122] ^ 0x9e3779b9 ^ 122), 11);
ks[131] = rotl32_S ((ks[130] ^ ks[128] ^ ks[126] ^ ks[123] ^ 0x9e3779b9 ^ 123), 11);
ks[132] = rotl32_S ((ks[131] ^ ks[129] ^ ks[127] ^ ks[124] ^ 0x9e3779b9 ^ 124), 11);
ks[133] = rotl32_S ((ks[132] ^ ks[130] ^ ks[128] ^ ks[125] ^ 0x9e3779b9 ^ 125), 11);
ks[134] = rotl32_S ((ks[133] ^ ks[131] ^ ks[129] ^ ks[126] ^ 0x9e3779b9 ^ 126), 11);
ks[135] = rotl32_S ((ks[134] ^ ks[132] ^ ks[130] ^ ks[127] ^ 0x9e3779b9 ^ 127), 11);
ks[136] = rotl32_S ((ks[135] ^ ks[133] ^ ks[131] ^ ks[128] ^ 0x9e3779b9 ^ 128), 11);
ks[137] = rotl32_S ((ks[136] ^ ks[134] ^ ks[132] ^ ks[129] ^ 0x9e3779b9 ^ 129), 11);
ks[138] = rotl32_S ((ks[137] ^ ks[135] ^ ks[133] ^ ks[130] ^ 0x9e3779b9 ^ 130), 11);
ks[139] = rotl32_S ((ks[138] ^ ks[136] ^ ks[134] ^ ks[131] ^ 0x9e3779b9 ^ 131), 11);
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;
u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; u32 t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
@ -627,6 +871,7 @@ DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey)
k_set(32,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(32,e,f,g,h); k_set(32,a,b,c,d); sb3(a,b,c,d,e,f,g,h); k_get(32,e,f,g,h);
} }
DECLSPEC void serpent256_encrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent256_encrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void serpent256_encrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;
@ -677,6 +922,7 @@ DECLSPEC void serpent256_encrypt (const u32 *ks, const u32 *in, u32 *out)
out[3] = d; out[3] = d;
} }
DECLSPEC void serpent256_decrypt (const u32 *ks, const u32 *in, u32 *out);
DECLSPEC void serpent256_decrypt (const u32 *ks, const u32 *in, u32 *out) DECLSPEC void serpent256_decrypt (const u32 *ks, const u32 *in, u32 *out)
{ {
u32 a,b,c,d,e,f,g,h; u32 a,b,c,d,e,f,g,h;

View File

@ -266,31 +266,35 @@ __constant u32a m_tab[4][256] =
#define q42(x,k) q (1, q (0, q (0, q (0, x) ^ extract_byte (k[3], 2)) ^ extract_byte (k[2], 2)) ^ extract_byte (k[1], 2)) ^ extract_byte (k[0], 2) #define q42(x,k) q (1, q (0, q (0, q (0, x) ^ extract_byte (k[3], 2)) ^ extract_byte (k[2], 2)) ^ extract_byte (k[1], 2)) ^ extract_byte (k[0], 2)
#define q43(x,k) q (1, q (1, q (0, q (1, x) ^ extract_byte (k[3], 3)) ^ extract_byte (k[2], 3)) ^ extract_byte (k[1], 3)) ^ extract_byte (k[0], 3) #define q43(x,k) q (1, q (1, q (0, q (1, x) ^ extract_byte (k[3], 3)) ^ extract_byte (k[2], 3)) ^ extract_byte (k[1], 3)) ^ extract_byte (k[0], 3)
DECLSPEC u32 mds_rem (u32 p0, u32 p1);
DECLSPEC u32 mds_rem (u32 p0, u32 p1) DECLSPEC u32 mds_rem (u32 p0, u32 p1)
{ {
#define G_MOD 0x14d #define G_MOD 0x14d
for (int i = 0; i < 8; i++) #define MDS_REM_ROUND() \
{ { \
u32 t = p1 >> 24; u32 t = p1 >> 24; \
p1 = (p1 << 8) | (p0 >> 24); \
p1 = (p1 << 8) | (p0 >> 24); p0 <<= 8; \
u32 u = (t << 1); \
p0 <<= 8; if (t & 0x80) u ^= G_MOD; \
p1 ^= t ^ (u << 16); \
u32 u = (t << 1); u ^= (t >> 1); \
if (t & 0x01) u ^= G_MOD >> 1; \
if (t & 0x80) u ^= G_MOD; p1 ^= (u << 24) | (u << 8); \
p1 ^= t ^ (u << 16);
u ^= (t >> 1);
if (t & 0x01) u ^= G_MOD >> 1;
p1 ^= (u << 24) | (u << 8);
} }
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
MDS_REM_ROUND();
#undef MDS_REM_ROUND
return p1; return p1;
} }
@ -332,6 +336,7 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1)
data[1] = rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \ data[1] = rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
} }
DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key);
DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key) DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key)
{ {
u32 b0, b1, b2, b3; u32 b0, b1, b2, b3;
@ -349,6 +354,7 @@ DECLSPEC u32 h_fun128 (u32 *sk, u32 *lk, const u32 x, const u32 *key)
return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3); return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3);
} }
DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey) DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey)
{ {
u32 me_key[2]; u32 me_key[2];
@ -379,6 +385,7 @@ DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey)
} }
} }
DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out) DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{ {
u32 data[4]; u32 data[4];
@ -403,6 +410,7 @@ DECLSPEC void twofish128_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u
out[3] = data[1] ^ lk[7]; out[3] = data[1] ^ lk[7];
} }
DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out) DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{ {
u32 data[4]; u32 data[4];
@ -465,6 +473,7 @@ DECLSPEC void twofish128_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u
data[1] = rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \ data[1] = rotr32_S (data[1] ^ (t2 + 2 * t3 + lk[4 * (i) + 9]), 1); \
} }
DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key);
DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key) DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key)
{ {
u32 b0, b1, b2, b3; u32 b0, b1, b2, b3;
@ -492,6 +501,7 @@ DECLSPEC u32 h_fun256 (u32 *sk, u32 *lk, const u32 x, const u32 *key)
return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3); return mds (0, b0) ^ mds (1, b1) ^ mds (2, b2) ^ mds (3, b3);
} }
DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey);
DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey) DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey)
{ {
u32 me_key[4]; u32 me_key[4];
@ -528,6 +538,7 @@ DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey)
} }
} }
DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out) DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{ {
u32 data[4]; u32 data[4];
@ -552,6 +563,7 @@ DECLSPEC void twofish256_encrypt (const u32 *sk, const u32 *lk, const u32 *in, u
out[3] = data[1] ^ lk[7]; out[3] = data[1] ^ lk[7];
} }
DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out);
DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out) DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u32 *out)
{ {
u32 data[4]; u32 data[4];

View File

@ -83,6 +83,7 @@
* pure scalar functions * pure scalar functions
*/ */
DECLSPEC int ffz (const u32 v);
DECLSPEC int ffz (const u32 v) DECLSPEC int ffz (const u32 v)
{ {
#ifdef _unroll #ifdef _unroll
@ -98,6 +99,7 @@ DECLSPEC int ffz (const u32 v)
return -1; return -1;
} }
DECLSPEC int hash_comp (const u32 *d1, __global const u32 *d2);
DECLSPEC int hash_comp (const u32 *d1, __global const u32 *d2) DECLSPEC int hash_comp (const u32 *d1, __global const u32 *d2)
{ {
if (d1[3] > d2[DGST_R3]) return ( 1); if (d1[3] > d2[DGST_R3]) return ( 1);
@ -112,6 +114,7 @@ DECLSPEC int hash_comp (const u32 *d1, __global const u32 *d2)
return (0); return (0);
} }
DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, __global const digest_t *digests_buf);
DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, __global const digest_t *digests_buf) DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, __global const digest_t *digests_buf)
{ {
for (u32 l = 0, r = digests_cnt; r; r >>= 1) for (u32 l = 0, r = digests_cnt; r; r >>= 1)
@ -135,11 +138,13 @@ DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, __global const
return (-1); return (-1);
} }
DECLSPEC u32 check_bitmap (__global const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest);
DECLSPEC u32 check_bitmap (__global const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest) DECLSPEC u32 check_bitmap (__global const u32 *bitmap, const u32 bitmap_mask, const u32 bitmap_shift, const u32 digest)
{ {
return (bitmap[(digest >> bitmap_shift) & bitmap_mask] & (1 << (digest & 0x1f))); return (bitmap[(digest >> bitmap_shift) & bitmap_mask] & (1 << (digest & 0x1f)));
} }
DECLSPEC u32 check (const u32 *digest, __global const u32 *bitmap_s1_a, __global const u32 *bitmap_s1_b, __global const u32 *bitmap_s1_c, __global const u32 *bitmap_s1_d, __global const u32 *bitmap_s2_a, __global const u32 *bitmap_s2_b, __global const u32 *bitmap_s2_c, __global const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2);
DECLSPEC u32 check (const u32 *digest, __global const u32 *bitmap_s1_a, __global const u32 *bitmap_s1_b, __global const u32 *bitmap_s1_c, __global const u32 *bitmap_s1_d, __global const u32 *bitmap_s2_a, __global const u32 *bitmap_s2_b, __global const u32 *bitmap_s2_c, __global const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2) DECLSPEC u32 check (const u32 *digest, __global const u32 *bitmap_s1_a, __global const u32 *bitmap_s1_b, __global const u32 *bitmap_s1_c, __global const u32 *bitmap_s1_d, __global const u32 *bitmap_s2_a, __global const u32 *bitmap_s2_b, __global const u32 *bitmap_s2_c, __global const u32 *bitmap_s2_d, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2)
{ {
if (check_bitmap (bitmap_s1_a, bitmap_mask, bitmap_shift1, digest[0]) == 0) return (0); if (check_bitmap (bitmap_s1_a, bitmap_mask, bitmap_shift1, digest[0]) == 0) return (0);
@ -155,7 +160,8 @@ DECLSPEC u32 check (const u32 *digest, __global const u32 *bitmap_s1_a, __global
return (1); return (1);
} }
DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos) DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2);
DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2)
{ {
const u32 idx = atomic_inc (d_result); const u32 idx = atomic_inc (d_result);
@ -169,13 +175,16 @@ DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, c
return; return;
} }
plains_buf[idx].salt_pos = salt_pos; plains_buf[idx].salt_pos = salt_pos;
plains_buf[idx].digest_pos = digest_pos; // relative plains_buf[idx].digest_pos = digest_pos; // relative
plains_buf[idx].hash_pos = hash_pos; // absolute plains_buf[idx].hash_pos = hash_pos; // absolute
plains_buf[idx].gidvid = gid; plains_buf[idx].gidvid = gid;
plains_buf[idx].il_pos = il_pos; plains_buf[idx].il_pos = il_pos;
plains_buf[idx].extra1 = extra1; // for example, used as veracrypt pim storage
plains_buf[idx].extra2 = extra2; // unused so far
} }
DECLSPEC int count_char (const u32 *buf, const int elems, const u32 c);
DECLSPEC int count_char (const u32 *buf, const int elems, const u32 c) DECLSPEC int count_char (const u32 *buf, const int elems, const u32 c)
{ {
int r = 0; int r = 0;
@ -193,6 +202,7 @@ DECLSPEC int count_char (const u32 *buf, const int elems, const u32 c)
return r; return r;
} }
DECLSPEC float get_entropy (const u32 *buf, const int elems);
DECLSPEC float get_entropy (const u32 *buf, const int elems) DECLSPEC float get_entropy (const u32 *buf, const int elems)
{ {
const int length = elems * 4; const int length = elems * 4;
@ -216,6 +226,7 @@ DECLSPEC float get_entropy (const u32 *buf, const int elems)
return entropy; return entropy;
} }
DECLSPEC int is_valid_hex_8 (const u8 v);
DECLSPEC int is_valid_hex_8 (const u8 v) DECLSPEC int is_valid_hex_8 (const u8 v)
{ {
// direct lookup table is slower thanks to CMOV // direct lookup table is slower thanks to CMOV
@ -226,6 +237,7 @@ DECLSPEC int is_valid_hex_8 (const u8 v)
return 0; return 0;
} }
DECLSPEC int is_valid_hex_32 (const u32 v);
DECLSPEC int is_valid_hex_32 (const u32 v) DECLSPEC int is_valid_hex_32 (const u32 v)
{ {
if (is_valid_hex_8 ((u8) (v >> 0)) == 0) return 0; if (is_valid_hex_8 ((u8) (v >> 0)) == 0) return 0;
@ -236,6 +248,7 @@ DECLSPEC int is_valid_hex_32 (const u32 v)
return 1; return 1;
} }
DECLSPEC int is_valid_base58_8 (const u8 v);
DECLSPEC int is_valid_base58_8 (const u8 v) DECLSPEC int is_valid_base58_8 (const u8 v)
{ {
if (v > 'z') return 0; if (v > 'z') return 0;
@ -246,6 +259,7 @@ DECLSPEC int is_valid_base58_8 (const u8 v)
return 1; return 1;
} }
DECLSPEC int is_valid_base58_32 (const u32 v);
DECLSPEC int is_valid_base58_32 (const u32 v) DECLSPEC int is_valid_base58_32 (const u32 v)
{ {
if (is_valid_base58_8 ((u8) (v >> 0)) == 0) return 0; if (is_valid_base58_8 ((u8) (v >> 0)) == 0) return 0;
@ -256,6 +270,7 @@ DECLSPEC int is_valid_base58_32 (const u32 v)
return 1; return 1;
} }
DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt) DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{ {
for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++) for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++)
@ -274,6 +289,7 @@ DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, _
return -1; return -1;
} }
DECLSPEC int execute_keyboard_layout_mapping (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int pw_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int execute_keyboard_layout_mapping (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int pw_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt) DECLSPEC int execute_keyboard_layout_mapping (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int pw_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{ {
u32 out_buf[16] = { 0 }; u32 out_buf[16] = { 0 };
@ -404,6 +420,7 @@ DECLSPEC int execute_keyboard_layout_mapping (u32 w0[4], u32 w1[4], u32 w2[4], u
* vector functions * vector functions
*/ */
DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2) DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -442,6 +459,7 @@ DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2)
#endif #endif
} }
DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2) DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -480,6 +498,7 @@ DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2)
#endif #endif
} }
DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2) DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -518,6 +537,7 @@ DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2)
#endif #endif
} }
DECLSPEC void make_utf16leN (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16leN (const u32x *in, u32x *out1, u32x *out2) DECLSPEC void make_utf16leN (const u32x *in, u32x *out1, u32x *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -556,6 +576,7 @@ DECLSPEC void make_utf16leN (const u32x *in, u32x *out1, u32x *out2)
#endif #endif
} }
DECLSPEC void undo_utf16be (const u32x *in1, const u32x *in2, u32x *out);
DECLSPEC void undo_utf16be (const u32x *in1, const u32x *in2, u32x *out) DECLSPEC void undo_utf16be (const u32x *in1, const u32x *in2, u32x *out)
{ {
#if defined IS_NV #if defined IS_NV
@ -586,6 +607,7 @@ DECLSPEC void undo_utf16be (const u32x *in1, const u32x *in2, u32x *out)
#endif #endif
} }
DECLSPEC void undo_utf16le (const u32x *in1, const u32x *in2, u32x *out);
DECLSPEC void undo_utf16le (const u32x *in1, const u32x *in2, u32x *out) DECLSPEC void undo_utf16le (const u32x *in1, const u32x *in2, u32x *out)
{ {
#if defined IS_NV #if defined IS_NV
@ -616,6 +638,7 @@ DECLSPEC void undo_utf16le (const u32x *in1, const u32x *in2, u32x *out)
#endif #endif
} }
DECLSPEC void set_mark_1x4 (u32 *v, const u32 offset);
DECLSPEC void set_mark_1x4 (u32 *v, const u32 offset) DECLSPEC void set_mark_1x4 (u32 *v, const u32 offset)
{ {
const u32 c = (offset & 15) / 4; const u32 c = (offset & 15) / 4;
@ -627,6 +650,7 @@ DECLSPEC void set_mark_1x4 (u32 *v, const u32 offset)
v[3] = (c == 3) ? r : 0; v[3] = (c == 3) ? r : 0;
} }
DECLSPEC void append_helper_1x4 (u32x *r, const u32 v, const u32 *m);
DECLSPEC void append_helper_1x4 (u32x *r, const u32 v, const u32 *m) DECLSPEC void append_helper_1x4 (u32x *r, const u32 v, const u32 *m)
{ {
r[0] |= v & m[0]; r[0] |= v & m[0];
@ -635,6 +659,7 @@ DECLSPEC void append_helper_1x4 (u32x *r, const u32 v, const u32 *m)
r[3] |= v & m[3]; r[3] |= v & m[3];
} }
DECLSPEC void append_0x80_1x4 (u32x *w0, const u32 offset);
DECLSPEC void append_0x80_1x4 (u32x *w0, const u32 offset) DECLSPEC void append_0x80_1x4 (u32x *w0, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -644,6 +669,7 @@ DECLSPEC void append_0x80_1x4 (u32x *w0, const u32 offset)
append_helper_1x4 (w0, 0x80808080, v); append_helper_1x4 (w0, 0x80808080, v);
} }
DECLSPEC void append_0x80_2x4 (u32x *w0, u32x *w1, const u32 offset);
DECLSPEC void append_0x80_2x4 (u32x *w0, u32x *w1, const u32 offset) DECLSPEC void append_0x80_2x4 (u32x *w0, u32x *w1, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -656,6 +682,7 @@ DECLSPEC void append_0x80_2x4 (u32x *w0, u32x *w1, const u32 offset)
append_helper_1x4 (w1, ((offset16 == 1) ? 0x80808080 : 0), v); append_helper_1x4 (w1, ((offset16 == 1) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_3x4 (u32x *w0, u32x *w1, u32x *w2, const u32 offset);
DECLSPEC void append_0x80_3x4 (u32x *w0, u32x *w1, u32x *w2, const u32 offset) DECLSPEC void append_0x80_3x4 (u32x *w0, u32x *w1, u32x *w2, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -669,6 +696,7 @@ DECLSPEC void append_0x80_3x4 (u32x *w0, u32x *w1, u32x *w2, const u32 offset)
append_helper_1x4 (w2, ((offset16 == 2) ? 0x80808080 : 0), v); append_helper_1x4 (w2, ((offset16 == 2) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_4x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset);
DECLSPEC void append_0x80_4x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset) DECLSPEC void append_0x80_4x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -683,6 +711,7 @@ DECLSPEC void append_0x80_4x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32
append_helper_1x4 (w3, ((offset16 == 3) ? 0x80808080 : 0), v); append_helper_1x4 (w3, ((offset16 == 3) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_8x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset);
DECLSPEC void append_0x80_8x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset) DECLSPEC void append_0x80_8x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -701,6 +730,7 @@ DECLSPEC void append_0x80_8x4 (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4,
append_helper_1x4 (w7, ((offset16 == 7) ? 0x80808080 : 0), v); append_helper_1x4 (w7, ((offset16 == 7) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_1x16 (u32x *w, const u32 offset);
DECLSPEC void append_0x80_1x16 (u32x *w, const u32 offset) DECLSPEC void append_0x80_1x16 (u32x *w, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -715,12 +745,9 @@ DECLSPEC void append_0x80_1x16 (u32x *w, const u32 offset)
append_helper_1x4 (w + 12, ((offset16 == 3) ? 0x80808080 : 0), v); append_helper_1x4 (w + 12, ((offset16 == 3) ? 0x80808080 : 0), v);
} }
DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset) DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -1050,6 +1077,10 @@ DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -1383,12 +1414,9 @@ DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_carry_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_carry_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset) DECLSPEC void switch_buffer_by_offset_carry_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if defined IS_AMD || defined IS_GENERIC #if defined IS_AMD || defined IS_GENERIC
@ -1853,6 +1881,11 @@ DECLSPEC void switch_buffer_by_offset_carry_le (u32x *w0, u32x *w1, u32x *w2, u3
#endif #endif
#ifdef IS_NV #ifdef IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
// todo // todo
switch (offset_switch) switch (offset_switch)
{ {
@ -2651,6 +2684,7 @@ DECLSPEC void switch_buffer_by_offset_carry_le (u32x *w0, u32x *w1, u32x *w2, u3
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset) DECLSPEC void switch_buffer_by_offset_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -3315,6 +3349,7 @@ DECLSPEC void switch_buffer_by_offset_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset) DECLSPEC void switch_buffer_by_offset_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *c0, u32x *c1, u32x *c2, u32x *c3, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -4251,12 +4286,9 @@ DECLSPEC void switch_buffer_by_offset_carry_be (u32x *w0, u32x *w1, u32x *w2, u3
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -5418,6 +5450,10 @@ DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -5991,6 +6027,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -8319,6 +8356,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_be (u32x *w0, u32x *w1, u32x *w2, u32x
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u32x *c0, u32x *c1, u32x *c2, u32x *c3, u32x *c4, u32x *c5, u32x *c6, u32x *c7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u32x *c0, u32x *c1, u32x *c2, u32x *c3, u32x *c4, u32x *c5, u32x *c6, u32x *c7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_carry_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u32x *c0, u32x *c1, u32x *c2, u32x *c3, u32x *c4, u32x *c5, u32x *c6, u32x *c7, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -11703,12 +11741,9 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_be (u32x *w0, u32x *w1, u32x *w2
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset);
DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset) DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -16070,6 +16105,10 @@ DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset)
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -20435,6 +20474,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset)
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_1x64_be (u32x *w, const u32 offset);
DECLSPEC void switch_buffer_by_offset_1x64_be (u32x *w, const u32 offset) DECLSPEC void switch_buffer_by_offset_1x64_be (u32x *w, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -29167,6 +29207,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_be (u32x *w, const u32 offset)
* vector functions as scalar (for outer loop usage) * vector functions as scalar (for outer loop usage)
*/ */
DECLSPEC void truncate_block_4x4_le_S (u32 *w0, const u32 len);
DECLSPEC void truncate_block_4x4_le_S (u32 *w0, const u32 len) DECLSPEC void truncate_block_4x4_le_S (u32 *w0, const u32 len)
{ {
switch (len) switch (len)
@ -29277,6 +29318,7 @@ DECLSPEC void truncate_block_4x4_le_S (u32 *w0, const u32 len)
} }
} }
DECLSPEC void truncate_block_4x4_be_S (u32 *w0, const u32 len);
DECLSPEC void truncate_block_4x4_be_S (u32 *w0, const u32 len) DECLSPEC void truncate_block_4x4_be_S (u32 *w0, const u32 len)
{ {
switch (len) switch (len)
@ -29387,6 +29429,7 @@ DECLSPEC void truncate_block_4x4_be_S (u32 *w0, const u32 len)
} }
} }
DECLSPEC void truncate_block_16x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len);
DECLSPEC void truncate_block_16x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len) DECLSPEC void truncate_block_16x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len)
{ {
switch (len) switch (len)
@ -30193,6 +30236,7 @@ DECLSPEC void truncate_block_16x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, cons
} }
} }
DECLSPEC void truncate_block_16x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len);
DECLSPEC void truncate_block_16x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len) DECLSPEC void truncate_block_16x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 len)
{ {
switch (len) switch (len)
@ -30999,6 +31043,7 @@ DECLSPEC void truncate_block_16x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, cons
} }
} }
DECLSPEC void set_mark_1x4_S (u32 *v, const u32 offset);
DECLSPEC void set_mark_1x4_S (u32 *v, const u32 offset) DECLSPEC void set_mark_1x4_S (u32 *v, const u32 offset)
{ {
const u32 c = (offset & 15) / 4; const u32 c = (offset & 15) / 4;
@ -31010,6 +31055,7 @@ DECLSPEC void set_mark_1x4_S (u32 *v, const u32 offset)
v[3] = (c == 3) ? r : 0; v[3] = (c == 3) ? r : 0;
} }
DECLSPEC void append_helper_1x4_S (u32 *r, const u32 v, const u32 *m);
DECLSPEC void append_helper_1x4_S (u32 *r, const u32 v, const u32 *m) DECLSPEC void append_helper_1x4_S (u32 *r, const u32 v, const u32 *m)
{ {
r[0] |= v & m[0]; r[0] |= v & m[0];
@ -31018,6 +31064,7 @@ DECLSPEC void append_helper_1x4_S (u32 *r, const u32 v, const u32 *m)
r[3] |= v & m[3]; r[3] |= v & m[3];
} }
DECLSPEC void append_0x01_2x4_S (u32 *w0, u32 *w1, const u32 offset);
DECLSPEC void append_0x01_2x4_S (u32 *w0, u32 *w1, const u32 offset) DECLSPEC void append_0x01_2x4_S (u32 *w0, u32 *w1, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31030,6 +31077,7 @@ DECLSPEC void append_0x01_2x4_S (u32 *w0, u32 *w1, const u32 offset)
append_helper_1x4_S (w1, ((offset16 == 1) ? 0x01010101 : 0), v); append_helper_1x4_S (w1, ((offset16 == 1) ? 0x01010101 : 0), v);
} }
DECLSPEC void append_0x06_2x4_S (u32 *w0, u32 *w1, const u32 offset);
DECLSPEC void append_0x06_2x4_S (u32 *w0, u32 *w1, const u32 offset) DECLSPEC void append_0x06_2x4_S (u32 *w0, u32 *w1, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31042,6 +31090,7 @@ DECLSPEC void append_0x06_2x4_S (u32 *w0, u32 *w1, const u32 offset)
append_helper_1x4_S (w1, ((offset16 == 1) ? 0x06060606 : 0), v); append_helper_1x4_S (w1, ((offset16 == 1) ? 0x06060606 : 0), v);
} }
DECLSPEC void append_0x01_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset);
DECLSPEC void append_0x01_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset) DECLSPEC void append_0x01_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31056,6 +31105,7 @@ DECLSPEC void append_0x01_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 o
append_helper_1x4_S (w3, ((offset16 == 3) ? 0x01010101 : 0), v); append_helper_1x4_S (w3, ((offset16 == 3) ? 0x01010101 : 0), v);
} }
DECLSPEC void append_0x80_1x4_S (u32 *w0, const u32 offset);
DECLSPEC void append_0x80_1x4_S (u32 *w0, const u32 offset) DECLSPEC void append_0x80_1x4_S (u32 *w0, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31065,6 +31115,7 @@ DECLSPEC void append_0x80_1x4_S (u32 *w0, const u32 offset)
append_helper_1x4_S (w0, 0x80808080, v); append_helper_1x4_S (w0, 0x80808080, v);
} }
DECLSPEC void append_0x80_2x4_S (u32 *w0, u32 *w1, const u32 offset);
DECLSPEC void append_0x80_2x4_S (u32 *w0, u32 *w1, const u32 offset) DECLSPEC void append_0x80_2x4_S (u32 *w0, u32 *w1, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31077,6 +31128,7 @@ DECLSPEC void append_0x80_2x4_S (u32 *w0, u32 *w1, const u32 offset)
append_helper_1x4_S (w1, ((offset16 == 1) ? 0x80808080 : 0), v); append_helper_1x4_S (w1, ((offset16 == 1) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_3x4_S (u32 *w0, u32 *w1, u32 *w2, const u32 offset);
DECLSPEC void append_0x80_3x4_S (u32 *w0, u32 *w1, u32 *w2, const u32 offset) DECLSPEC void append_0x80_3x4_S (u32 *w0, u32 *w1, u32 *w2, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31090,6 +31142,7 @@ DECLSPEC void append_0x80_3x4_S (u32 *w0, u32 *w1, u32 *w2, const u32 offset)
append_helper_1x4_S (w2, ((offset16 == 2) ? 0x80808080 : 0), v); append_helper_1x4_S (w2, ((offset16 == 2) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset);
DECLSPEC void append_0x80_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset) DECLSPEC void append_0x80_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31104,6 +31157,7 @@ DECLSPEC void append_0x80_4x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 o
append_helper_1x4_S (w3, ((offset16 == 3) ? 0x80808080 : 0), v); append_helper_1x4_S (w3, ((offset16 == 3) ? 0x80808080 : 0), v);
} }
DECLSPEC void append_0x80_8x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset);
DECLSPEC void append_0x80_8x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset) DECLSPEC void append_0x80_8x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset)
{ {
u32 v[4]; u32 v[4];
@ -31122,6 +31176,7 @@ DECLSPEC void append_0x80_8x4_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u3
append_helper_1x4_S (w7, ((offset16 == 7) ? 0x80808080 : 0), v); append_helper_1x4_S (w7, ((offset16 == 7) ? 0x80808080 : 0), v);
} }
DECLSPEC void make_utf16be_S (const u32 *in, u32 *out1, u32 *out2);
DECLSPEC void make_utf16be_S (const u32 *in, u32 *out1, u32 *out2) DECLSPEC void make_utf16be_S (const u32 *in, u32 *out1, u32 *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -31160,6 +31215,7 @@ DECLSPEC void make_utf16be_S (const u32 *in, u32 *out1, u32 *out2)
#endif #endif
} }
DECLSPEC void make_utf16le_S (const u32 *in, u32 *out1, u32 *out2);
DECLSPEC void make_utf16le_S (const u32 *in, u32 *out1, u32 *out2) DECLSPEC void make_utf16le_S (const u32 *in, u32 *out1, u32 *out2)
{ {
#if defined IS_NV #if defined IS_NV
@ -31198,6 +31254,7 @@ DECLSPEC void make_utf16le_S (const u32 *in, u32 *out1, u32 *out2)
#endif #endif
} }
DECLSPEC void undo_utf16be_S (const u32 *in1, const u32 *in2, u32 *out);
DECLSPEC void undo_utf16be_S (const u32 *in1, const u32 *in2, u32 *out) DECLSPEC void undo_utf16be_S (const u32 *in1, const u32 *in2, u32 *out)
{ {
#if defined IS_NV #if defined IS_NV
@ -31228,6 +31285,7 @@ DECLSPEC void undo_utf16be_S (const u32 *in1, const u32 *in2, u32 *out)
#endif #endif
} }
DECLSPEC void undo_utf16le_S (const u32 *in1, const u32 *in2, u32 *out);
DECLSPEC void undo_utf16le_S (const u32 *in1, const u32 *in2, u32 *out) DECLSPEC void undo_utf16le_S (const u32 *in1, const u32 *in2, u32 *out)
{ {
#if defined IS_NV #if defined IS_NV
@ -31258,12 +31316,9 @@ DECLSPEC void undo_utf16le_S (const u32 *in1, const u32 *in2, u32 *out)
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset) DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -31593,6 +31648,10 @@ DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3,
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -31926,12 +31985,9 @@ DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3,
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_carry_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_carry_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset) DECLSPEC void switch_buffer_by_offset_carry_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if defined IS_AMD || defined IS_GENERIC #if defined IS_AMD || defined IS_GENERIC
@ -32396,6 +32452,11 @@ DECLSPEC void switch_buffer_by_offset_carry_le_S (u32 *w0, u32 *w1, u32 *w2, u32
#endif #endif
#ifdef IS_NV #ifdef IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
// todo // todo
switch (offset_switch) switch (offset_switch)
{ {
@ -33194,6 +33255,7 @@ DECLSPEC void switch_buffer_by_offset_carry_le_S (u32 *w0, u32 *w1, u32 *w2, u32
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset) DECLSPEC void switch_buffer_by_offset_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -33858,6 +33920,7 @@ DECLSPEC void switch_buffer_by_offset_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3,
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset);
DECLSPEC void switch_buffer_by_offset_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset) DECLSPEC void switch_buffer_by_offset_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *c0, u32 *c1, u32 *c2, u32 *c3, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -34794,12 +34857,9 @@ DECLSPEC void switch_buffer_by_offset_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -35961,6 +36021,10 @@ DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -36534,6 +36598,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -38862,6 +38927,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, u32 *c0, u32 *c1, u32 *c2, u32 *c3, u32 *c4, u32 *c5, u32 *c6, u32 *c7, const u32 offset);
DECLSPEC void switch_buffer_by_offset_8x4_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, u32 *c0, u32 *c1, u32 *c2, u32 *c3, u32 *c4, u32 *c5, u32 *c6, u32 *c7, const u32 offset) DECLSPEC void switch_buffer_by_offset_8x4_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, u32 *c0, u32 *c1, u32 *c2, u32 *c3, u32 *c4, u32 *c5, u32 *c6, u32 *c7, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -42246,12 +42312,9 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_be_S (u32 *w0, u32 *w1, u32 *w2,
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset);
DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset) DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset)
{ {
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
#if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC #if (defined IS_AMD && HAS_VPERM == 0) || defined IS_GENERIC
@ -46613,6 +46676,10 @@ DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset)
#if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV #if (defined IS_AMD && HAS_VPERM == 1) || defined IS_NV
const int offset_mod_4 = offset & 3;
const int offset_minus_4 = 4 - offset_mod_4;
#if defined IS_NV #if defined IS_NV
const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff;
#endif #endif
@ -50978,6 +51045,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset)
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_1x64_be_S (u32 *w, const u32 offset);
DECLSPEC void switch_buffer_by_offset_1x64_be_S (u32 *w, const u32 offset) DECLSPEC void switch_buffer_by_offset_1x64_be_S (u32 *w, const u32 offset)
{ {
const int offset_switch = offset / 4; const int offset_switch = offset / 4;
@ -59770,6 +59838,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_be_S (u32 *w, const u32 offset)
PACKSV4 (s6, v6, e); \ PACKSV4 (s6, v6, e); \
PACKSV4 (s7, v7, e); PACKSV4 (s7, v7, e);
DECLSPEC void switch_buffer_by_offset_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset);
DECLSPEC void switch_buffer_by_offset_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset) DECLSPEC void switch_buffer_by_offset_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -59830,6 +59899,7 @@ DECLSPEC void switch_buffer_by_offset_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x
#endif #endif
} }
DECLSPEC void switch_buffer_by_offset_8x4_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32x offset);
DECLSPEC void switch_buffer_by_offset_8x4_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32x offset) DECLSPEC void switch_buffer_by_offset_8x4_le_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60010,6 +60080,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_le_VV (u32x *w0, u32x *w1, u32x *w2, u
#endif #endif
} }
DECLSPEC void append_0x01_2x4_VV (u32x *w0, u32x *w1, const u32x offset);
DECLSPEC void append_0x01_2x4_VV (u32x *w0, u32x *w1, const u32x offset) DECLSPEC void append_0x01_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60068,6 +60139,7 @@ DECLSPEC void append_0x01_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
#endif #endif
} }
DECLSPEC void append_0x01_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset);
DECLSPEC void append_0x01_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset) DECLSPEC void append_0x01_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60128,6 +60200,7 @@ DECLSPEC void append_0x01_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const
#endif #endif
} }
DECLSPEC void append_0x06_2x4_VV (u32x *w0, u32x *w1, const u32x offset);
DECLSPEC void append_0x06_2x4_VV (u32x *w0, u32x *w1, const u32x offset) DECLSPEC void append_0x06_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60186,6 +60259,7 @@ DECLSPEC void append_0x06_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
#endif #endif
} }
DECLSPEC void append_0x80_2x4_VV (u32x *w0, u32x *w1, const u32x offset);
DECLSPEC void append_0x80_2x4_VV (u32x *w0, u32x *w1, const u32x offset) DECLSPEC void append_0x80_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60244,6 +60318,7 @@ DECLSPEC void append_0x80_2x4_VV (u32x *w0, u32x *w1, const u32x offset)
#endif #endif
} }
DECLSPEC void append_0x80_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset);
DECLSPEC void append_0x80_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset) DECLSPEC void append_0x80_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const u32x offset)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -60304,6 +60379,7 @@ DECLSPEC void append_0x80_4x4_VV (u32x *w0, u32x *w1, u32x *w2, u32x *w3, const
#endif #endif
} }
DECLSPEC void gpu_decompress_entry (__global pw_idx_t *pws_idx, __global u32 *pws_comp, pw_t *pw, const u64 gid);
DECLSPEC void gpu_decompress_entry (__global pw_idx_t *pws_idx, __global u32 *pws_comp, pw_t *pw, const u64 gid) DECLSPEC void gpu_decompress_entry (__global pw_idx_t *pws_idx, __global u32 *pws_comp, pw_t *pw, const u64 gid)
{ {
const u32 off = pws_idx[gid].off; const u32 off = pws_idx[gid].off;

View File

@ -26,7 +26,7 @@ if (check (digest_tp,
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0);
} }
} }
} }

View File

@ -28,7 +28,7 @@ if (check (digest_tp,
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice, 0, 0);
} }
} }
} }

View File

@ -7,6 +7,6 @@ if ((r0 == search[0])
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0);
} }
} }

View File

@ -5,6 +5,6 @@ if ((il_pos + slice) < il_cnt)
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + slice); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + slice, 0, 0);
} }
} }

View File

@ -17,6 +17,7 @@ typedef struct md4_ctx
} md4_ctx_t; } md4_ctx_t;
DECLSPEC void md4_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void md4_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void md4_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -81,6 +82,7 @@ DECLSPEC void md4_transform (const u32 *w0, const u32 *w1, const u32 *w2, const
digest[3] += d; digest[3] += d;
} }
DECLSPEC void md4_init (md4_ctx_t *ctx);
DECLSPEC void md4_init (md4_ctx_t *ctx) DECLSPEC void md4_init (md4_ctx_t *ctx)
{ {
ctx->h[0] = MD4M_A; ctx->h[0] = MD4M_A;
@ -108,6 +110,7 @@ DECLSPEC void md4_init (md4_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -182,6 +185,7 @@ DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3,
} }
} }
DECLSPEC void md4_update (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update (md4_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_update (md4_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -234,6 +238,7 @@ DECLSPEC void md4_update (md4_ctx_t *ctx, const u32 *w, const int len)
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -320,6 +325,7 @@ DECLSPEC void md4_update_swap (md4_ctx_t *ctx, const u32 *w, const int len)
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -362,6 +368,7 @@ DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len)
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -438,6 +445,7 @@ DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int l
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_global (md4_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_update_global (md4_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_update_global (md4_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -490,6 +498,7 @@ DECLSPEC void md4_update_global (md4_ctx_t *ctx, const __global u32 *w, const in
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -576,6 +585,7 @@ DECLSPEC void md4_update_global_swap (md4_ctx_t *ctx, const __global u32 *w, con
md4_update_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -618,6 +628,7 @@ DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, const __global u32 *w,
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -694,6 +705,7 @@ DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, const __global u32
md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_final (md4_ctx_t *ctx);
DECLSPEC void md4_final (md4_ctx_t *ctx) DECLSPEC void md4_final (md4_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -737,6 +749,7 @@ typedef struct md4_hmac_ctx
} md4_hmac_ctx_t; } md4_hmac_ctx_t;
DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -791,6 +804,7 @@ DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 64); md4_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -848,6 +862,7 @@ DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
md4_hmac_init_64 (ctx, w0, w1, w2, w3); md4_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md4_hmac_init_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_init_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_init_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -905,6 +920,7 @@ DECLSPEC void md4_hmac_init_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int l
md4_hmac_init_64 (ctx, w0, w1, w2, w3); md4_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md4_hmac_init_global (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void md4_hmac_init_global (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void md4_hmac_init_global (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -962,6 +978,7 @@ DECLSPEC void md4_hmac_init_global (md4_hmac_ctx_t *ctx, __global const u32 *w,
md4_hmac_init_64 (ctx, w0, w1, w2, w3); md4_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md4_hmac_init_global_swap (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void md4_hmac_init_global_swap (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void md4_hmac_init_global_swap (md4_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1019,51 +1036,61 @@ DECLSPEC void md4_hmac_init_global_swap (md4_hmac_ctx_t *ctx, __global const u32
md4_hmac_init_64 (ctx, w0, w1, w2, w3); md4_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md4_hmac_update_64 (md4_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void md4_hmac_update_64 (md4_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md4_hmac_update_64 (md4_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
md4_update_64 (&ctx->ipad, w0, w1, w2, w3, len); md4_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void md4_hmac_update (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_update (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md4_update (&ctx->ipad, w, len); md4_update (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_update_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md4_update_swap (&ctx->ipad, w, len); md4_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_utf16le (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_utf16le (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_update_utf16le (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md4_update_utf16le (&ctx->ipad, w, len); md4_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md4_hmac_update_utf16le_swap (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md4_update_utf16le_swap (&ctx->ipad, w, len); md4_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_hmac_update_global (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md4_update_global (&ctx->ipad, w, len); md4_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_hmac_update_global_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md4_update_global_swap (&ctx->ipad, w, len); md4_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_hmac_update_global_utf16le (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md4_update_global_utf16le (&ctx->ipad, w, len); md4_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md4_hmac_update_global_utf16le_swap (md4_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md4_update_global_utf16le_swap (&ctx->ipad, w, len); md4_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx);
DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx) DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx)
{ {
md4_final (&ctx->ipad); md4_final (&ctx->ipad);
@ -1110,6 +1137,7 @@ typedef struct md4_ctx_vector
} md4_ctx_vector_t; } md4_ctx_vector_t;
DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a = digest[0]; u32x a = digest[0];
@ -1174,6 +1202,7 @@ DECLSPEC void md4_transform_vector (const u32x *w0, const u32x *w1, const u32x *
digest[3] += d; digest[3] += d;
} }
DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx);
DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx) DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx)
{ {
ctx->h[0] = MD4M_A; ctx->h[0] = MD4M_A;
@ -1201,6 +1230,7 @@ DECLSPEC void md4_init_vector (md4_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx0);
DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx0) DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1228,6 +1258,7 @@ DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1302,6 +1333,7 @@ DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u
} }
} }
DECLSPEC void md4_update_vector (md4_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_update_vector (md4_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_update_vector (md4_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1354,6 +1386,7 @@ DECLSPEC void md4_update_vector (md4_ctx_vector_t *ctx, const u32x *w, const int
md4_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_vector_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_update_vector_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_update_vector_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1440,6 +1473,7 @@ DECLSPEC void md4_update_vector_swap (md4_ctx_vector_t *ctx, const u32x *w, cons
md4_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); md4_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md4_update_vector_utf16le (md4_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_update_vector_utf16le (md4_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_update_vector_utf16le (md4_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1482,6 +1516,7 @@ DECLSPEC void md4_update_vector_utf16le (md4_ctx_vector_t *ctx, const u32x *w, c
md4_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1558,6 +1593,7 @@ DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x
md4_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md4_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx);
DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx) DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1601,6 +1637,7 @@ typedef struct md4_hmac_ctx_vector
} md4_hmac_ctx_vector_t; } md4_hmac_ctx_vector_t;
DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -1655,6 +1692,7 @@ DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1712,16 +1750,19 @@ DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, c
md4_hmac_init_vector_64 (ctx, w0, w1, w2, w3); md4_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md4_hmac_update_vector_64 (md4_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void md4_hmac_update_vector_64 (md4_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md4_hmac_update_vector_64 (md4_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
md4_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); md4_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void md4_hmac_update_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md4_hmac_update_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md4_hmac_update_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
md4_update_vector (&ctx->ipad, w, len); md4_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx);
DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx) DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx)
{ {
md4_final_vector (&ctx->ipad); md4_final_vector (&ctx->ipad);

View File

@ -17,6 +17,7 @@ typedef struct md5_ctx
} md5_ctx_t; } md5_ctx_t;
DECLSPEC void md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -117,6 +118,7 @@ DECLSPEC void md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, const
digest[3] += d; digest[3] += d;
} }
DECLSPEC void md5_init (md5_ctx_t *ctx);
DECLSPEC void md5_init (md5_ctx_t *ctx) DECLSPEC void md5_init (md5_ctx_t *ctx)
{ {
ctx->h[0] = MD5M_A; ctx->h[0] = MD5M_A;
@ -144,6 +146,7 @@ DECLSPEC void md5_init (md5_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -218,6 +221,7 @@ DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3,
} }
} }
DECLSPEC void md5_update (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update (md5_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_update (md5_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -270,6 +274,7 @@ DECLSPEC void md5_update (md5_ctx_t *ctx, const u32 *w, const int len)
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -356,6 +361,7 @@ DECLSPEC void md5_update_swap (md5_ctx_t *ctx, const u32 *w, const int len)
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -398,6 +404,7 @@ DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len)
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -474,6 +481,7 @@ DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int l
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_global (md5_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_update_global (md5_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_update_global (md5_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -526,6 +534,7 @@ DECLSPEC void md5_update_global (md5_ctx_t *ctx, const __global u32 *w, const in
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -612,6 +621,7 @@ DECLSPEC void md5_update_global_swap (md5_ctx_t *ctx, const __global u32 *w, con
md5_update_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -654,6 +664,7 @@ DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, const __global u32 *w,
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -730,6 +741,7 @@ DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, const __global u32
md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_final (md5_ctx_t *ctx);
DECLSPEC void md5_final (md5_ctx_t *ctx) DECLSPEC void md5_final (md5_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -773,6 +785,7 @@ typedef struct md5_hmac_ctx
} md5_hmac_ctx_t; } md5_hmac_ctx_t;
DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -827,6 +840,7 @@ DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 64); md5_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -884,6 +898,7 @@ DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
md5_hmac_init_64 (ctx, w0, w1, w2, w3); md5_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md5_hmac_init_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_init_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_init_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -941,6 +956,7 @@ DECLSPEC void md5_hmac_init_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int l
md5_hmac_init_64 (ctx, w0, w1, w2, w3); md5_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md5_hmac_init_global (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void md5_hmac_init_global (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void md5_hmac_init_global (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -998,6 +1014,7 @@ DECLSPEC void md5_hmac_init_global (md5_hmac_ctx_t *ctx, __global const u32 *w,
md5_hmac_init_64 (ctx, w0, w1, w2, w3); md5_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md5_hmac_init_global_swap (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void md5_hmac_init_global_swap (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void md5_hmac_init_global_swap (md5_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1055,51 +1072,61 @@ DECLSPEC void md5_hmac_init_global_swap (md5_hmac_ctx_t *ctx, __global const u32
md5_hmac_init_64 (ctx, w0, w1, w2, w3); md5_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md5_hmac_update_64 (md5_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void md5_hmac_update_64 (md5_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void md5_hmac_update_64 (md5_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
md5_update_64 (&ctx->ipad, w0, w1, w2, w3, len); md5_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void md5_hmac_update (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_update (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md5_update (&ctx->ipad, w, len); md5_update (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_update_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md5_update_swap (&ctx->ipad, w, len); md5_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_utf16le (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_utf16le (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_update_utf16le (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md5_update_utf16le (&ctx->ipad, w, len); md5_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void md5_hmac_update_utf16le_swap (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
md5_update_utf16le_swap (&ctx->ipad, w, len); md5_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_hmac_update_global (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md5_update_global (&ctx->ipad, w, len); md5_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_hmac_update_global_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md5_update_global_swap (&ctx->ipad, w, len); md5_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_hmac_update_global_utf16le (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md5_update_global_utf16le (&ctx->ipad, w, len); md5_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void md5_hmac_update_global_utf16le_swap (md5_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
md5_update_global_utf16le_swap (&ctx->ipad, w, len); md5_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx);
DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx) DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx)
{ {
md5_final (&ctx->ipad); md5_final (&ctx->ipad);
@ -1146,6 +1173,7 @@ typedef struct md5_ctx_vector
} md5_ctx_vector_t; } md5_ctx_vector_t;
DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a = digest[0]; u32x a = digest[0];
@ -1246,6 +1274,7 @@ DECLSPEC void md5_transform_vector (const u32x *w0, const u32x *w1, const u32x *
digest[3] += d; digest[3] += d;
} }
DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx);
DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx) DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx)
{ {
ctx->h[0] = MD5M_A; ctx->h[0] = MD5M_A;
@ -1273,6 +1302,7 @@ DECLSPEC void md5_init_vector (md5_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx0);
DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx0) DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1300,6 +1330,7 @@ DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1374,6 +1405,7 @@ DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u
} }
} }
DECLSPEC void md5_update_vector (md5_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_update_vector (md5_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_update_vector (md5_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1426,6 +1458,7 @@ DECLSPEC void md5_update_vector (md5_ctx_vector_t *ctx, const u32x *w, const int
md5_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_vector_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_update_vector_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_update_vector_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1512,6 +1545,7 @@ DECLSPEC void md5_update_vector_swap (md5_ctx_vector_t *ctx, const u32x *w, cons
md5_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); md5_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void md5_update_vector_utf16le (md5_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_update_vector_utf16le (md5_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_update_vector_utf16le (md5_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1554,6 +1588,7 @@ DECLSPEC void md5_update_vector_utf16le (md5_ctx_vector_t *ctx, const u32x *w, c
md5_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1630,6 +1665,7 @@ DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x
md5_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); md5_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx);
DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx) DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1673,6 +1709,7 @@ typedef struct md5_hmac_ctx_vector
} md5_hmac_ctx_vector_t; } md5_hmac_ctx_vector_t;
DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -1727,6 +1764,7 @@ DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1784,16 +1822,19 @@ DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, c
md5_hmac_init_vector_64 (ctx, w0, w1, w2, w3); md5_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void md5_hmac_update_vector_64 (md5_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void md5_hmac_update_vector_64 (md5_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void md5_hmac_update_vector_64 (md5_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
md5_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); md5_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void md5_hmac_update_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void md5_hmac_update_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void md5_hmac_update_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
md5_update_vector (&ctx->ipad, w, len); md5_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx);
DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx) DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx)
{ {
md5_final_vector (&ctx->ipad); md5_final_vector (&ctx->ipad);

View File

@ -17,6 +17,7 @@ typedef struct ripemd160_ctx
} ripemd160_ctx_t; } ripemd160_ctx_t;
DECLSPEC void ripemd160_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void ripemd160_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void ripemd160_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a1 = digest[0]; u32 a1 = digest[0];
@ -214,6 +215,7 @@ DECLSPEC void ripemd160_transform (const u32 *w0, const u32 *w1, const u32 *w2,
digest[4] = e; digest[4] = e;
} }
DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx);
DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx) DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx)
{ {
ctx->h[0] = RIPEMD160M_A; ctx->h[0] = RIPEMD160M_A;
@ -242,6 +244,7 @@ DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -316,6 +319,7 @@ DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *
} }
} }
DECLSPEC void ripemd160_update (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update (ripemd160_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_update (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -368,6 +372,7 @@ DECLSPEC void ripemd160_update (ripemd160_ctx_t *ctx, const u32 *w, const int le
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -454,6 +459,7 @@ DECLSPEC void ripemd160_update_swap (ripemd160_ctx_t *ctx, const u32 *w, const i
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -496,6 +502,7 @@ DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, cons
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -572,6 +579,7 @@ DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w,
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -624,6 +632,7 @@ DECLSPEC void ripemd160_update_global (ripemd160_ctx_t *ctx, const __global u32
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -710,6 +719,7 @@ DECLSPEC void ripemd160_update_global_swap (ripemd160_ctx_t *ctx, const __global
ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -752,6 +762,7 @@ DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, const __glo
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -828,6 +839,7 @@ DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, const
ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx);
DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx) DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -871,6 +883,7 @@ typedef struct ripemd160_hmac_ctx
} ripemd160_hmac_ctx_t; } ripemd160_hmac_ctx_t;
DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -925,6 +938,7 @@ DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0,
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 64); ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -982,6 +996,7 @@ DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, cons
ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3); ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void ripemd160_hmac_init_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_init_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_init_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1039,6 +1054,7 @@ DECLSPEC void ripemd160_hmac_init_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w,
ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3); ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void ripemd160_hmac_init_global (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_init_global (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void ripemd160_hmac_init_global (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1096,6 +1112,7 @@ DECLSPEC void ripemd160_hmac_init_global (ripemd160_hmac_ctx_t *ctx, __global co
ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3); ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void ripemd160_hmac_init_global_swap (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_init_global_swap (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void ripemd160_hmac_init_global_swap (ripemd160_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1153,51 +1170,61 @@ DECLSPEC void ripemd160_hmac_init_global_swap (ripemd160_hmac_ctx_t *ctx, __glob
ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3); ripemd160_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void ripemd160_hmac_update_64 (ripemd160_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void ripemd160_hmac_update_64 (ripemd160_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void ripemd160_hmac_update_64 (ripemd160_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
ripemd160_update_64 (&ctx->ipad, w0, w1, w2, w3, len); ripemd160_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void ripemd160_hmac_update (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_update (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
ripemd160_update (&ctx->ipad, w, len); ripemd160_update (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
ripemd160_update_swap (&ctx->ipad, w, len); ripemd160_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_utf16le (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_utf16le (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_utf16le (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
ripemd160_update_utf16le (&ctx->ipad, w, len); ripemd160_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
ripemd160_update_utf16le_swap (&ctx->ipad, w, len); ripemd160_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
ripemd160_update_global (&ctx->ipad, w, len); ripemd160_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
ripemd160_update_global_swap (&ctx->ipad, w, len); ripemd160_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_utf16le (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
ripemd160_update_global_utf16le (&ctx->ipad, w, len); ripemd160_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void ripemd160_hmac_update_global_utf16le_swap (ripemd160_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
ripemd160_update_global_utf16le_swap (&ctx->ipad, w, len); ripemd160_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx);
DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx) DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx)
{ {
ripemd160_final (&ctx->ipad); ripemd160_final (&ctx->ipad);
@ -1244,6 +1271,7 @@ typedef struct ripemd160_ctx_vector
} ripemd160_ctx_vector_t; } ripemd160_ctx_vector_t;
DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a1 = digest[0]; u32x a1 = digest[0];
@ -1441,6 +1469,7 @@ DECLSPEC void ripemd160_transform_vector (const u32x *w0, const u32x *w1, const
digest[4] = e; digest[4] = e;
} }
DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx);
DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx) DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx)
{ {
ctx->h[0] = RIPEMD160M_A; ctx->h[0] = RIPEMD160M_A;
@ -1469,6 +1498,7 @@ DECLSPEC void ripemd160_init_vector (ripemd160_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ripemd160_ctx_t *ctx0);
DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ripemd160_ctx_t *ctx0) DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ripemd160_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1497,6 +1527,7 @@ DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ri
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1571,6 +1602,7 @@ DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0,
} }
} }
DECLSPEC void ripemd160_update_vector (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_update_vector (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_update_vector (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1623,6 +1655,7 @@ DECLSPEC void ripemd160_update_vector (ripemd160_ctx_vector_t *ctx, const u32x *
ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_vector_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_update_vector_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_update_vector_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1709,6 +1742,7 @@ DECLSPEC void ripemd160_update_vector_swap (ripemd160_ctx_vector_t *ctx, const u
ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void ripemd160_update_vector_utf16le (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_update_vector_utf16le (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_update_vector_utf16le (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1751,6 +1785,7 @@ DECLSPEC void ripemd160_update_vector_utf16le (ripemd160_ctx_vector_t *ctx, cons
ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1827,6 +1862,7 @@ DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx,
ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); ripemd160_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx);
DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx) DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1870,6 +1906,7 @@ typedef struct ripemd160_hmac_ctx_vector
} ripemd160_hmac_ctx_vector_t; } ripemd160_hmac_ctx_vector_t;
DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -1924,6 +1961,7 @@ DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, c
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1981,16 +2019,19 @@ DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, cons
ripemd160_hmac_init_vector_64 (ctx, w0, w1, w2, w3); ripemd160_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void ripemd160_hmac_update_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void ripemd160_hmac_update_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void ripemd160_hmac_update_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
ripemd160_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); ripemd160_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void ripemd160_hmac_update_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void ripemd160_hmac_update_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void ripemd160_hmac_update_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
ripemd160_update_vector (&ctx->ipad, w, len); ripemd160_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx);
DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx) DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx)
{ {
ripemd160_final_vector (&ctx->ipad); ripemd160_final_vector (&ctx->ipad);

View File

@ -17,6 +17,7 @@ typedef struct sha1_ctx
} sha1_ctx_t; } sha1_ctx_t;
DECLSPEC void sha1_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void sha1_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void sha1_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -146,6 +147,7 @@ DECLSPEC void sha1_transform (const u32 *w0, const u32 *w1, const u32 *w2, const
digest[4] += e; digest[4] += e;
} }
DECLSPEC void sha1_init (sha1_ctx_t *ctx);
DECLSPEC void sha1_init (sha1_ctx_t *ctx) DECLSPEC void sha1_init (sha1_ctx_t *ctx)
{ {
ctx->h[0] = SHA1M_A; ctx->h[0] = SHA1M_A;
@ -174,6 +176,7 @@ DECLSPEC void sha1_init (sha1_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -248,6 +251,7 @@ DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w
} }
} }
DECLSPEC void sha1_update (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -300,6 +304,7 @@ DECLSPEC void sha1_update (sha1_ctx_t *ctx, const u32 *w, const int len)
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_swap (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_swap (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -386,6 +391,7 @@ DECLSPEC void sha1_update_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -428,6 +434,7 @@ DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -504,6 +511,7 @@ DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -546,6 +554,7 @@ DECLSPEC void sha1_update_utf16be (sha1_ctx_t *ctx, const u32 *w, const int len)
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -622,6 +631,7 @@ DECLSPEC void sha1_update_utf16be_swap (sha1_ctx_t *ctx, const u32 *w, const int
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -674,6 +684,7 @@ DECLSPEC void sha1_update_global (sha1_ctx_t *ctx, const __global u32 *w, const
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -760,6 +771,7 @@ DECLSPEC void sha1_update_global_swap (sha1_ctx_t *ctx, const __global u32 *w, c
sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -802,6 +814,7 @@ DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, const __global u32 *w
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -878,6 +891,7 @@ DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, const __global u
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -920,6 +934,7 @@ DECLSPEC void sha1_update_global_utf16be (sha1_ctx_t *ctx, const __global u32 *w
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -996,6 +1011,7 @@ DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, const __global u
sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_final (sha1_ctx_t *ctx);
DECLSPEC void sha1_final (sha1_ctx_t *ctx) DECLSPEC void sha1_final (sha1_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1039,6 +1055,7 @@ typedef struct sha1_hmac_ctx
} sha1_hmac_ctx_t; } sha1_hmac_ctx_t;
DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -1093,6 +1110,7 @@ DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1150,6 +1168,7 @@ DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
sha1_hmac_init_64 (ctx, w0, w1, w2, w3); sha1_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha1_hmac_init_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_init_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_init_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1207,6 +1226,7 @@ DECLSPEC void sha1_hmac_init_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int
sha1_hmac_init_64 (ctx, w0, w1, w2, w3); sha1_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha1_hmac_init_global (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha1_hmac_init_global (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha1_hmac_init_global (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1264,6 +1284,7 @@ DECLSPEC void sha1_hmac_init_global (sha1_hmac_ctx_t *ctx, __global const u32 *w
sha1_hmac_init_64 (ctx, w0, w1, w2, w3); sha1_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha1_hmac_init_global_swap (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha1_hmac_init_global_swap (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha1_hmac_init_global_swap (sha1_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1321,51 +1342,61 @@ DECLSPEC void sha1_hmac_init_global_swap (sha1_hmac_ctx_t *ctx, __global const u
sha1_hmac_init_64 (ctx, w0, w1, w2, w3); sha1_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha1_hmac_update_64 (sha1_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha1_hmac_update_64 (sha1_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha1_hmac_update_64 (sha1_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
sha1_update_64 (&ctx->ipad, w0, w1, w2, w3, len); sha1_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha1_hmac_update (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_update (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha1_update (&ctx->ipad, w, len); sha1_update (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_update_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha1_update_swap (&ctx->ipad, w, len); sha1_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_utf16le (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_utf16le (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_update_utf16le (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha1_update_utf16le (&ctx->ipad, w, len); sha1_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha1_hmac_update_utf16le_swap (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha1_update_utf16le_swap (&ctx->ipad, w, len); sha1_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_hmac_update_global (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha1_update_global (&ctx->ipad, w, len); sha1_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha1_update_global_swap (&ctx->ipad, w, len); sha1_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_utf16le (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha1_update_global_utf16le (&ctx->ipad, w, len); sha1_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha1_hmac_update_global_utf16le_swap (sha1_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha1_update_global_utf16le_swap (&ctx->ipad, w, len); sha1_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx);
DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx) DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx)
{ {
sha1_final (&ctx->ipad); sha1_final (&ctx->ipad);
@ -1412,6 +1443,7 @@ typedef struct sha1_ctx_vector
} sha1_ctx_vector_t; } sha1_ctx_vector_t;
DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a = digest[0]; u32x a = digest[0];
@ -1541,6 +1573,7 @@ DECLSPEC void sha1_transform_vector (const u32x *w0, const u32x *w1, const u32x
digest[4] += e; digest[4] += e;
} }
DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx);
DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx) DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx)
{ {
ctx->h[0] = SHA1M_A; ctx->h[0] = SHA1M_A;
@ -1569,6 +1602,7 @@ DECLSPEC void sha1_init_vector (sha1_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *ctx0);
DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *ctx0) DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1597,6 +1631,7 @@ DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t *
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1671,6 +1706,7 @@ DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1,
} }
} }
DECLSPEC void sha1_update_vector (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1723,6 +1759,7 @@ DECLSPEC void sha1_update_vector (sha1_ctx_vector_t *ctx, const u32x *w, const i
sha1_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_vector_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1809,6 +1846,7 @@ DECLSPEC void sha1_update_vector_swap (sha1_ctx_vector_t *ctx, const u32x *w, co
sha1_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha1_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha1_update_vector_utf16le (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector_utf16le (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector_utf16le (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1851,6 +1889,7 @@ DECLSPEC void sha1_update_vector_utf16le (sha1_ctx_vector_t *ctx, const u32x *w,
sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_vector_utf16le_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector_utf16le_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector_utf16le_swap (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1927,6 +1966,7 @@ DECLSPEC void sha1_update_vector_utf16le_swap (sha1_ctx_vector_t *ctx, const u32
sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_vector_utf16leN (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector_utf16leN (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector_utf16leN (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1969,6 +2009,7 @@ DECLSPEC void sha1_update_vector_utf16leN (sha1_ctx_vector_t *ctx, const u32x *w
sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2011,6 +2052,7 @@ DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w
sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha1_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx);
DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx) DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -2054,6 +2096,7 @@ typedef struct sha1_hmac_ctx_vector
} sha1_hmac_ctx_vector_t; } sha1_hmac_ctx_vector_t;
DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -2108,6 +2151,7 @@ DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2165,16 +2209,19 @@ DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w,
sha1_hmac_init_vector_64 (ctx, w0, w1, w2, w3); sha1_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha1_hmac_update_vector_64 (sha1_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha1_hmac_update_vector_64 (sha1_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha1_hmac_update_vector_64 (sha1_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
sha1_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); sha1_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha1_hmac_update_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha1_hmac_update_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha1_hmac_update_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
sha1_update_vector (&ctx->ipad, w, len); sha1_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx);
DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx) DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx)
{ {
sha1_final_vector (&ctx->ipad); sha1_final_vector (&ctx->ipad);

View File

@ -37,6 +37,7 @@ typedef struct sha224_ctx
} sha224_ctx_t; } sha224_ctx_t;
DECLSPEC void sha224_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void sha224_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void sha224_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -128,6 +129,7 @@ DECLSPEC void sha224_transform (const u32 *w0, const u32 *w1, const u32 *w2, con
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha224_init (sha224_ctx_t *ctx);
DECLSPEC void sha224_init (sha224_ctx_t *ctx) DECLSPEC void sha224_init (sha224_ctx_t *ctx)
{ {
ctx->h[0] = SHA224M_A; ctx->h[0] = SHA224M_A;
@ -159,6 +161,7 @@ DECLSPEC void sha224_init (sha224_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -233,6 +236,7 @@ DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u3
} }
} }
DECLSPEC void sha224_update (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update (sha224_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_update (sha224_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -285,6 +289,7 @@ DECLSPEC void sha224_update (sha224_ctx_t *ctx, const u32 *w, const int len)
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -371,6 +376,7 @@ DECLSPEC void sha224_update_swap (sha224_ctx_t *ctx, const u32 *w, const int len
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -413,6 +419,7 @@ DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -489,6 +496,7 @@ DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -541,6 +549,7 @@ DECLSPEC void sha224_update_global (sha224_ctx_t *ctx, const __global u32 *w, co
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -627,6 +636,7 @@ DECLSPEC void sha224_update_global_swap (sha224_ctx_t *ctx, const __global u32 *
sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -669,6 +679,7 @@ DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, const __global u3
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -745,6 +756,7 @@ DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, const __glob
sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_final (sha224_ctx_t *ctx);
DECLSPEC void sha224_final (sha224_ctx_t *ctx) DECLSPEC void sha224_final (sha224_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -788,6 +800,7 @@ typedef struct sha224_hmac_ctx
} sha224_hmac_ctx_t; } sha224_hmac_ctx_t;
DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -842,6 +855,7 @@ DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -899,6 +913,7 @@ DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int
sha224_hmac_init_64 (ctx, w0, w1, w2, w3); sha224_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha224_hmac_init_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_init_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_init_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -956,6 +971,7 @@ DECLSPEC void sha224_hmac_init_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const
sha224_hmac_init_64 (ctx, w0, w1, w2, w3); sha224_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha224_hmac_init_global (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha224_hmac_init_global (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha224_hmac_init_global (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1013,6 +1029,7 @@ DECLSPEC void sha224_hmac_init_global (sha224_hmac_ctx_t *ctx, __global const u3
sha224_hmac_init_64 (ctx, w0, w1, w2, w3); sha224_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha224_hmac_init_global_swap (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha224_hmac_init_global_swap (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha224_hmac_init_global_swap (sha224_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1070,51 +1087,61 @@ DECLSPEC void sha224_hmac_init_global_swap (sha224_hmac_ctx_t *ctx, __global con
sha224_hmac_init_64 (ctx, w0, w1, w2, w3); sha224_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha224_hmac_update_64 (sha224_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha224_hmac_update_64 (sha224_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha224_hmac_update_64 (sha224_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
sha224_update_64 (&ctx->ipad, w0, w1, w2, w3, len); sha224_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha224_hmac_update (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_update (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha224_update (&ctx->ipad, w, len); sha224_update (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_update_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha224_update_swap (&ctx->ipad, w, len); sha224_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_utf16le (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_utf16le (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_update_utf16le (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha224_update_utf16le (&ctx->ipad, w, len); sha224_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha224_hmac_update_utf16le_swap (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha224_update_utf16le_swap (&ctx->ipad, w, len); sha224_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_hmac_update_global (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha224_update_global (&ctx->ipad, w, len); sha224_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha224_update_global_swap (&ctx->ipad, w, len); sha224_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_utf16le (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha224_update_global_utf16le (&ctx->ipad, w, len); sha224_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha224_hmac_update_global_utf16le_swap (sha224_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha224_update_global_utf16le_swap (&ctx->ipad, w, len); sha224_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx);
DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx) DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx)
{ {
sha224_final (&ctx->ipad); sha224_final (&ctx->ipad);
@ -1161,6 +1188,7 @@ typedef struct sha224_ctx_vector
} sha224_ctx_vector_t; } sha224_ctx_vector_t;
DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a = digest[0]; u32x a = digest[0];
@ -1252,6 +1280,7 @@ DECLSPEC void sha224_transform_vector (const u32x *w0, const u32x *w1, const u32
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx);
DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx) DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx)
{ {
ctx->h[0] = SHA224M_A; ctx->h[0] = SHA224M_A;
@ -1283,6 +1312,7 @@ DECLSPEC void sha224_init_vector (sha224_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_ctx_t *ctx0);
DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_ctx_t *ctx0) DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1314,6 +1344,7 @@ DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_c
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1388,6 +1419,7 @@ DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x
} }
} }
DECLSPEC void sha224_update_vector (sha224_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_update_vector (sha224_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_update_vector (sha224_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1440,6 +1472,7 @@ DECLSPEC void sha224_update_vector (sha224_ctx_vector_t *ctx, const u32x *w, con
sha224_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_vector_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_update_vector_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_update_vector_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1526,6 +1559,7 @@ DECLSPEC void sha224_update_vector_swap (sha224_ctx_vector_t *ctx, const u32x *w
sha224_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha224_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha224_update_vector_utf16le (sha224_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_update_vector_utf16le (sha224_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_update_vector_utf16le (sha224_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1568,6 +1602,7 @@ DECLSPEC void sha224_update_vector_utf16le (sha224_ctx_vector_t *ctx, const u32x
sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_vector_utf16le_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_update_vector_utf16le_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_update_vector_utf16le_swap (sha224_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1644,6 +1679,7 @@ DECLSPEC void sha224_update_vector_utf16le_swap (sha224_ctx_vector_t *ctx, const
sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1686,6 +1722,7 @@ DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32
sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha224_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx);
DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx) DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1729,6 +1766,7 @@ typedef struct sha224_hmac_ctx_vector
} sha224_hmac_ctx_vector_t; } sha224_hmac_ctx_vector_t;
DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -1783,6 +1821,7 @@ DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1840,16 +1879,19 @@ DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x
sha224_hmac_init_vector_64 (ctx, w0, w1, w2, w3); sha224_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha224_hmac_update_vector_64 (sha224_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha224_hmac_update_vector_64 (sha224_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha224_hmac_update_vector_64 (sha224_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
sha224_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); sha224_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha224_hmac_update_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha224_hmac_update_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha224_hmac_update_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
sha224_update_vector (&ctx->ipad, w, len); sha224_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx);
DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx) DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx)
{ {
sha224_final_vector (&ctx->ipad); sha224_final_vector (&ctx->ipad);

View File

@ -37,6 +37,7 @@ typedef struct sha256_ctx
} sha256_ctx_t; } sha256_ctx_t;
DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -128,6 +129,7 @@ DECLSPEC void sha256_transform (const u32 *w0, const u32 *w1, const u32 *w2, con
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha256_init (sha256_ctx_t *ctx);
DECLSPEC void sha256_init (sha256_ctx_t *ctx) DECLSPEC void sha256_init (sha256_ctx_t *ctx)
{ {
ctx->h[0] = SHA256M_A; ctx->h[0] = SHA256M_A;
@ -159,6 +161,7 @@ DECLSPEC void sha256_init (sha256_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -233,6 +236,7 @@ DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u3
} }
} }
DECLSPEC void sha256_update (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update (sha256_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_update (sha256_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -285,6 +289,7 @@ DECLSPEC void sha256_update (sha256_ctx_t *ctx, const u32 *w, const int len)
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -371,6 +376,7 @@ DECLSPEC void sha256_update_swap (sha256_ctx_t *ctx, const u32 *w, const int len
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -413,6 +419,7 @@ DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -489,6 +496,7 @@ DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -541,6 +549,7 @@ DECLSPEC void sha256_update_global (sha256_ctx_t *ctx, const __global u32 *w, co
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -627,6 +636,7 @@ DECLSPEC void sha256_update_global_swap (sha256_ctx_t *ctx, const __global u32 *
sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -669,6 +679,7 @@ DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, const __global u3
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -745,6 +756,7 @@ DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, const __glob
sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_final (sha256_ctx_t *ctx);
DECLSPEC void sha256_final (sha256_ctx_t *ctx) DECLSPEC void sha256_final (sha256_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -788,6 +800,7 @@ typedef struct sha256_hmac_ctx
} sha256_hmac_ctx_t; } sha256_hmac_ctx_t;
DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u32 t0[4]; u32 t0[4];
@ -842,6 +855,7 @@ DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 64); sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -899,6 +913,7 @@ DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int
sha256_hmac_init_64 (ctx, w0, w1, w2, w3); sha256_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha256_hmac_init_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_init_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_init_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -956,6 +971,7 @@ DECLSPEC void sha256_hmac_init_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const
sha256_hmac_init_64 (ctx, w0, w1, w2, w3); sha256_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha256_hmac_init_global (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha256_hmac_init_global (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha256_hmac_init_global (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1013,6 +1029,7 @@ DECLSPEC void sha256_hmac_init_global (sha256_hmac_ctx_t *ctx, __global const u3
sha256_hmac_init_64 (ctx, w0, w1, w2, w3); sha256_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha256_hmac_init_global_swap (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha256_hmac_init_global_swap (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha256_hmac_init_global_swap (sha256_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1070,51 +1087,61 @@ DECLSPEC void sha256_hmac_init_global_swap (sha256_hmac_ctx_t *ctx, __global con
sha256_hmac_init_64 (ctx, w0, w1, w2, w3); sha256_hmac_init_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha256_hmac_update_64 (sha256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void sha256_hmac_update_64 (sha256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void sha256_hmac_update_64 (sha256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
sha256_update_64 (&ctx->ipad, w0, w1, w2, w3, len); sha256_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha256_hmac_update (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_update (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha256_update (&ctx->ipad, w, len); sha256_update (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_update_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha256_update_swap (&ctx->ipad, w, len); sha256_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_utf16le (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_utf16le (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_update_utf16le (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha256_update_utf16le (&ctx->ipad, w, len); sha256_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha256_hmac_update_utf16le_swap (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha256_update_utf16le_swap (&ctx->ipad, w, len); sha256_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_hmac_update_global (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha256_update_global (&ctx->ipad, w, len); sha256_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha256_update_global_swap (&ctx->ipad, w, len); sha256_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_utf16le (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha256_update_global_utf16le (&ctx->ipad, w, len); sha256_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha256_hmac_update_global_utf16le_swap (sha256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha256_update_global_utf16le_swap (&ctx->ipad, w, len); sha256_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx);
DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx) DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx)
{ {
sha256_final (&ctx->ipad); sha256_final (&ctx->ipad);
@ -1161,6 +1188,7 @@ typedef struct sha256_ctx_vector
} sha256_ctx_vector_t; } sha256_ctx_vector_t;
DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest);
DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest) DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest)
{ {
u32x a = digest[0]; u32x a = digest[0];
@ -1252,6 +1280,7 @@ DECLSPEC void sha256_transform_vector (const u32x *w0, const u32x *w1, const u32
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx);
DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx) DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx)
{ {
ctx->h[0] = SHA256M_A; ctx->h[0] = SHA256M_A;
@ -1283,6 +1312,7 @@ DECLSPEC void sha256_init_vector (sha256_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_ctx_t *ctx0);
DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_ctx_t *ctx0) DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -1314,6 +1344,7 @@ DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_c
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1388,6 +1419,7 @@ DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x
} }
} }
DECLSPEC void sha256_update_vector (sha256_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_update_vector (sha256_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_update_vector (sha256_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1440,6 +1472,7 @@ DECLSPEC void sha256_update_vector (sha256_ctx_vector_t *ctx, const u32x *w, con
sha256_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_vector_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_update_vector_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_update_vector_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1526,6 +1559,7 @@ DECLSPEC void sha256_update_vector_swap (sha256_ctx_vector_t *ctx, const u32x *w
sha256_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); sha256_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void sha256_update_vector_utf16le (sha256_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_update_vector_utf16le (sha256_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_update_vector_utf16le (sha256_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1568,6 +1602,7 @@ DECLSPEC void sha256_update_vector_utf16le (sha256_ctx_vector_t *ctx, const u32x
sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_vector_utf16le_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_update_vector_utf16le_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_update_vector_utf16le_swap (sha256_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1644,6 +1679,7 @@ DECLSPEC void sha256_update_vector_utf16le_swap (sha256_ctx_vector_t *ctx, const
sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1686,6 +1722,7 @@ DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32
sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); sha256_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx);
DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx) DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1729,6 +1766,7 @@ typedef struct sha256_hmac_ctx_vector
} sha256_hmac_ctx_vector_t; } sha256_hmac_ctx_vector_t;
DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u32x t0[4]; u32x t0[4];
@ -1783,6 +1821,7 @@ DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1840,16 +1879,19 @@ DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x
sha256_hmac_init_vector_64 (ctx, w0, w1, w2, w3); sha256_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
} }
DECLSPEC void sha256_hmac_update_vector_64 (sha256_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void sha256_hmac_update_vector_64 (sha256_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void sha256_hmac_update_vector_64 (sha256_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
sha256_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); sha256_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void sha256_hmac_update_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha256_hmac_update_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha256_hmac_update_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
sha256_update_vector (&ctx->ipad, w, len); sha256_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx);
DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx) DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx)
{ {
sha256_final_vector (&ctx->ipad); sha256_final_vector (&ctx->ipad);

View File

@ -45,6 +45,7 @@ typedef struct sha384_ctx
} sha384_ctx_t; } sha384_ctx_t;
DECLSPEC void sha384_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest);
DECLSPEC void sha384_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest) DECLSPEC void sha384_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest)
{ {
u64 a = digest[0]; u64 a = digest[0];
@ -136,6 +137,7 @@ DECLSPEC void sha384_transform (const u32 *w0, const u32 *w1, const u32 *w2, con
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha384_init (sha384_ctx_t *ctx);
DECLSPEC void sha384_init (sha384_ctx_t *ctx) DECLSPEC void sha384_init (sha384_ctx_t *ctx)
{ {
ctx->h[0] = SHA384M_A; ctx->h[0] = SHA384M_A;
@ -183,6 +185,7 @@ DECLSPEC void sha384_init (sha384_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len);
DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -309,6 +312,7 @@ DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u
} }
} }
DECLSPEC void sha384_update (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update (sha384_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_update (sha384_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -397,6 +401,7 @@ DECLSPEC void sha384_update (sha384_ctx_t *ctx, const u32 *w, const int len)
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -551,6 +556,7 @@ DECLSPEC void sha384_update_swap (sha384_ctx_t *ctx, const u32 *w, const int len
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -617,6 +623,7 @@ DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -749,6 +756,7 @@ DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -837,6 +845,7 @@ DECLSPEC void sha384_update_global (sha384_ctx_t *ctx, const __global u32 *w, co
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -991,6 +1000,7 @@ DECLSPEC void sha384_update_global_swap (sha384_ctx_t *ctx, const __global u32 *
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1057,6 +1067,7 @@ DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, const __global u3
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1189,6 +1200,7 @@ DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, const __glob
sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_final (sha384_ctx_t *ctx);
DECLSPEC void sha384_final (sha384_ctx_t *ctx) DECLSPEC void sha384_final (sha384_ctx_t *ctx)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -1248,6 +1260,7 @@ typedef struct sha384_hmac_ctx
} sha384_hmac_ctx_t; } sha384_hmac_ctx_t;
DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7);
DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7) DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7)
{ {
u32 t0[4]; u32 t0[4];
@ -1338,6 +1351,7 @@ DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
} }
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1431,6 +1445,7 @@ DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int
sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha384_hmac_init_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_init_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_init_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1524,6 +1539,7 @@ DECLSPEC void sha384_hmac_init_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const
sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha384_hmac_init_global (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha384_hmac_init_global (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha384_hmac_init_global (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1617,6 +1633,7 @@ DECLSPEC void sha384_hmac_init_global (sha384_hmac_ctx_t *ctx, __global const u3
sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha384_hmac_init_global_swap (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha384_hmac_init_global_swap (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha384_hmac_init_global_swap (sha384_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1710,51 +1727,61 @@ DECLSPEC void sha384_hmac_init_global_swap (sha384_hmac_ctx_t *ctx, __global con
sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha384_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha384_hmac_update_128 (sha384_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len);
DECLSPEC void sha384_hmac_update_128 (sha384_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) DECLSPEC void sha384_hmac_update_128 (sha384_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{ {
sha384_update_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len); sha384_update_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len);
} }
DECLSPEC void sha384_hmac_update (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_update (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha384_update (&ctx->ipad, w, len); sha384_update (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_update_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha384_update_swap (&ctx->ipad, w, len); sha384_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_utf16le (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_utf16le (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_update_utf16le (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha384_update_utf16le (&ctx->ipad, w, len); sha384_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha384_hmac_update_utf16le_swap (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha384_update_utf16le_swap (&ctx->ipad, w, len); sha384_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_hmac_update_global (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha384_update_global (&ctx->ipad, w, len); sha384_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha384_update_global_swap (&ctx->ipad, w, len); sha384_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_utf16le (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha384_update_global_utf16le (&ctx->ipad, w, len); sha384_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha384_hmac_update_global_utf16le_swap (sha384_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha384_update_global_utf16le_swap (&ctx->ipad, w, len); sha384_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx);
DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx) DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx)
{ {
sha384_final (&ctx->ipad); sha384_final (&ctx->ipad);
@ -1825,6 +1852,7 @@ typedef struct sha384_ctx_vector
} sha384_ctx_vector_t; } sha384_ctx_vector_t;
DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest);
DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest) DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest)
{ {
u64x a = digest[0]; u64x a = digest[0];
@ -1916,6 +1944,7 @@ DECLSPEC void sha384_transform_vector (const u32x *w0, const u32x *w1, const u32
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx);
DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx) DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx)
{ {
ctx->h[0] = SHA384M_A; ctx->h[0] = SHA384M_A;
@ -1963,6 +1992,7 @@ DECLSPEC void sha384_init_vector (sha384_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_ctx_t *ctx0);
DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_ctx_t *ctx0) DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -2010,6 +2040,7 @@ DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_c
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len);
DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -2136,6 +2167,7 @@ DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x
} }
} }
DECLSPEC void sha384_update_vector (sha384_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_update_vector (sha384_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_update_vector (sha384_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2224,6 +2256,7 @@ DECLSPEC void sha384_update_vector (sha384_ctx_vector_t *ctx, const u32x *w, con
sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_vector_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_update_vector_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_update_vector_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2378,6 +2411,7 @@ DECLSPEC void sha384_update_vector_swap (sha384_ctx_vector_t *ctx, const u32x *w
sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha384_update_vector_utf16le (sha384_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_update_vector_utf16le (sha384_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_update_vector_utf16le (sha384_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2444,6 +2478,7 @@ DECLSPEC void sha384_update_vector_utf16le (sha384_ctx_vector_t *ctx, const u32x
sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_vector_utf16le_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_update_vector_utf16le_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_update_vector_utf16le_swap (sha384_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2576,6 +2611,7 @@ DECLSPEC void sha384_update_vector_utf16le_swap (sha384_ctx_vector_t *ctx, const
sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2642,6 +2678,7 @@ DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32
sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha384_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx);
DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx) DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -2701,6 +2738,7 @@ typedef struct sha384_hmac_ctx_vector
} sha384_hmac_ctx_vector_t; } sha384_hmac_ctx_vector_t;
DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7);
DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7) DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7)
{ {
u32x t0[4]; u32x t0[4];
@ -2791,6 +2829,7 @@ DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
} }
DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2884,16 +2923,19 @@ DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x
sha384_hmac_init_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha384_hmac_init_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha384_hmac_update_vector_128 (sha384_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len);
DECLSPEC void sha384_hmac_update_vector_128 (sha384_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) DECLSPEC void sha384_hmac_update_vector_128 (sha384_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{ {
sha384_update_vector_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len); sha384_update_vector_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len);
} }
DECLSPEC void sha384_hmac_update_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha384_hmac_update_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha384_hmac_update_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
sha384_update_vector (&ctx->ipad, w, len); sha384_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx);
DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx) DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx)
{ {
sha384_final_vector (&ctx->ipad); sha384_final_vector (&ctx->ipad);

View File

@ -45,6 +45,7 @@ typedef struct sha512_ctx
} sha512_ctx_t; } sha512_ctx_t;
DECLSPEC void sha512_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest);
DECLSPEC void sha512_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest) DECLSPEC void sha512_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7, u64 *digest)
{ {
u64 a = digest[0]; u64 a = digest[0];
@ -136,6 +137,7 @@ DECLSPEC void sha512_transform (const u32 *w0, const u32 *w1, const u32 *w2, con
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha512_init (sha512_ctx_t *ctx);
DECLSPEC void sha512_init (sha512_ctx_t *ctx) DECLSPEC void sha512_init (sha512_ctx_t *ctx)
{ {
ctx->h[0] = SHA512M_A; ctx->h[0] = SHA512M_A;
@ -183,6 +185,7 @@ DECLSPEC void sha512_init (sha512_ctx_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len);
DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -309,6 +312,7 @@ DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u
} }
} }
DECLSPEC void sha512_update (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update (sha512_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_update (sha512_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -397,6 +401,7 @@ DECLSPEC void sha512_update (sha512_ctx_t *ctx, const u32 *w, const int len)
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -551,6 +556,7 @@ DECLSPEC void sha512_update_swap (sha512_ctx_t *ctx, const u32 *w, const int len
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -617,6 +623,7 @@ DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -749,6 +756,7 @@ DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -837,6 +845,7 @@ DECLSPEC void sha512_update_global (sha512_ctx_t *ctx, const __global u32 *w, co
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -991,6 +1000,7 @@ DECLSPEC void sha512_update_global_swap (sha512_ctx_t *ctx, const __global u32 *
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1057,6 +1067,7 @@ DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, const __global u3
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1189,6 +1200,7 @@ DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, const __glob
sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_final (sha512_ctx_t *ctx);
DECLSPEC void sha512_final (sha512_ctx_t *ctx) DECLSPEC void sha512_final (sha512_ctx_t *ctx)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -1248,6 +1260,7 @@ typedef struct sha512_hmac_ctx
} sha512_hmac_ctx_t; } sha512_hmac_ctx_t;
DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7);
DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7) DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, const u32 *w4, const u32 *w5, const u32 *w6, const u32 *w7)
{ {
u32 t0[4]; u32 t0[4];
@ -1338,6 +1351,7 @@ DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const
sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
} }
DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1431,6 +1445,7 @@ DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int
sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha512_hmac_init_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_init_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_init_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1524,6 +1539,7 @@ DECLSPEC void sha512_hmac_init_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const
sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha512_hmac_init_global (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha512_hmac_init_global (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha512_hmac_init_global (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1617,6 +1633,7 @@ DECLSPEC void sha512_hmac_init_global (sha512_hmac_ctx_t *ctx, __global const u3
sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha512_hmac_init_global_swap (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len);
DECLSPEC void sha512_hmac_init_global_swap (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len) DECLSPEC void sha512_hmac_init_global_swap (sha512_hmac_ctx_t *ctx, __global const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1710,51 +1727,61 @@ DECLSPEC void sha512_hmac_init_global_swap (sha512_hmac_ctx_t *ctx, __global con
sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha512_hmac_init_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha512_hmac_update_128 (sha512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len);
DECLSPEC void sha512_hmac_update_128 (sha512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) DECLSPEC void sha512_hmac_update_128 (sha512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len)
{ {
sha512_update_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len); sha512_update_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len);
} }
DECLSPEC void sha512_hmac_update (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_update (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha512_update (&ctx->ipad, w, len); sha512_update (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_update_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha512_update_swap (&ctx->ipad, w, len); sha512_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_utf16le (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_utf16le (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_update_utf16le (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha512_update_utf16le (&ctx->ipad, w, len); sha512_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_utf16le_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void sha512_hmac_update_utf16le_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void sha512_hmac_update_utf16le_swap (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
sha512_update_utf16le_swap (&ctx->ipad, w, len); sha512_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_global (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_hmac_update_global (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha512_update_global (&ctx->ipad, w, len); sha512_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_global_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_hmac_update_global_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha512_update_global_swap (&ctx->ipad, w, len); sha512_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_global_utf16le (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_utf16le (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_hmac_update_global_utf16le (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha512_update_global_utf16le (&ctx->ipad, w, len); sha512_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_update_global_utf16le_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void sha512_hmac_update_global_utf16le_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void sha512_hmac_update_global_utf16le_swap (sha512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
sha512_update_global_utf16le_swap (&ctx->ipad, w, len); sha512_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx);
DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx) DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx)
{ {
sha512_final (&ctx->ipad); sha512_final (&ctx->ipad);
@ -1825,6 +1852,7 @@ typedef struct sha512_ctx_vector
} sha512_ctx_vector_t; } sha512_ctx_vector_t;
DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest);
DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest) DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7, u64x *digest)
{ {
u64x a = digest[0]; u64x a = digest[0];
@ -1916,6 +1944,7 @@ DECLSPEC void sha512_transform_vector (const u32x *w0, const u32x *w1, const u32
digest[7] += h; digest[7] += h;
} }
DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx);
DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx) DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx)
{ {
ctx->h[0] = SHA512M_A; ctx->h[0] = SHA512M_A;
@ -1963,6 +1992,7 @@ DECLSPEC void sha512_init_vector (sha512_ctx_vector_t *ctx)
ctx->len = 0; ctx->len = 0;
} }
DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_ctx_t *ctx0);
DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_ctx_t *ctx0) DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_ctx_t *ctx0)
{ {
ctx->h[0] = ctx0->h[0]; ctx->h[0] = ctx0->h[0];
@ -2010,6 +2040,7 @@ DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_c
ctx->len = ctx0->len; ctx->len = ctx0->len;
} }
DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len);
DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -2136,6 +2167,7 @@ DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x
} }
} }
DECLSPEC void sha512_update_vector (sha512_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_update_vector (sha512_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_update_vector (sha512_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2224,6 +2256,7 @@ DECLSPEC void sha512_update_vector (sha512_ctx_vector_t *ctx, const u32x *w, con
sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_vector_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_update_vector_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_update_vector_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2378,6 +2411,7 @@ DECLSPEC void sha512_update_vector_swap (sha512_ctx_vector_t *ctx, const u32x *w
sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1); sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - pos1);
} }
DECLSPEC void sha512_update_vector_utf16le (sha512_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_update_vector_utf16le (sha512_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_update_vector_utf16le (sha512_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2444,6 +2478,7 @@ DECLSPEC void sha512_update_vector_utf16le (sha512_ctx_vector_t *ctx, const u32x
sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_update_vector_utf16le_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_update_vector_utf16le_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_update_vector_utf16le_swap (sha512_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2576,6 +2611,7 @@ DECLSPEC void sha512_update_vector_utf16le_swap (sha512_ctx_vector_t *ctx, const
sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2642,6 +2678,7 @@ DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32
sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2); sha512_update_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, (len - pos1) * 2);
} }
DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx);
DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx) DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 127; const int pos = ctx->len & 127;
@ -2701,6 +2738,7 @@ typedef struct sha512_hmac_ctx_vector
} sha512_hmac_ctx_vector_t; } sha512_hmac_ctx_vector_t;
DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7);
DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7) DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x *w4, const u32x *w5, const u32x *w6, const u32x *w7)
{ {
u32x t0[4]; u32x t0[4];
@ -2791,6 +2829,7 @@ DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const
sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128); sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
} }
DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2884,16 +2923,19 @@ DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x
sha512_hmac_init_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7); sha512_hmac_init_vector_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7);
} }
DECLSPEC void sha512_hmac_update_vector_128 (sha512_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len);
DECLSPEC void sha512_hmac_update_vector_128 (sha512_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) DECLSPEC void sha512_hmac_update_vector_128 (sha512_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len)
{ {
sha512_update_vector_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len); sha512_update_vector_128 (&ctx->ipad, w0, w1, w2, w3, w4, w5, w6, w7, len);
} }
DECLSPEC void sha512_hmac_update_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void sha512_hmac_update_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void sha512_hmac_update_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
sha512_update_vector (&ctx->ipad, w, len); sha512_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void sha512_hmac_final_vector (sha512_hmac_ctx_vector_t *ctx);
DECLSPEC void sha512_hmac_final_vector (sha512_hmac_ctx_vector_t *ctx) DECLSPEC void sha512_hmac_final_vector (sha512_hmac_ctx_vector_t *ctx)
{ {
sha512_final_vector (&ctx->ipad); sha512_final_vector (&ctx->ipad);

View File

@ -634,6 +634,7 @@ typedef struct streebog256_ctx
} streebog256_ctx_t; } streebog256_ctx_t;
DECLSPEC void streebog256_init (streebog256_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_init (streebog256_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_init (streebog256_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
ctx->h[0] = 0x0101010101010101; ctx->h[0] = 0x0101010101010101;
@ -688,6 +689,7 @@ DECLSPEC void streebog256_init (streebog256_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_s
ctx->s_sbob_sl64 = s_sbob_sl64; ctx->s_sbob_sl64 = s_sbob_sl64;
} }
DECLSPEC void streebog256_add (u64 *x, const u64 *y);
DECLSPEC void streebog256_add (u64 *x, const u64 *y) DECLSPEC void streebog256_add (u64 *x, const u64 *y)
{ {
u64 carry = 0; u64 carry = 0;
@ -707,6 +709,7 @@ DECLSPEC void streebog256_add (u64 *x, const u64 *y)
} }
} }
DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u64 k[8]; u64 k[8];
@ -775,6 +778,7 @@ DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (
} }
} }
DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u64 m[8]; u64 m[8];
@ -797,6 +801,7 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons
streebog256_add (ctx->s, m); streebog256_add (ctx->s, m);
} }
DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len; const int pos = ctx->len;
@ -873,6 +878,7 @@ DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u
} }
} }
DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len) DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -930,6 +936,7 @@ DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len)
} }
} }
DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len) DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -987,6 +994,7 @@ DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int
} }
} }
DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, const __global u32 *w, int len);
DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, const __global u32 *w, int len) DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, const __global u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1044,6 +1052,7 @@ DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, const __gl
} }
} }
DECLSPEC void streebog256_final (streebog256_ctx_t *ctx);
DECLSPEC void streebog256_final (streebog256_ctx_t *ctx) DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1084,6 +1093,7 @@ typedef struct streebog256_hmac_ctx
} streebog256_hmac_ctx_t; } streebog256_hmac_ctx_t;
DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 t0[4]; u32 t0[4];
@ -1138,6 +1148,7 @@ DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 w0[4]; u32 w0[4];
@ -1195,6 +1206,7 @@ DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w,
streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 w0[4]; u32 w0[4];
@ -1252,26 +1264,31 @@ DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32
streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
streebog256_update_64 (&ctx->ipad, w0, w1, w2, w3, len); streebog256_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
streebog256_update (&ctx->ipad, w, len); streebog256_update (&ctx->ipad, w, len);
} }
DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
streebog256_update_swap (&ctx->ipad, w, len); streebog256_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
streebog256_update_global_swap (&ctx->ipad, w, len); streebog256_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx);
DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx) DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx)
{ {
streebog256_final (&ctx->ipad); streebog256_final (&ctx->ipad);
@ -1322,6 +1339,7 @@ typedef struct streebog256_ctx_vector
} streebog256_ctx_vector_t; } streebog256_ctx_vector_t;
DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
ctx->h[0] = 0x0101010101010101; ctx->h[0] = 0x0101010101010101;
@ -1376,6 +1394,7 @@ DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u
ctx->s_sbob_sl64 = s_sbob_sl64; ctx->s_sbob_sl64 = s_sbob_sl64;
} }
DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y);
DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y) DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y)
{ {
u64x carry = 0; u64x carry = 0;
@ -1395,6 +1414,7 @@ DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y)
} }
} }
DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u64x k[8]; u64x k[8];
@ -1463,6 +1483,7 @@ DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_T
} }
} }
DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u64x m[8]; u64x m[8];
@ -1485,6 +1506,7 @@ DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const
streebog256_add_vector (ctx->s, m); streebog256_add_vector (ctx->s, m);
} }
DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len; const int pos = ctx->len;
@ -1561,6 +1583,7 @@ DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x
} }
} }
DECLSPEC void streebog256_update_vector (streebog256_ctx_vector_t *ctx, const u32x *w, int len);
DECLSPEC void streebog256_update_vector (streebog256_ctx_vector_t *ctx, const u32x *w, int len) DECLSPEC void streebog256_update_vector (streebog256_ctx_vector_t *ctx, const u32x *w, int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1618,6 +1641,7 @@ DECLSPEC void streebog256_update_vector (streebog256_ctx_vector_t *ctx, const u3
} }
} }
DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, const u32x *w, int len);
DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, const u32x *w, int len) DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, const u32x *w, int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1675,6 +1699,7 @@ DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, con
} }
} }
DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx);
DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx) DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1715,6 +1740,7 @@ typedef struct streebog256_hmac_ctx_vector
} streebog256_hmac_ctx_vector_t; } streebog256_hmac_ctx_vector_t;
DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x t0[4]; u32x t0[4];
@ -1769,6 +1795,7 @@ DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ct
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x w0[4]; u32x w0[4];
@ -1826,6 +1853,7 @@ DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx,
streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x w0[4]; u32x w0[4];
@ -1883,16 +1911,19 @@ DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t *
streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog256_hmac_update_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void streebog256_hmac_update_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void streebog256_hmac_update_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
streebog256_update_vector (&ctx->ipad, w, len); streebog256_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void streebog256_hmac_update_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void streebog256_hmac_update_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void streebog256_hmac_update_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
streebog256_update_vector_swap (&ctx->ipad, w, len); streebog256_update_vector_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx);
DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx) DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx)
{ {
streebog256_final_vector (&ctx->ipad); streebog256_final_vector (&ctx->ipad);

View File

@ -634,6 +634,7 @@ typedef struct streebog512_ctx
} streebog512_ctx_t; } streebog512_ctx_t;
DECLSPEC void streebog512_init (streebog512_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_init (streebog512_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_init (streebog512_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
ctx->h[0] = 0; ctx->h[0] = 0;
@ -688,6 +689,7 @@ DECLSPEC void streebog512_init (streebog512_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_s
ctx->s_sbob_sl64 = s_sbob_sl64; ctx->s_sbob_sl64 = s_sbob_sl64;
} }
DECLSPEC void streebog512_add (u64 *x, const u64 *y);
DECLSPEC void streebog512_add (u64 *x, const u64 *y) DECLSPEC void streebog512_add (u64 *x, const u64 *y)
{ {
u64 carry = 0; u64 carry = 0;
@ -707,6 +709,7 @@ DECLSPEC void streebog512_add (u64 *x, const u64 *y)
} }
} }
DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u64 k[8]; u64 k[8];
@ -775,6 +778,7 @@ DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (
} }
} }
DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3);
DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3) DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
{ {
u64 m[8]; u64 m[8];
@ -797,6 +801,7 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons
streebog512_add (ctx->s, m); streebog512_add (ctx->s, m);
} }
DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len; const int pos = ctx->len;
@ -873,6 +878,7 @@ DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u
} }
} }
DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len) DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -930,6 +936,7 @@ DECLSPEC void streebog512_update (streebog512_ctx_t *ctx, const u32 *w, int len)
} }
} }
DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int len);
DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int len) DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -987,6 +994,7 @@ DECLSPEC void streebog512_update_swap (streebog512_ctx_t *ctx, const u32 *w, int
} }
} }
DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, const __global u32 *w, int len);
DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, const __global u32 *w, int len) DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, const __global u32 *w, int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1044,6 +1052,7 @@ DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, const __gl
} }
} }
DECLSPEC void streebog512_final (streebog512_ctx_t *ctx);
DECLSPEC void streebog512_final (streebog512_ctx_t *ctx) DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1084,6 +1093,7 @@ typedef struct streebog512_hmac_ctx
} streebog512_hmac_ctx_t; } streebog512_hmac_ctx_t;
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 t0[4]; u32 t0[4];
@ -1138,6 +1148,7 @@ DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 w0[4]; u32 w0[4];
@ -1195,6 +1206,7 @@ DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w,
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32 w0[4]; u32 w0[4];
@ -1252,26 +1264,31 @@ DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
streebog512_update_64 (&ctx->ipad, w0, w1, w2, w3, len); streebog512_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
streebog512_update (&ctx->ipad, w, len); streebog512_update (&ctx->ipad, w, len);
} }
DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
streebog512_update_swap (&ctx->ipad, w, len); streebog512_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
streebog512_update_global_swap (&ctx->ipad, w, len); streebog512_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx);
DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx) DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx)
{ {
streebog512_final (&ctx->ipad); streebog512_final (&ctx->ipad);
@ -1322,6 +1339,7 @@ typedef struct streebog512_ctx_vector
} streebog512_ctx_vector_t; } streebog512_ctx_vector_t;
DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
ctx->h[0] = 0; ctx->h[0] = 0;
@ -1376,6 +1394,7 @@ DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u
ctx->s_sbob_sl64 = s_sbob_sl64; ctx->s_sbob_sl64 = s_sbob_sl64;
} }
DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y);
DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y) DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y)
{ {
u64x carry = 0; u64x carry = 0;
@ -1395,6 +1414,7 @@ DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y)
} }
} }
DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u64x k[8]; u64x k[8];
@ -1463,6 +1483,7 @@ DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_T
} }
} }
DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3);
DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3) DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
{ {
u64x m[8]; u64x m[8];
@ -1485,6 +1506,7 @@ DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const
streebog512_add_vector (ctx->s, m); streebog512_add_vector (ctx->s, m);
} }
DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len; const int pos = ctx->len;
@ -1561,6 +1583,7 @@ DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x
} }
} }
DECLSPEC void streebog512_update_vector (streebog512_ctx_vector_t *ctx, const u32x *w, int len);
DECLSPEC void streebog512_update_vector (streebog512_ctx_vector_t *ctx, const u32x *w, int len) DECLSPEC void streebog512_update_vector (streebog512_ctx_vector_t *ctx, const u32x *w, int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1618,6 +1641,7 @@ DECLSPEC void streebog512_update_vector (streebog512_ctx_vector_t *ctx, const u3
} }
} }
DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, const u32x *w, int len);
DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, const u32x *w, int len) DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, const u32x *w, int len)
{ {
u32x w0[4]; u32x w0[4];
@ -1675,6 +1699,7 @@ DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, con
} }
} }
DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx);
DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx) DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1715,6 +1740,7 @@ typedef struct streebog512_hmac_ctx_vector
} streebog512_hmac_ctx_vector_t; } streebog512_hmac_ctx_vector_t;
DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x t0[4]; u32x t0[4];
@ -1769,6 +1795,7 @@ DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ct
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x w0[4]; u32x w0[4];
@ -1826,6 +1853,7 @@ DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx,
streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]);
DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256]) DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
{ {
u32x w0[4]; u32x w0[4];
@ -1883,16 +1911,19 @@ DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *
streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
} }
DECLSPEC void streebog512_hmac_update_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void streebog512_hmac_update_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void streebog512_hmac_update_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
streebog512_update_vector (&ctx->ipad, w, len); streebog512_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void streebog512_hmac_update_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void streebog512_hmac_update_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void streebog512_hmac_update_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
streebog512_update_vector_swap (&ctx->ipad, w, len); streebog512_update_vector_swap (&ctx->ipad, w, len);
} }
DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx);
DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx) DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx)
{ {
streebog512_final_vector (&ctx->ipad); streebog512_final_vector (&ctx->ipad);

View File

@ -1125,12 +1125,13 @@ typedef struct whirlpool_ctx
int len; int len;
__local u32 (*s_Ch)[256]; SHM_TYPE u32 (*s_Ch)[256];
__local u32 (*s_Cl)[256]; SHM_TYPE u32 (*s_Cl)[256];
} whirlpool_ctx_t; } whirlpool_ctx_t;
DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 Kh[8]; u32 Kh[8];
u32 Kl[8]; u32 Kl[8];
@ -1300,7 +1301,8 @@ DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2,
digest[15] ^= statel[7] ^ w3[3]; digest[15] ^= statel[7] ^ w3[3];
} }
DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
ctx->h[ 0] = 0; ctx->h[ 0] = 0;
ctx->h[ 1] = 0; ctx->h[ 1] = 0;
@ -1342,6 +1344,7 @@ DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, __local u32 (*s_Ch)[256], __
ctx->s_Cl = s_Cl; ctx->s_Cl = s_Cl;
} }
DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1416,6 +1419,7 @@ DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *
} }
} }
DECLSPEC void whirlpool_update (whirlpool_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_update (whirlpool_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_update (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1468,6 +1472,7 @@ DECLSPEC void whirlpool_update (whirlpool_ctx_t *ctx, const u32 *w, const int le
whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_update_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_update_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1554,6 +1559,7 @@ DECLSPEC void whirlpool_update_swap (whirlpool_ctx_t *ctx, const u32 *w, const i
whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1596,6 +1602,7 @@ DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, cons
whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1672,6 +1679,7 @@ DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w,
whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_update_global (whirlpool_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_update_global (whirlpool_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_update_global (whirlpool_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1724,6 +1732,7 @@ DECLSPEC void whirlpool_update_global (whirlpool_ctx_t *ctx, const __global u32
whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_global_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_update_global_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_update_global_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1810,6 +1819,7 @@ DECLSPEC void whirlpool_update_global_swap (whirlpool_ctx_t *ctx, const __global
whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1852,6 +1862,7 @@ DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, const __glo
whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, const __global u32 *w, const int len)
{ {
u32 w0[4]; u32 w0[4];
@ -1928,6 +1939,7 @@ DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, const
whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx);
DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx) DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -1971,7 +1983,8 @@ typedef struct whirlpool_hmac_ctx
} whirlpool_hmac_ctx_t; } whirlpool_hmac_ctx_t;
DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 t0[4]; u32 t0[4];
u32 t1[4]; u32 t1[4];
@ -2025,7 +2038,8 @@ DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0,
whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64); whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -2082,7 +2096,8 @@ DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, cons
whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl);
} }
DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -2139,7 +2154,8 @@ DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w,
whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl);
} }
DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -2196,7 +2212,8 @@ DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global co
whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl);
} }
DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32 w0[4]; u32 w0[4];
u32 w1[4]; u32 w1[4];
@ -2253,51 +2270,61 @@ DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __glob
whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl);
} }
DECLSPEC void whirlpool_hmac_update_64 (whirlpool_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len);
DECLSPEC void whirlpool_hmac_update_64 (whirlpool_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) DECLSPEC void whirlpool_hmac_update_64 (whirlpool_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
whirlpool_update_64 (&ctx->ipad, w0, w1, w2, w3, len); whirlpool_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void whirlpool_hmac_update (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_hmac_update (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
whirlpool_update (&ctx->ipad, w, len); whirlpool_update (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
whirlpool_update_swap (&ctx->ipad, w, len); whirlpool_update_swap (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_utf16le (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_utf16le (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_utf16le (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
whirlpool_update_utf16le (&ctx->ipad, w, len); whirlpool_update_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len)
{ {
whirlpool_update_utf16le_swap (&ctx->ipad, w, len); whirlpool_update_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_global (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_global (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_global (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
whirlpool_update_global (&ctx->ipad, w, len); whirlpool_update_global (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_global_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_global_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_global_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
whirlpool_update_global_swap (&ctx->ipad, w, len); whirlpool_update_global_swap (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_global_utf16le (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_global_utf16le (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_global_utf16le (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
whirlpool_update_global_utf16le (&ctx->ipad, w, len); whirlpool_update_global_utf16le (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_update_global_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len);
DECLSPEC void whirlpool_hmac_update_global_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len) DECLSPEC void whirlpool_hmac_update_global_utf16le_swap (whirlpool_hmac_ctx_t *ctx, const __global u32 *w, const int len)
{ {
whirlpool_update_global_utf16le_swap (&ctx->ipad, w, len); whirlpool_update_global_utf16le_swap (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_final (whirlpool_hmac_ctx_t *ctx);
DECLSPEC void whirlpool_hmac_final (whirlpool_hmac_ctx_t *ctx) DECLSPEC void whirlpool_hmac_final (whirlpool_hmac_ctx_t *ctx)
{ {
whirlpool_final (&ctx->ipad); whirlpool_final (&ctx->ipad);
@ -2342,12 +2369,13 @@ typedef struct whirlpool_ctx_vector
int len; int len;
__local u32 (*s_Ch)[256]; SHM_TYPE u32 (*s_Ch)[256];
__local u32 (*s_Cl)[256]; SHM_TYPE u32 (*s_Cl)[256];
} whirlpool_ctx_vector_t; } whirlpool_ctx_vector_t;
DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32x Kh[8]; u32x Kh[8];
u32x Kl[8]; u32x Kl[8];
@ -2517,7 +2545,8 @@ DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const
digest[15] ^= statel[7] ^ w3[3]; digest[15] ^= statel[7] ^ w3[3];
} }
DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
ctx->h[ 0] = 0; ctx->h[ 0] = 0;
ctx->h[ 1] = 0; ctx->h[ 1] = 0;
@ -2559,6 +2588,7 @@ DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, __local u32 (*
ctx->s_Cl = s_Cl; ctx->s_Cl = s_Cl;
} }
DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, whirlpool_ctx_t *ctx0);
DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, whirlpool_ctx_t *ctx0) DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, whirlpool_ctx_t *ctx0)
{ {
ctx->h[ 0] = ctx0->h[ 0]; ctx->h[ 0] = ctx0->h[ 0];
@ -2601,6 +2631,7 @@ DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, wh
ctx->s_Cl = ctx0->s_Cl; ctx->s_Cl = ctx0->s_Cl;
} }
DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -2675,6 +2706,7 @@ DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0,
} }
} }
DECLSPEC void whirlpool_update_vector (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void whirlpool_update_vector (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void whirlpool_update_vector (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2727,6 +2759,7 @@ DECLSPEC void whirlpool_update_vector (whirlpool_ctx_vector_t *ctx, const u32x *
whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_vector_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void whirlpool_update_vector_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void whirlpool_update_vector_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2813,6 +2846,7 @@ DECLSPEC void whirlpool_update_vector_swap (whirlpool_ctx_vector_t *ctx, const u
whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1); whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, len - pos1);
} }
DECLSPEC void whirlpool_update_vector_utf16le (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void whirlpool_update_vector_utf16le (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void whirlpool_update_vector_utf16le (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2855,6 +2889,7 @@ DECLSPEC void whirlpool_update_vector_utf16le (whirlpool_ctx_vector_t *ctx, cons
whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
u32x w0[4]; u32x w0[4];
@ -2931,6 +2966,7 @@ DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx,
whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); whirlpool_update_vector_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2);
} }
DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx);
DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx) DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx)
{ {
const int pos = ctx->len & 63; const int pos = ctx->len & 63;
@ -2974,7 +3010,8 @@ typedef struct whirlpool_hmac_ctx_vector
} whirlpool_hmac_ctx_vector_t; } whirlpool_hmac_ctx_vector_t;
DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32x t0[4]; u32x t0[4];
u32x t1[4]; u32x t1[4];
@ -3028,7 +3065,8 @@ DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, c
whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
} }
DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]);
DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
u32x w0[4]; u32x w0[4];
u32x w1[4]; u32x w1[4];
@ -3085,16 +3123,19 @@ DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, cons
whirlpool_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); whirlpool_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl);
} }
DECLSPEC void whirlpool_hmac_update_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len);
DECLSPEC void whirlpool_hmac_update_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) DECLSPEC void whirlpool_hmac_update_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{ {
whirlpool_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len); whirlpool_update_vector_64 (&ctx->ipad, w0, w1, w2, w3, len);
} }
DECLSPEC void whirlpool_hmac_update_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len);
DECLSPEC void whirlpool_hmac_update_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len) DECLSPEC void whirlpool_hmac_update_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
{ {
whirlpool_update_vector (&ctx->ipad, w, len); whirlpool_update_vector (&ctx->ipad, w, len);
} }
DECLSPEC void whirlpool_hmac_final_vector (whirlpool_hmac_ctx_vector_t *ctx);
DECLSPEC void whirlpool_hmac_final_vector (whirlpool_hmac_ctx_vector_t *ctx) DECLSPEC void whirlpool_hmac_final_vector (whirlpool_hmac_ctx_vector_t *ctx)
{ {
whirlpool_final_vector (&ctx->ipad); whirlpool_final_vector (&ctx->ipad);

View File

@ -1,6 +1,7 @@
// cbc-essiv // cbc-essiv
DECLSPEC void aes128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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 aes128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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 aes128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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)
{ {
aes128_decrypt (ks1, in, out, s_td0, s_td1, s_td2, s_td3, s_td4); aes128_decrypt (ks1, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
@ -16,6 +17,7 @@ DECLSPEC void aes128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void aes256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv, 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)
{ {
aes256_decrypt (ks1, in, out, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt (ks1, in, out, s_td0, s_td1, s_td2, s_td3, s_td4);
@ -31,6 +33,7 @@ DECLSPEC void aes256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -65,6 +68,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -102,6 +106,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -162,6 +167,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -199,6 +205,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -259,6 +266,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -296,6 +304,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -356,6 +365,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -393,6 +403,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -453,6 +464,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv128_mk_ripemd160_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -487,6 +499,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -524,6 +537,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -584,6 +598,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -621,6 +636,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -681,6 +697,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -718,6 +735,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -778,6 +796,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -815,6 +834,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -877,6 +897,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_essiv256_mk_ripemd160_final (__global
// cbc-plain // cbc-plain
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -907,6 +928,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -940,6 +962,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -996,6 +1019,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1029,6 +1053,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1085,6 +1110,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1118,6 +1144,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1174,6 +1201,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1207,6 +1235,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1263,6 +1292,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain128_mk_ripemd160_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1293,6 +1323,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1326,6 +1357,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1382,6 +1414,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1415,6 +1448,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1471,6 +1505,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1504,6 +1539,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1560,6 +1596,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1593,6 +1630,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1651,6 +1689,7 @@ DECLSPEC void luks_decrypt_sector_aes_cbc_plain256_mk_ripemd160_final (__global
// xts-plain // xts-plain
DECLSPEC void aes128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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 aes128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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 aes128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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[0] = in[0];
@ -1673,6 +1712,7 @@ DECLSPEC void aes128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void aes256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T, 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[0] = in[0];
@ -1695,6 +1735,7 @@ DECLSPEC void aes256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1729,6 +1770,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1766,6 +1808,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1826,6 +1869,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1863,6 +1907,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1923,6 +1968,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1960,6 +2006,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2020,6 +2067,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2057,6 +2105,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2117,6 +2166,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain256_mk_ripemd160_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2151,6 +2201,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512 (__global const u32 *in, u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2188,6 +2239,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha1 (__global const u32 *
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2248,6 +2300,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha1_final (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2285,6 +2338,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha256 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2345,6 +2399,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha256_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2382,6 +2437,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha512 (__global const u32
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2442,6 +2498,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_sha512_final (__global con
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2479,6 +2536,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_ripemd160 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 luks_decrypt_sector_aes_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector, 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 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2541,6 +2599,7 @@ DECLSPEC void luks_decrypt_sector_aes_xts_plain512_mk_ripemd160_final (__global
// luks helper // luks helper
DECLSPEC void luks_af_sha1_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha1_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha1_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -2932,6 +2991,7 @@ DECLSPEC void luks_af_sha1_then_aes_decrypt (__global const luks_t *luks_bufs, _
} }
} }
DECLSPEC void luks_af_sha256_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha256_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha256_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3291,6 +3351,7 @@ DECLSPEC void luks_af_sha256_then_aes_decrypt (__global const luks_t *luks_bufs,
} }
} }
DECLSPEC void luks_af_sha512_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha512_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_sha512_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3669,6 +3730,7 @@ DECLSPEC void luks_af_sha512_then_aes_decrypt (__global const luks_t *luks_bufs,
} }
} }
DECLSPEC void luks_af_ripemd160_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_ripemd160_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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 luks_af_ripemd160_then_aes_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf, 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)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;

View File

@ -45,6 +45,7 @@ __constant u64a AF_k_sha512[80] =
SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
}; };
DECLSPEC void AF_sha1_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void AF_sha1_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void AF_sha1_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 A = digest[0]; u32 A = digest[0];
@ -173,6 +174,7 @@ DECLSPEC void AF_sha1_transform_S (const u32 *w0, const u32 *w1, const u32 *w2,
digest[4] += E; digest[4] += E;
} }
DECLSPEC void AF_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void AF_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void AF_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -261,6 +263,7 @@ DECLSPEC void AF_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2
digest[7] += h; digest[7] += h;
} }
DECLSPEC void AF_sha512_transform_S (const u64 *w0, const u64 *w1, const u64 *w2, const u64 *w3, u64 *digest);
DECLSPEC void AF_sha512_transform_S (const u64 *w0, const u64 *w1, const u64 *w2, const u64 *w3, u64 *digest) DECLSPEC void AF_sha512_transform_S (const u64 *w0, const u64 *w1, const u64 *w2, const u64 *w3, u64 *digest)
{ {
u64 a = digest[0]; u64 a = digest[0];
@ -349,6 +352,7 @@ DECLSPEC void AF_sha512_transform_S (const u64 *w0, const u64 *w1, const u64 *w2
digest[7] += h; digest[7] += h;
} }
DECLSPEC void AF_ripemd160_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void AF_ripemd160_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void AF_ripemd160_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 w0_t = w0[0]; u32 w0_t = w0[0];
@ -565,6 +569,7 @@ DECLSPEC void AF_ripemd160_transform_S (const u32 *w0, const u32 *w1, const u32
// diffuse functions // diffuse functions
DECLSPEC void AF_sha1_diffuse16 (u32 *out);
DECLSPEC void AF_sha1_diffuse16 (u32 *out) DECLSPEC void AF_sha1_diffuse16 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -607,6 +612,7 @@ DECLSPEC void AF_sha1_diffuse16 (u32 *out)
out[3] = swap32_S (digest[3]); out[3] = swap32_S (digest[3]);
} }
DECLSPEC void AF_sha1_diffuse32 (u32 *out);
DECLSPEC void AF_sha1_diffuse32 (u32 *out) DECLSPEC void AF_sha1_diffuse32 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -681,6 +687,7 @@ DECLSPEC void AF_sha1_diffuse32 (u32 *out)
out[7] = swap32_S (digest[2]); out[7] = swap32_S (digest[2]);
} }
DECLSPEC void AF_sha1_diffuse64 (u32 *out);
DECLSPEC void AF_sha1_diffuse64 (u32 *out) DECLSPEC void AF_sha1_diffuse64 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -819,6 +826,7 @@ DECLSPEC void AF_sha1_diffuse64 (u32 *out)
out[15] = swap32_S (digest[0]); out[15] = swap32_S (digest[0]);
} }
DECLSPEC void AF_sha256_diffuse16 (u32 *out);
DECLSPEC void AF_sha256_diffuse16 (u32 *out) DECLSPEC void AF_sha256_diffuse16 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -864,6 +872,7 @@ DECLSPEC void AF_sha256_diffuse16 (u32 *out)
out[3] = swap32_S (digest[3]); out[3] = swap32_S (digest[3]);
} }
DECLSPEC void AF_sha256_diffuse32 (u32 *out);
DECLSPEC void AF_sha256_diffuse32 (u32 *out) DECLSPEC void AF_sha256_diffuse32 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -913,6 +922,7 @@ DECLSPEC void AF_sha256_diffuse32 (u32 *out)
out[7] = swap32_S (digest[7]); out[7] = swap32_S (digest[7]);
} }
DECLSPEC void AF_sha256_diffuse64 (u32 *out);
DECLSPEC void AF_sha256_diffuse64 (u32 *out) DECLSPEC void AF_sha256_diffuse64 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -1001,6 +1011,7 @@ DECLSPEC void AF_sha256_diffuse64 (u32 *out)
out[15] = swap32_S (digest[7]); out[15] = swap32_S (digest[7]);
} }
DECLSPEC void AF_sha512_diffuse16 (u32 *out);
DECLSPEC void AF_sha512_diffuse16 (u32 *out) DECLSPEC void AF_sha512_diffuse16 (u32 *out)
{ {
u64 w0[4]; u64 w0[4];
@ -1046,6 +1057,7 @@ DECLSPEC void AF_sha512_diffuse16 (u32 *out)
out[3] = swap32_S (l32_from_64_S (digest[1])); out[3] = swap32_S (l32_from_64_S (digest[1]));
} }
DECLSPEC void AF_sha512_diffuse32 (u32 *out);
DECLSPEC void AF_sha512_diffuse32 (u32 *out) DECLSPEC void AF_sha512_diffuse32 (u32 *out)
{ {
u64 w0[4]; u64 w0[4];
@ -1095,6 +1107,7 @@ DECLSPEC void AF_sha512_diffuse32 (u32 *out)
out[7] = swap32_S (l32_from_64_S (digest[3])); out[7] = swap32_S (l32_from_64_S (digest[3]));
} }
DECLSPEC void AF_sha512_diffuse64 (u32 *out);
DECLSPEC void AF_sha512_diffuse64 (u32 *out) DECLSPEC void AF_sha512_diffuse64 (u32 *out)
{ {
u64 w0[4]; u64 w0[4];
@ -1152,6 +1165,7 @@ DECLSPEC void AF_sha512_diffuse64 (u32 *out)
out[15] = swap32_S (l32_from_64_S (digest[7])); out[15] = swap32_S (l32_from_64_S (digest[7]));
} }
DECLSPEC void AF_ripemd160_diffuse16 (u32 *out);
DECLSPEC void AF_ripemd160_diffuse16 (u32 *out) DECLSPEC void AF_ripemd160_diffuse16 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -1194,6 +1208,7 @@ DECLSPEC void AF_ripemd160_diffuse16 (u32 *out)
out[3] = digest[3]; out[3] = digest[3];
} }
DECLSPEC void AF_ripemd160_diffuse32 (u32 *out);
DECLSPEC void AF_ripemd160_diffuse32 (u32 *out) DECLSPEC void AF_ripemd160_diffuse32 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];
@ -1268,6 +1283,7 @@ DECLSPEC void AF_ripemd160_diffuse32 (u32 *out)
out[7] = digest[2]; out[7] = digest[2];
} }
DECLSPEC void AF_ripemd160_diffuse64 (u32 *out);
DECLSPEC void AF_ripemd160_diffuse64 (u32 *out) DECLSPEC void AF_ripemd160_diffuse64 (u32 *out)
{ {
u32 w0[4]; u32 w0[4];

View File

@ -19,6 +19,7 @@ __constant u32a ESSIV_k_sha256[64] =
}; };
// basically a normal sha256_transform() but with a different name to avoid collisions with function nameing // basically a normal sha256_transform() but with a different name to avoid collisions with function nameing
DECLSPEC void ESSIV_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest);
DECLSPEC void ESSIV_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest) DECLSPEC void ESSIV_sha256_transform_S (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest)
{ {
u32 a = digest[0]; u32 a = digest[0];
@ -107,6 +108,7 @@ DECLSPEC void ESSIV_sha256_transform_S (const u32 *w0, const u32 *w1, const u32
digest[7] += h; digest[7] += h;
} }
DECLSPEC void ESSIV_sha256_init128 (u32 *key, u32 *essivhash);
DECLSPEC void ESSIV_sha256_init128 (u32 *key, u32 *essivhash) DECLSPEC void ESSIV_sha256_init128 (u32 *key, u32 *essivhash)
{ {
essivhash[0] = SHA256M_A; essivhash[0] = SHA256M_A;
@ -152,6 +154,7 @@ DECLSPEC void ESSIV_sha256_init128 (u32 *key, u32 *essivhash)
essivhash[7] = swap32_S (essivhash[7]); essivhash[7] = swap32_S (essivhash[7]);
} }
DECLSPEC void ESSIV_sha256_init256 (u32 *key, u32 *essivhash);
DECLSPEC void ESSIV_sha256_init256 (u32 *key, u32 *essivhash) DECLSPEC void ESSIV_sha256_init256 (u32 *key, u32 *essivhash)
{ {
essivhash[0] = SHA256M_A; essivhash[0] = SHA256M_A;

View File

@ -1,6 +1,7 @@
// cbc-essiv // cbc-essiv
DECLSPEC void serpent128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv);
DECLSPEC void serpent128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv) DECLSPEC void serpent128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv)
{ {
serpent128_decrypt (ks1, in, out); serpent128_decrypt (ks1, in, out);
@ -16,6 +17,7 @@ DECLSPEC void serpent128_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void serpent256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv);
DECLSPEC void serpent256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv) DECLSPEC void serpent256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u32 *essiv)
{ {
serpent256_decrypt (ks1, in, out); serpent256_decrypt (ks1, in, out);
@ -31,6 +33,7 @@ DECLSPEC void serpent256_decrypt_cbc (const u32 *ks1, const u32 *in, u32 *out, u
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -65,6 +68,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -102,6 +106,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -162,6 +167,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -199,6 +205,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -259,6 +266,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -296,6 +304,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -356,6 +365,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -393,6 +403,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -453,6 +464,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv128_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -487,6 +499,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -524,6 +537,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -584,6 +598,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -621,6 +636,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -681,6 +697,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -718,6 +735,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -778,6 +796,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -815,6 +834,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -877,6 +897,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_essiv256_mk_ripemd160_final (__glo
// cbc-plain // cbc-plain
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -907,6 +928,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -940,6 +962,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -996,6 +1019,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1029,6 +1053,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1085,6 +1110,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1118,6 +1144,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1174,6 +1201,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1207,6 +1235,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1263,6 +1292,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain128_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1293,6 +1323,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1326,6 +1357,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1382,6 +1414,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1415,6 +1448,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1471,6 +1505,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1504,6 +1539,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1560,6 +1596,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1593,6 +1630,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1651,6 +1689,7 @@ DECLSPEC void luks_decrypt_sector_serpent_cbc_plain256_mk_ripemd160_final (__glo
// xts-plain // xts-plain
DECLSPEC void serpent128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T);
DECLSPEC void serpent128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T) DECLSPEC void serpent128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T)
{ {
out[0] = in[0]; out[0] = in[0];
@ -1673,6 +1712,7 @@ DECLSPEC void serpent128_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void serpent256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T);
DECLSPEC void serpent256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T) DECLSPEC void serpent256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u32 *T)
{ {
out[0] = in[0]; out[0] = in[0];
@ -1695,6 +1735,7 @@ DECLSPEC void serpent256_decrypt_xts (const u32 *ks1, const u32 *in, u32 *out, u
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1729,6 +1770,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1766,6 +1808,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1826,6 +1869,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1863,6 +1907,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1923,6 +1968,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1960,6 +2006,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2020,6 +2067,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2057,6 +2105,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2117,6 +2166,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain256_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512 (__global const u32 *in, u32 *out, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2151,6 +2201,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2188,6 +2239,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2248,6 +2300,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2285,6 +2338,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2345,6 +2399,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2382,6 +2437,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2442,6 +2498,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2479,6 +2536,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector);
DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector) DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *ks1, const u32 *ks2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2541,6 +2599,7 @@ DECLSPEC void luks_decrypt_sector_serpent_xts_plain512_mk_ripemd160_final (__glo
// luks helper // luks helper
DECLSPEC void luks_af_sha1_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha1_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha1_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -2900,6 +2959,7 @@ DECLSPEC void luks_af_sha1_then_serpent_decrypt (__global const luks_t *luks_buf
} }
} }
DECLSPEC void luks_af_sha256_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha256_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha256_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3259,6 +3319,7 @@ DECLSPEC void luks_af_sha256_then_serpent_decrypt (__global const luks_t *luks_b
} }
} }
DECLSPEC void luks_af_sha512_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha512_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha512_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3637,6 +3698,7 @@ DECLSPEC void luks_af_sha512_then_serpent_decrypt (__global const luks_t *luks_b
} }
} }
DECLSPEC void luks_af_ripemd160_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_ripemd160_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_ripemd160_then_serpent_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;

View File

@ -1,6 +1,7 @@
// cbc-essiv // cbc-essiv
DECLSPEC void twofish128_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv);
DECLSPEC void twofish128_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv) DECLSPEC void twofish128_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv)
{ {
twofish128_decrypt (sk1, lk1, in, out); twofish128_decrypt (sk1, lk1, in, out);
@ -16,6 +17,7 @@ DECLSPEC void twofish128_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void twofish256_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv);
DECLSPEC void twofish256_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv) DECLSPEC void twofish256_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *essiv)
{ {
twofish256_decrypt (sk1, lk1, in, out); twofish256_decrypt (sk1, lk1, in, out);
@ -31,6 +33,7 @@ DECLSPEC void twofish256_decrypt_cbc (const u32 *sk1, const u32 *lk1, const u32
essiv[3] = in[3]; essiv[3] = in[3];
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -65,6 +68,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -102,6 +106,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -162,6 +167,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -199,6 +205,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -259,6 +266,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -296,6 +304,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -356,6 +365,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -393,6 +403,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -453,6 +464,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv128_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -487,6 +499,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -524,6 +537,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -584,6 +598,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -621,6 +636,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -681,6 +697,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -718,6 +735,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -778,6 +796,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -815,6 +834,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -877,6 +897,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_essiv256_mk_ripemd160_final (__glo
// cbc-plain // cbc-plain
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -907,6 +928,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -940,6 +962,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -996,6 +1019,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1029,6 +1053,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1085,6 +1110,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1118,6 +1144,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1174,6 +1201,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1207,6 +1235,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1263,6 +1292,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain128_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1293,6 +1323,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1326,6 +1357,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1382,6 +1414,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1415,6 +1448,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1471,6 +1505,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1504,6 +1539,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1560,6 +1596,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1593,6 +1630,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1651,6 +1689,7 @@ DECLSPEC void luks_decrypt_sector_twofish_cbc_plain256_mk_ripemd160_final (__glo
// xts-plain // xts-plain
DECLSPEC void twofish128_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T);
DECLSPEC void twofish128_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T) DECLSPEC void twofish128_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T)
{ {
out[0] = in[0]; out[0] = in[0];
@ -1673,6 +1712,7 @@ DECLSPEC void twofish128_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void twofish256_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T);
DECLSPEC void twofish256_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T) DECLSPEC void twofish256_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32 *in, u32 *out, u32 *T)
{ {
out[0] = in[0]; out[0] = in[0];
@ -1695,6 +1735,7 @@ DECLSPEC void twofish256_decrypt_xts (const u32 *sk1, const u32 *lk1, const u32
xts_mul2 (T, T); xts_mul2 (T, T);
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1729,6 +1770,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1766,6 +1808,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1826,6 +1869,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1863,6 +1907,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1923,6 +1968,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -1960,6 +2006,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2020,6 +2067,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2057,6 +2105,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2117,6 +2166,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain256_mk_ripemd160_final (__glo
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512 (__global const u32 *in, u32 *out, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2151,6 +2201,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512 (__global const u32 *in,
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2188,6 +2239,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1 (__global const u
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2248,6 +2300,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha1_final (__global c
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2285,6 +2338,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2345,6 +2399,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha256_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2382,6 +2437,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512 (__global const
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2442,6 +2498,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_sha512_final (__global
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160 (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2479,6 +2536,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160 (__global co
} }
} }
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector);
DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector) DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160_final (__global const u32 *in, u32 *mk, const u32 *sk1, const u32 *lk1, const u32 *sk2, const u32 *lk2, const u32 sector)
{ {
u32 S[4] = { sector, 0, 0, 0 }; u32 S[4] = { sector, 0, 0, 0 };
@ -2541,6 +2599,7 @@ DECLSPEC void luks_decrypt_sector_twofish_xts_plain512_mk_ripemd160_final (__glo
// luks helper // luks helper
DECLSPEC void luks_af_sha1_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha1_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha1_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -2900,6 +2959,7 @@ DECLSPEC void luks_af_sha1_then_twofish_decrypt (__global const luks_t *luks_buf
} }
} }
DECLSPEC void luks_af_sha256_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha256_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha256_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3259,6 +3319,7 @@ DECLSPEC void luks_af_sha256_then_twofish_decrypt (__global const luks_t *luks_b
} }
} }
DECLSPEC void luks_af_sha512_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_sha512_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_sha512_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;
@ -3637,6 +3698,7 @@ DECLSPEC void luks_af_sha512_then_twofish_decrypt (__global const luks_t *luks_b
} }
} }
DECLSPEC void luks_af_ripemd160_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf);
DECLSPEC void luks_af_ripemd160_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf) DECLSPEC void luks_af_ripemd160_then_twofish_decrypt (__global const luks_t *luks_bufs, __global luks_tmp_t *tmps, u32 *pt_buf)
{ {
const u32 key_size = luks_bufs->key_size; const u32 key_size = luks_bufs->key_size;

View File

@ -1,3 +1,4 @@
DECLSPEC void xts_mul2 (u32 *in, u32 *out);
DECLSPEC void xts_mul2 (u32 *in, u32 *out) DECLSPEC void xts_mul2 (u32 *in, u32 *out)
{ {
const u32 c = in[3] >> 31; const u32 c = in[3] >> 31;

View File

@ -3,8 +3,11 @@
* License.....: MIT * License.....: MIT
*/ */
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif
u32 generate_cmask (const u32 value);
u32 generate_cmask (const u32 value) u32 generate_cmask (const u32 value)
{ {
const u32 rmask = ((value & 0x40404040u) >> 1u) const u32 rmask = ((value & 0x40404040u) >> 1u)
@ -16,6 +19,7 @@ u32 generate_cmask (const u32 value)
return rmask & ~hmask & lmask; return rmask & ~hmask & lmask;
} }
void append_four_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst);
void append_four_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst) void append_four_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst)
{ {
const int sd = off_src / 4; const int sd = off_src / 4;
@ -39,6 +43,7 @@ void append_four_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, cons
buf_dst[dd + 1] |= t1; buf_dst[dd + 1] |= t1;
} }
void append_three_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst);
void append_three_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst) void append_three_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst)
{ {
const int sd = off_src / 4; const int sd = off_src / 4;
@ -62,6 +67,7 @@ void append_three_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, con
buf_dst[dd + 1] |= t1; buf_dst[dd + 1] |= t1;
} }
void append_two_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst);
void append_two_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst) void append_two_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst)
{ {
const int sd = off_src / 4; const int sd = off_src / 4;
@ -85,6 +91,7 @@ void append_two_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const
buf_dst[dd + 1] |= t1; buf_dst[dd + 1] |= t1;
} }
void append_one_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst);
void append_one_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst) void append_one_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst)
{ {
const int sd = off_src / 4; const int sd = off_src / 4;
@ -104,6 +111,7 @@ void append_one_byte (const u32 *buf_src, const int off_src, u32 *buf_dst, const
buf_dst[dd] |= t; buf_dst[dd] |= t;
} }
void append_block (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst, const int len);
void append_block (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst, const int len) void append_block (const u32 *buf_src, const int off_src, u32 *buf_dst, const int off_dst, const int len)
{ {
int i; int i;
@ -123,6 +131,7 @@ void append_block (const u32 *buf_src, const int off_src, u32 *buf_dst, const in
} }
} }
void exchange_byte (u32 *buf, const int off_src, const int off_dst);
void exchange_byte (u32 *buf, const int off_src, const int off_dst) void exchange_byte (u32 *buf, const int off_src, const int off_dst)
{ {
u8 *ptr = (u8 *) buf; u8 *ptr = (u8 *) buf;
@ -162,6 +171,7 @@ void exchange_byte (u32 *buf, const int off_src, const int off_dst)
*/ */
} }
int mangle_lrest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_lrest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_lrest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
@ -174,6 +184,7 @@ int mangle_lrest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf,
return (len); return (len);
} }
int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
@ -190,6 +201,7 @@ int mangle_lrest_ufirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
@ -202,6 +214,7 @@ int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf,
return (len); return (len);
} }
int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
@ -218,6 +231,7 @@ int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
@ -230,6 +244,7 @@ int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf,
return (len); return (len);
} }
int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -246,6 +261,7 @@ int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *b
return (len); return (len);
} }
int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int l = 0; l < len / 2; l++) for (int l = 0; l < len / 2; l++)
@ -258,6 +274,7 @@ int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf
return (len); return (len);
} }
int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
const int out_len = len * 2; const int out_len = len * 2;
@ -269,6 +286,7 @@ int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *bu
return (out_len); return (out_len);
} }
int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = (len * p0) + len; const int out_len = (len * p0) + len;
@ -282,6 +300,7 @@ int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u
return (out_len); return (out_len);
} }
int mangle_reflect (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_reflect (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_reflect (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
const int out_len = len * 2; const int out_len = len * 2;
@ -300,6 +319,7 @@ int mangle_reflect (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf
return out_len; return out_len;
} }
int mangle_append (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_append (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_append (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = len + 1; const int out_len = len + 1;
@ -311,6 +331,7 @@ int mangle_append (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf,
return (out_len); return (out_len);
} }
int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = len + 1; const int out_len = len + 1;
@ -327,6 +348,7 @@ int mangle_prepend (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf,
return (out_len); return (out_len);
} }
int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int l = 0, r = len - 1; r > l; r--) for (int l = 0, r = len - 1; r > l; r--)
@ -337,6 +359,7 @@ int mangle_rotate_left (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
for (int l = 0, r = len - 1; l < r; l++) for (int l = 0, r = len - 1; l < r; l++)
@ -347,6 +370,7 @@ int mangle_rotate_right (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_delete_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_delete_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_delete_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -361,11 +385,13 @@ int mangle_delete_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *bu
return (len - 1); return (len - 1);
} }
int mangle_delete_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_delete_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_delete_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
return mangle_delete_at (0, p1, buf, len); return mangle_delete_at (0, p1, buf, len);
} }
int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (len == 0) return 0; if (len == 0) return 0;
@ -373,6 +399,7 @@ int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *
return mangle_delete_at (len - 1, p1, buf, len); return mangle_delete_at (len - 1, p1, buf, len);
} }
int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -392,6 +419,7 @@ int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf,
return (p1); return (p1);
} }
int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -411,6 +439,7 @@ int mangle_omit (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, co
return (len - p1); return (len - p1);
} }
int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len + 1) return (len); if (p0 >= len + 1) return (len);
@ -429,6 +458,7 @@ int mangle_insert (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf,
return (out_len); return (out_len);
} }
int mangle_overstrike (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_overstrike (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_overstrike (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -438,6 +468,7 @@ int mangle_overstrike (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *b
return (len); return (len);
} }
int mangle_truncate_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_truncate_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_truncate_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -450,6 +481,7 @@ int mangle_truncate_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *
return (p0); return (p0);
} }
int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
for (int pos = 0; pos < len; pos++) for (int pos = 0; pos < len; pos++)
@ -462,6 +494,7 @@ int mangle_replace (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf,
return (len); return (len);
} }
int mangle_purgechar (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_purgechar (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_purgechar (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
int out_len = 0; int out_len = 0;
@ -483,6 +516,7 @@ int mangle_purgechar (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *bu
return (out_len); return (out_len);
} }
int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = len + p0; const int out_len = len + p0;
@ -499,6 +533,7 @@ int mangle_dupechar_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u
return (out_len); return (out_len);
} }
int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = len + p0; const int out_len = len + p0;
@ -516,6 +551,7 @@ int mangle_dupechar_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8
return (out_len); return (out_len);
} }
int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
const int out_len = len + len; const int out_len = len + len;
@ -534,6 +570,7 @@ int mangle_dupechar_all (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8
return (out_len); return (out_len);
} }
int mangle_switch_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_switch_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_switch_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if (len < 2) return (len); if (len < 2) return (len);
@ -543,6 +580,7 @@ int mangle_switch_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_switch_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_switch_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_switch_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if (len < 2) return (len); if (len < 2) return (len);
@ -552,6 +590,7 @@ int mangle_switch_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32
return (len); return (len);
} }
int mangle_switch_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_switch_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_switch_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -562,6 +601,7 @@ int mangle_switch_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *b
return (len); return (len);
} }
int mangle_chr_shiftl (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_chr_shiftl (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_chr_shiftl (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -571,6 +611,7 @@ int mangle_chr_shiftl (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *b
return (len); return (len);
} }
int mangle_chr_shiftr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_chr_shiftr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_chr_shiftr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -580,6 +621,7 @@ int mangle_chr_shiftr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *b
return (len); return (len);
} }
int mangle_chr_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_chr_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_chr_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -589,6 +631,7 @@ int mangle_chr_incr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf
return (len); return (len);
} }
int mangle_chr_decr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_chr_decr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_chr_decr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -598,6 +641,7 @@ int mangle_chr_decr (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf
return (len); return (len);
} }
int mangle_replace_np1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_replace_np1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_replace_np1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if ((p0 + 1) >= len) return (len); if ((p0 + 1) >= len) return (len);
@ -607,6 +651,7 @@ int mangle_replace_np1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *
return (len); return (len);
} }
int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 == 0) return (len); if (p0 == 0) return (len);
@ -618,6 +663,7 @@ int mangle_replace_nm1 (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *
return (len); return (len);
} }
int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -636,6 +682,7 @@ int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1,
return (out_len); return (out_len);
} }
int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len);
int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len) int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
{ {
if (p0 >= len) return (len); if (p0 >= len) return (len);
@ -654,6 +701,7 @@ int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u
return (out_len); return (out_len);
} }
int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len);
int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1 if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1
@ -679,6 +727,7 @@ int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *b
return (len); return (len);
} }
int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int in_len);
int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int in_len) int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int in_len)
{ {
int out_len = in_len; int out_len = in_len;
@ -730,6 +779,7 @@ int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8
return out_len; return out_len;
} }
int apply_rules (__constant const u32 *cmds, u32 *buf, const int in_len);
int apply_rules (__constant const u32 *cmds, u32 *buf, const int in_len) int apply_rules (__constant const u32 *cmds, u32 *buf, const int in_len)
{ {
int out_len = in_len; int out_len = in_len;

View File

@ -3,8 +3,11 @@
* License.....: MIT * License.....: MIT
*/ */
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif
u32 generate_cmask (const u32 value);
u32 generate_cmask (const u32 value) u32 generate_cmask (const u32 value)
{ {
const u32 rmask = ((value & 0x40404040u) >> 1u) const u32 rmask = ((value & 0x40404040u) >> 1u)
@ -16,6 +19,7 @@ u32 generate_cmask (const u32 value)
return rmask & ~hmask & lmask; return rmask & ~hmask & lmask;
} }
void truncate_right (u32 *buf0, u32 *buf1, const u32 offset);
void truncate_right (u32 *buf0, u32 *buf1, const u32 offset) void truncate_right (u32 *buf0, u32 *buf1, const u32 offset)
{ {
const u32 tmp = (1u << ((offset & 3u) * 8u)) - 1u; const u32 tmp = (1u << ((offset & 3u) * 8u)) - 1u;
@ -75,6 +79,7 @@ void truncate_right (u32 *buf0, u32 *buf1, const u32 offset)
} }
} }
void truncate_left (u32 *buf0, u32 *buf1, const u32 offset);
void truncate_left (u32 *buf0, u32 *buf1, const u32 offset) void truncate_left (u32 *buf0, u32 *buf1, const u32 offset)
{ {
const u32 tmp = ~((1u << ((offset & 3u) * 8u)) - 1u); const u32 tmp = ~((1u << ((offset & 3u) * 8u)) - 1u);
@ -134,6 +139,7 @@ void truncate_left (u32 *buf0, u32 *buf1, const u32 offset)
} }
} }
void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1);
void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1) void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
{ {
out0[0] = hc_bytealign_S (in0[1], in0[0], 1); out0[0] = hc_bytealign_S (in0[1], in0[0], 1);
@ -146,6 +152,7 @@ void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
out1[3] = hc_bytealign_S ( 0, in1[3], 1); out1[3] = hc_bytealign_S ( 0, in1[3], 1);
} }
void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1);
void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1) void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
{ {
out1[3] = hc_bytealign_S (in1[3], in1[2], 3); out1[3] = hc_bytealign_S (in1[3], in1[2], 3);
@ -158,6 +165,7 @@ void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
out0[0] = hc_bytealign_S (in0[0], 0, 3); out0[0] = hc_bytealign_S (in0[0], 0, 3);
} }
void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num);
void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num) void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
{ {
switch (num) switch (num)
@ -453,6 +461,7 @@ void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const
} }
} }
void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num);
void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num) void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
{ {
switch (num) switch (num)
@ -748,6 +757,7 @@ void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const
} }
} }
void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0);
void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0) void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0)
{ {
// this version works with 1 byte append only // this version works with 1 byte append only
@ -769,6 +779,7 @@ void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0)
} }
void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1);
void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1) void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1)
{ {
u32 s0 = 0; u32 s0 = 0;
@ -1024,6 +1035,7 @@ void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, c
buf1[3] = src_l1[3] | s7; buf1[3] = src_l1[3] | s7;
} }
void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len);
void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len) void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len)
{ {
rshift_block_N (in0, in1, out0, out1, 32 - len); rshift_block_N (in0, in1, out0, out1, 32 - len);
@ -1050,6 +1062,7 @@ void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len)
out1[3] = swap32_S (tib41[3]); out1[3] = swap32_S (tib41[3]);
} }
void exchange_byte (u32 *buf, const int off_src, const int off_dst);
void exchange_byte (u32 *buf, const int off_src, const int off_dst) void exchange_byte (u32 *buf, const int off_src, const int off_dst)
{ {
u8 *ptr = (u8 *) buf; u8 *ptr = (u8 *) buf;
@ -1060,6 +1073,7 @@ void exchange_byte (u32 *buf, const int off_src, const int off_dst)
ptr[off_dst] = tmp; ptr[off_dst] = tmp;
} }
u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
u32 t; u32 t;
@ -1076,6 +1090,7 @@ u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
return in_len; return in_len;
} }
u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
u32 t; u32 t;
@ -1092,6 +1107,7 @@ u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
return in_len; return in_len;
} }
u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
u32 t; u32 t;
@ -1110,6 +1126,7 @@ u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return in_len; return in_len;
} }
u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
u32 t; u32 t;
@ -1128,6 +1145,7 @@ u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return in_len; return in_len;
} }
u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
u32 t; u32 t;
@ -1144,6 +1162,7 @@ u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
return in_len; return in_len;
} }
u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1177,6 +1196,7 @@ u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return (in_len); return (in_len);
} }
u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
reverse_block (buf0, buf1, buf0, buf1, in_len); reverse_block (buf0, buf1, buf0, buf1, in_len);
@ -1184,6 +1204,7 @@ u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
return in_len; return in_len;
} }
u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ((in_len + in_len) >= 32) return in_len; if ((in_len + in_len) >= 32) return in_len;
@ -1197,6 +1218,7 @@ u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
return out_len; return out_len;
} }
u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (((in_len * p0) + in_len) >= 32) return in_len; if (((in_len * p0) + in_len) >= 32) return in_len;
@ -1225,6 +1247,7 @@ u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
return out_len; return out_len;
} }
u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ((in_len + in_len) >= 32) return in_len; if ((in_len + in_len) >= 32) return in_len;
@ -1243,6 +1266,7 @@ u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
return out_len; return out_len;
} }
u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ((in_len + 1) >= 32) return in_len; if ((in_len + 1) >= 32) return in_len;
@ -1256,6 +1280,7 @@ u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
return out_len; return out_len;
} }
u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ((in_len + 1) >= 32) return in_len; if ((in_len + 1) >= 32) return in_len;
@ -1271,6 +1296,7 @@ u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
return out_len; return out_len;
} }
u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len == 0) return in_len; if (in_len == 0) return in_len;
@ -1286,6 +1312,7 @@ u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return in_len; return in_len;
} }
u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len == 0) return in_len; if (in_len == 0) return in_len;
@ -1328,6 +1355,7 @@ u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return in_len; return in_len;
} }
u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len == 0) return in_len; if (in_len == 0) return in_len;
@ -1339,6 +1367,7 @@ u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return in_len1; return in_len1;
} }
u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len == 0) return in_len; if (in_len == 0) return in_len;
@ -1359,6 +1388,7 @@ u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return in_len1; return in_len1;
} }
u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1440,6 +1470,7 @@ u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return out_len; return out_len;
} }
u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1455,6 +1486,7 @@ u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
return out_len; return out_len;
} }
u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1547,6 +1579,7 @@ u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, M
return out_len; return out_len;
} }
u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 > in_len) return in_len; if (p0 > in_len) return in_len;
@ -1625,6 +1658,7 @@ u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
return out_len; return out_len;
} }
u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1660,6 +1694,7 @@ u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return in_len; return in_len;
} }
u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1669,6 +1704,7 @@ u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return p0; return p0;
} }
u32 search_on_register (const u32 in, const u32 p0);
u32 search_on_register (const u32 in, const u32 p0) u32 search_on_register (const u32 in, const u32 p0)
{ {
u32 r = 0; u32 r = 0;
@ -1681,6 +1717,7 @@ u32 search_on_register (const u32 in, const u32 p0)
return r; return r;
} }
u32 replace_on_register (const u32 in, const u32 r, const u32 p1);
u32 replace_on_register (const u32 in, const u32 r, const u32 p1) u32 replace_on_register (const u32 in, const u32 r, const u32 p1)
{ {
u32 out = in; u32 out = in;
@ -1693,6 +1730,7 @@ u32 replace_on_register (const u32 in, const u32 r, const u32 p1)
return out; return out;
} }
u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
const u32 r0 = search_on_register (buf0[0], p0); const u32 r0 = search_on_register (buf0[0], p0);
@ -1720,6 +1758,7 @@ u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
return in_len; return in_len;
} }
u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
const u32 r0 = search_on_register (buf0[0], p0); const u32 r0 = search_on_register (buf0[0], p0);
@ -1774,6 +1813,7 @@ u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return out_len; return out_len;
} }
u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ( in_len == 0) return in_len; if ( in_len == 0) return in_len;
@ -1809,6 +1849,7 @@ u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
return out_len; return out_len;
} }
u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ( in_len == 0) return in_len; if ( in_len == 0) return in_len;
@ -1855,6 +1896,7 @@ u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
return out_len; return out_len;
} }
u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ( in_len == 0) return in_len; if ( in_len == 0) return in_len;
@ -1888,6 +1930,7 @@ u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return out_len; return out_len;
} }
u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len < 2) return in_len; if (in_len < 2) return in_len;
@ -1897,6 +1940,7 @@ u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
return in_len; return in_len;
} }
u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len < 2) return in_len; if (in_len < 2) return in_len;
@ -1926,6 +1970,7 @@ u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return in_len; return in_len;
} }
u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1956,6 +2001,7 @@ u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return in_len; return in_len;
} }
u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -1990,6 +2036,7 @@ u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return in_len; return in_len;
} }
u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -2024,6 +2071,7 @@ u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return in_len; return in_len;
} }
u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -2060,6 +2108,7 @@ u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
return in_len; return in_len;
} }
u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 >= in_len) return in_len; if (p0 >= in_len) return in_len;
@ -2096,6 +2145,7 @@ u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
return in_len; return in_len;
} }
u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if ((p0 + 1) >= in_len) return in_len; if ((p0 + 1) >= in_len) return in_len;
@ -2136,6 +2186,7 @@ u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return in_len; return in_len;
} }
u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 == 0) return in_len; if (p0 == 0) return in_len;
@ -2178,6 +2229,7 @@ u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
return in_len; return in_len;
} }
u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 > in_len) return in_len; if (p0 > in_len) return in_len;
@ -2216,6 +2268,7 @@ u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED cons
return out_len; return out_len;
} }
u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (p0 > in_len) return in_len; if (p0 > in_len) return in_len;
@ -2245,6 +2298,7 @@ u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
return out_len; return out_len;
} }
u32 toggle_on_register (const u32 in, const u32 r);
u32 toggle_on_register (const u32 in, const u32 r) u32 toggle_on_register (const u32 in, const u32 r)
{ {
u32 out = in; u32 out = in;
@ -2259,6 +2313,7 @@ u32 toggle_on_register (const u32 in, const u32 r)
return out; return out;
} }
u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len);
u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
{ {
if (in_len == 0) return in_len; if (in_len == 0) return in_len;
@ -2299,6 +2354,7 @@ u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
return in_len; return in_len;
} }
u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len);
u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len) u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len)
{ {
u32 out_len = in_len; u32 out_len = in_len;
@ -2351,6 +2407,7 @@ u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1
return out_len; return out_len;
} }
u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len);
u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len) u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len)
{ {
u32 out_len = len; u32 out_len = len;
@ -2369,6 +2426,7 @@ u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len
return out_len; return out_len;
} }
u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, __constant const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1);
u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, __constant const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1) u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, __constant const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1

View File

@ -11,7 +11,7 @@
\ \
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
} \ } \
} \ } \
} }
@ -35,7 +35,7 @@
\ \
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
} \ } \
} \ } \
} \ } \

View File

@ -18,7 +18,7 @@
\ \
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \
} \ } \
} \ } \
} }
@ -42,7 +42,7 @@
\ \
if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -67,7 +67,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
\ \
@ -77,7 +77,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
} }
@ -102,7 +102,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -122,7 +122,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -145,7 +145,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
\ \
@ -155,7 +155,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
\ \
@ -165,7 +165,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
\ \
@ -175,7 +175,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
} }
@ -202,7 +202,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -222,7 +222,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -242,7 +242,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -262,7 +262,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -285,7 +285,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
\ \
@ -295,7 +295,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
\ \
@ -305,7 +305,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
\ \
@ -315,7 +315,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \ if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \
@ -324,7 +324,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \ } \
} \ } \
\ \
@ -334,7 +334,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \ } \
} \ } \
\ \
@ -344,7 +344,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \ } \
} \ } \
\ \
@ -354,7 +354,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \ } \
} \ } \
} }
@ -385,7 +385,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -405,7 +405,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -425,7 +425,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -445,7 +445,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -464,7 +464,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -484,7 +484,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -504,7 +504,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -524,7 +524,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -547,7 +547,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
\ \
@ -557,7 +557,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
\ \
@ -567,7 +567,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
\ \
@ -577,7 +577,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \ if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \
@ -586,7 +586,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \ } \
} \ } \
\ \
@ -596,7 +596,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \ } \
} \ } \
\ \
@ -606,7 +606,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \ } \
} \ } \
\ \
@ -616,7 +616,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \ } \
} \ } \
\ \
@ -626,7 +626,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 8); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 8, 0, 0); \
} \ } \
} \ } \
\ \
@ -636,7 +636,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 9); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 9, 0, 0); \
} \ } \
} \ } \
\ \
@ -646,7 +646,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 10); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 10, 0, 0); \
} \ } \
} \ } \
\ \
@ -656,7 +656,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 11); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 11, 0, 0); \
} \ } \
} \ } \
\ \
@ -666,7 +666,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 12); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 12, 0, 0); \
} \ } \
} \ } \
\ \
@ -676,7 +676,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 13); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 13, 0, 0); \
} \ } \
} \ } \
\ \
@ -686,7 +686,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 14); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 14, 0, 0); \
} \ } \
} \ } \
\ \
@ -696,7 +696,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 15); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 15, 0, 0); \
} \ } \
} \ } \
} }
@ -735,7 +735,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -755,7 +755,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -775,7 +775,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -795,7 +795,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -815,7 +815,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -835,7 +835,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -855,7 +855,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -875,7 +875,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -895,7 +895,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -915,7 +915,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -935,7 +935,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -955,7 +955,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -975,7 +975,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -995,7 +995,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -1015,7 +1015,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -1035,7 +1035,7 @@
\ \
if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \
{ \ { \
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15); \ mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15, 0, 0); \
} \ } \
} \ } \
} \ } \
@ -1048,6 +1048,7 @@
// attack-mode 0 // attack-mode 0
DECLSPEC u32x ix_create_bft (__global const bf_t *bfs_buf, const u32 il_pos);
DECLSPEC u32x ix_create_bft (__global const bf_t *bfs_buf, const u32 il_pos) DECLSPEC u32x ix_create_bft (__global const bf_t *bfs_buf, const u32 il_pos)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -1067,6 +1068,7 @@ DECLSPEC u32x ix_create_bft (__global const bf_t *bfs_buf, const u32 il_pos)
// attack-mode 1 // attack-mode 1
DECLSPEC u32x pwlenx_create_combt (__global const pw_t *combs_buf, const u32 il_pos);
DECLSPEC u32x pwlenx_create_combt (__global const pw_t *combs_buf, const u32 il_pos) DECLSPEC u32x pwlenx_create_combt (__global const pw_t *combs_buf, const u32 il_pos)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1
@ -1084,6 +1086,7 @@ DECLSPEC u32x pwlenx_create_combt (__global const pw_t *combs_buf, const u32 il_
return pw_lenx; return pw_lenx;
} }
DECLSPEC u32x ix_create_combt (__global const pw_t *combs_buf, const u32 il_pos, const int idx);
DECLSPEC u32x ix_create_combt (__global const pw_t *combs_buf, const u32 il_pos, const int idx) DECLSPEC u32x ix_create_combt (__global const pw_t *combs_buf, const u32 il_pos, const int idx)
{ {
#if VECT_SIZE == 1 #if VECT_SIZE == 1

View File

@ -66,6 +66,7 @@ __constant u32a crc32tab[0x100] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
}; };
DECLSPEC u32 round_crc32 (u32 a, const u32 v);
DECLSPEC u32 round_crc32 (u32 a, const u32 v) DECLSPEC u32 round_crc32 (u32 a, const u32 v)
{ {
const u32 k = (a ^ v) & 0xff; const u32 k = (a ^ v) & 0xff;
@ -79,6 +80,7 @@ DECLSPEC u32 round_crc32 (u32 a, const u32 v)
return a; return a;
} }
DECLSPEC u32 round_crc32_4 (const u32 w, const u32 iv);
DECLSPEC u32 round_crc32_4 (const u32 w, const u32 iv) DECLSPEC u32 round_crc32_4 (const u32 w, const u32 iv)
{ {
u32 a = iv; u32 a = iv;

View File

@ -1,3 +1,4 @@
DECLSPEC u32 u8add (const u32 a, const u32 b);
DECLSPEC u32 u8add (const u32 a, const u32 b) DECLSPEC u32 u8add (const u32 a, const u32 b)
{ {
const u32 a1 = (a >> 0) & 0xff; const u32 a1 = (a >> 0) & 0xff;

View File

@ -1,3 +1,4 @@
DECLSPEC void xts_mul2 (u32 *in, u32 *out);
DECLSPEC void xts_mul2 (u32 *in, u32 *out) DECLSPEC void xts_mul2 (u32 *in, u32 *out)
{ {
const u32 c = in[3] >> 31; const u32 c = in[3] >> 31;
@ -10,6 +11,7 @@ DECLSPEC void xts_mul2 (u32 *in, u32 *out)
out[0] ^= c * 0x87; out[0] ^= c * 0x87;
} }
DECLSPEC void aes256_decrypt_xts_first (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 aes256_decrypt_xts_first (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 aes256_decrypt_xts_first (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[0] = in[0];
@ -34,6 +36,7 @@ DECLSPEC void aes256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, cons
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void aes256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks, 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_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks, 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_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks, 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[0] = in[0];
@ -56,6 +59,7 @@ DECLSPEC void aes256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks,
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void serpent256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks);
DECLSPEC void serpent256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks) DECLSPEC void serpent256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -80,6 +84,7 @@ DECLSPEC void serpent256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2,
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void serpent256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks);
DECLSPEC void serpent256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks) DECLSPEC void serpent256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -102,6 +107,7 @@ DECLSPEC void serpent256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void twofish256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk);
DECLSPEC void twofish256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk) DECLSPEC void twofish256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *sk, u32 *lk)
{ {
out[0] = in[0]; out[0] = in[0];
@ -126,6 +132,7 @@ DECLSPEC void twofish256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2,
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void twofish256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *sk, u32 *lk);
DECLSPEC void twofish256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *sk, u32 *lk) DECLSPEC void twofish256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *sk, u32 *lk)
{ {
out[0] = in[0]; out[0] = in[0];
@ -150,7 +157,8 @@ DECLSPEC void twofish256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32
// 512 bit // 512 bit
DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, 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 verify_header_aes (__global const u32 *data_buf, const u32 signature, 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 verify_header_aes (__global const u32 *data_buf, const u32 signature, 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]; u32 ks_aes[60];
@ -160,17 +168,15 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
aes256_decrypt_xts_first (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); aes256_decrypt_xts_first (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);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -188,10 +194,10 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4);
@ -206,7 +212,8 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey
return 1; return 1;
} }
DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) DECLSPEC int verify_header_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int verify_header_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2)
{ {
u32 ks_serpent[140]; u32 ks_serpent[140];
@ -216,17 +223,15 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
serpent256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_serpent, ks_serpent);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -244,10 +249,10 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent);
@ -262,7 +267,8 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *
return 1; return 1;
} }
DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) DECLSPEC int verify_header_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int verify_header_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2)
{ {
u32 sk_twofish[4]; u32 sk_twofish[4];
u32 lk_twofish[40]; u32 lk_twofish[40];
@ -273,17 +279,15 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
twofish256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -301,10 +305,10 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish);
@ -321,7 +325,8 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *
// 1024 bit // 1024 bit
DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, 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 verify_header_aes_twofish (__global const u32 *data_buf, const u32 signature, 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 verify_header_aes_twofish (__global const u32 *data_buf, const u32 signature, 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 ks_aes[60];
@ -335,18 +340,16 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
aes256_decrypt_xts_first (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); aes256_decrypt_xts_first (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);
twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -365,10 +368,10 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4);
twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish);
@ -384,7 +387,8 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u
return 1; return 1;
} }
DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, 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 verify_header_serpent_aes (__global const u32 *data_buf, const u32 signature, 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 verify_header_serpent_aes (__global const u32 *data_buf, const u32 signature, 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_serpent[140];
u32 ks_aes[60]; u32 ks_aes[60];
@ -396,18 +400,16 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
serpent256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_serpent, ks_serpent);
aes256_decrypt_xts_first (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); aes256_decrypt_xts_first (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);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -426,10 +428,10 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent);
aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4);
@ -445,7 +447,8 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u
return 1; return 1;
} }
DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) DECLSPEC int verify_header_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
DECLSPEC int verify_header_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
{ {
u32 sk_twofish[4]; u32 sk_twofish[4];
u32 lk_twofish[40]; u32 lk_twofish[40];
@ -459,18 +462,16 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
twofish256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_twofish, sk_twofish, lk_twofish);
serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -489,10 +490,10 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish);
serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent);
@ -510,7 +511,8 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con
// 1536 bit // 1536 bit
DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, 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 verify_header_aes_twofish_serpent (__global const u32 *data_buf, const u32 signature, 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 verify_header_aes_twofish_serpent (__global const u32 *data_buf, const u32 signature, 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 ks_aes[60];
@ -527,10 +529,10 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs,
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
@ -538,8 +540,6 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs,
twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
serpent256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_serpent, ks_serpent);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -559,10 +559,10 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs,
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4);
twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish);
@ -579,7 +579,8 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs,
return 1; return 1;
} }
DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, 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 verify_header_serpent_twofish_aes (__global const u32 *data_buf, const u32 signature, 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 verify_header_serpent_twofish_aes (__global const u32 *data_buf, const u32 signature, 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 ks_serpent[140];
@ -596,10 +597,10 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs,
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
@ -607,8 +608,6 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs,
twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
aes256_decrypt_xts_first (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); aes256_decrypt_xts_first (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);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -628,10 +627,10 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs,
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent);
twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish);

File diff suppressed because it is too large Load Diff

View File

@ -100,97 +100,3 @@
#ifdef NO_UNROLL #ifdef NO_UNROLL
#undef _unroll #undef _unroll
#endif #endif
#if KERN_TYPE == 1420
#undef _unroll
#endif
#if KERN_TYPE == 1450
#undef _unroll
#endif
#if KERN_TYPE == 1460
#undef _unroll
#endif
#if KERN_TYPE == 1720
#undef _unroll
#endif
#if KERN_TYPE == 1750
#undef _unroll
#endif
#if KERN_TYPE == 1760
#undef _unroll
#endif
#if KERN_TYPE == 1800
#undef _unroll
#endif
#if KERN_TYPE == 6221
#undef _unroll
#endif
#if KERN_TYPE == 6222
#undef _unroll
#endif
#if KERN_TYPE == 6223
#undef _unroll
#endif
#if KERN_TYPE == 6400
#undef _unroll
#endif
#if KERN_TYPE == 6500
#undef _unroll
#endif
#if KERN_TYPE == 7100
#undef _unroll
#endif
#if KERN_TYPE == 7400
#undef _unroll
#endif
#if KERN_TYPE == 7900
#undef _unroll
#endif
#if KERN_TYPE == 8900
#undef _unroll
#endif
#if KERN_TYPE == 10700
#undef _unroll
#endif
#if KERN_TYPE == 13721
#undef _unroll
#endif
#if KERN_TYPE == 13722
#undef _unroll
#endif
#if KERN_TYPE == 13723
#undef _unroll
#endif
#if KERN_TYPE == 13751
#undef _unroll
#endif
#if KERN_TYPE == 13752
#undef _unroll
#endif
#if KERN_TYPE == 13753
#undef _unroll
#endif
#if KERN_TYPE == 13800
#undef _unroll
#endif
#if KERN_TYPE == 15700
#undef _unroll
#endif
// nvidia specific
#ifdef IS_NV
#ifdef IS_GPU
#endif
#endif
// apple specific
#ifdef IS_APPLE
#if KERN_TYPE == 5000
#undef _unroll
#endif
#endif

View File

@ -1,3 +1,4 @@
DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks);
DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks) DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -22,6 +23,7 @@ DECLSPEC void camellia256_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2,
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void camellia256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks);
DECLSPEC void camellia256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks) DECLSPEC void camellia256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -44,6 +46,7 @@ DECLSPEC void camellia256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void kuznyechik_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks);
DECLSPEC void kuznyechik_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks) DECLSPEC void kuznyechik_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2, const u32 *in, u32 *out, u32 *S, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -68,6 +71,7 @@ DECLSPEC void kuznyechik_decrypt_xts_first (const u32 *ukey1, const u32 *ukey2,
out[3] ^= T[3]; out[3] ^= T[3];
} }
DECLSPEC void kuznyechik_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks);
DECLSPEC void kuznyechik_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks) DECLSPEC void kuznyechik_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 *ks)
{ {
out[0] = in[0]; out[0] = in[0];
@ -92,7 +96,8 @@ DECLSPEC void kuznyechik_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32
// 512 bit // 512 bit
DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) DECLSPEC int verify_header_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int verify_header_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2)
{ {
u32 ks_camellia[68]; u32 ks_camellia[68];
@ -102,17 +107,15 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
camellia256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_camellia, ks_camellia); camellia256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_camellia, ks_camellia);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -130,10 +133,10 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia);
@ -148,7 +151,8 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32
return 1; return 1;
} }
DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) DECLSPEC int verify_header_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2);
DECLSPEC int verify_header_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2)
{ {
u32 ks_kuznyechik[40]; u32 ks_kuznyechik[40];
@ -158,17 +162,15 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
kuznyechik_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_kuznyechik, ks_kuznyechik);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -186,10 +188,10 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik);
@ -206,7 +208,8 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3
// 1024 bit // 1024 bit
DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) DECLSPEC int verify_header_camellia_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
DECLSPEC int verify_header_camellia_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
{ {
u32 ks_camellia[68]; u32 ks_camellia[68];
u32 ks_kuznyechik[40]; u32 ks_kuznyechik[40];
@ -218,18 +221,16 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs,
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia); camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia);
kuznyechik_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_kuznyechik, ks_kuznyechik);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -248,10 +249,10 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs,
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia);
kuznyechik_decrypt_xts_next (tmp, tmp, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_next (tmp, tmp, T_kuznyechik, ks_kuznyechik);
@ -267,7 +268,8 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs,
return 1; return 1;
} }
DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) DECLSPEC int verify_header_camellia_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
DECLSPEC int verify_header_camellia_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
{ {
u32 ks_camellia[68]; u32 ks_camellia[68];
u32 ks_serpent[140]; u32 ks_serpent[140];
@ -279,18 +281,16 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia); camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia);
serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -309,10 +309,10 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia);
serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent);
@ -328,7 +328,8 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co
return 1; return 1;
} }
DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, 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 verify_header_kuznyechik_aes (__global const u32 *data_buf, const u32 signature, 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 verify_header_kuznyechik_aes (__global const u32 *data_buf, const u32 signature, 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_kuznyechik[40]; u32 ks_kuznyechik[40];
u32 ks_aes[60]; u32 ks_aes[60];
@ -340,18 +341,16 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik);
aes256_decrypt_xts_first (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); aes256_decrypt_xts_first (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);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -370,10 +369,10 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik);
aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4);
@ -389,7 +388,8 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons
return 1; return 1;
} }
DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) DECLSPEC int verify_header_kuznyechik_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4);
DECLSPEC int verify_header_kuznyechik_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4)
{ {
u32 ks_kuznyechik[40]; u32 ks_kuznyechik[40];
@ -403,18 +403,16 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs,
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik);
twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -433,10 +431,10 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs,
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik);
twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish);
@ -454,7 +452,8 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs,
// 1536 bit // 1536 bit
DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6) DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6);
DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6)
{ {
u32 ks_kuznyechik[40]; u32 ks_kuznyechik[40];
u32 ks_serpent[140]; u32 ks_serpent[140];
@ -468,10 +467,10 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa
u32 data[4]; u32 data[4];
data[0] = esalt_bufs[0].data_buf[0]; data[0] = data_buf[0];
data[1] = esalt_bufs[0].data_buf[1]; data[1] = data_buf[1];
data[2] = esalt_bufs[0].data_buf[2]; data[2] = data_buf[2];
data[3] = esalt_bufs[0].data_buf[3]; data[3] = data_buf[3];
u32 tmp[4]; u32 tmp[4];
@ -479,8 +478,6 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa
serpent256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_serpent, ks_serpent); serpent256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_serpent, ks_serpent);
camellia256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_camellia, ks_camellia); camellia256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_camellia, ks_camellia);
const u32 signature = esalt_bufs[0].signature;
if (tmp[0] != signature) return 0; if (tmp[0] != signature) return 0;
const u32 crc32_save = swap32_S (~tmp[2]); const u32 crc32_save = swap32_S (~tmp[2]);
@ -500,10 +497,10 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa
for (int i = 64 - 16; i < 128 - 16; i += 4) for (int i = 64 - 16; i < 128 - 16; i += 4)
{ {
data[0] = esalt_bufs[0].data_buf[i + 0]; data[0] = data_buf[i + 0];
data[1] = esalt_bufs[0].data_buf[i + 1]; data[1] = data_buf[i + 1];
data[2] = esalt_bufs[0].data_buf[i + 2]; data[2] = data_buf[i + 2];
data[3] = esalt_bufs[0].data_buf[i + 3]; data[3] = data_buf[i + 3];
kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik);
serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent);

View File

@ -16,6 +16,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct phpass_tmp
{
u32 digest_buf[4];
} phpass_tmp_t;
__kernel void m00400_init (KERN_ATTR_TMPS (phpass_tmp_t)) __kernel void m00400_init (KERN_ATTR_TMPS (phpass_tmp_t))
{ {
/** /**

View File

@ -16,6 +16,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct phpass_tmp
{
u32 digest_buf[4];
} phpass_tmp_t;
__kernel void m00400_init (KERN_ATTR_TMPS (phpass_tmp_t)) __kernel void m00400_init (KERN_ATTR_TMPS (phpass_tmp_t))
{ {
/** /**

View File

@ -15,6 +15,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct md5crypt_tmp
{
u32 digest_buf[4];
} md5crypt_tmp_t;
#define md5crypt_magic 0x00243124u #define md5crypt_magic 0x00243124u
DECLSPEC void memcat16 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append) DECLSPEC void memcat16 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)

View File

@ -15,6 +15,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct md5crypt_tmp
{
u32 digest_buf[4];
} md5crypt_tmp_t;
#define md5crypt_magic 0x00243124u #define md5crypt_magic 0x00243124u
__kernel void m00500_init (KERN_ATTR_TMPS (md5crypt_tmp_t)) __kernel void m00500_init (KERN_ATTR_TMPS (md5crypt_tmp_t))

View File

@ -14,6 +14,16 @@
#include "inc_rp_optimized.cl" #include "inc_rp_optimized.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct blake2
{
u64 h[8];
u64 t[2];
u64 f[2];
u32 buflen;
u32 outlen;
} blake2_t;
#define BLAKE2B_FINAL 1 #define BLAKE2B_FINAL 1
#define BLAKE2B_UPDATE 0 #define BLAKE2B_UPDATE 0

View File

@ -14,6 +14,16 @@
#include "inc_rp_optimized.cl" #include "inc_rp_optimized.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct blake2
{
u64 h[8];
u64 t[2];
u64 f[2];
u32 buflen;
u32 outlen;
} blake2_t;
#define BLAKE2B_FINAL 1 #define BLAKE2B_FINAL 1
#define BLAKE2B_UPDATE 0 #define BLAKE2B_UPDATE 0

View File

@ -12,6 +12,16 @@
#include "inc_common.cl" #include "inc_common.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct blake2
{
u64 h[8];
u64 t[2];
u64 f[2];
u32 buflen;
u32 outlen;
} blake2_t;
#define BLAKE2B_FINAL 1 #define BLAKE2B_FINAL 1
#define BLAKE2B_UPDATE 0 #define BLAKE2B_UPDATE 0

View File

@ -13,6 +13,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct md5crypt_tmp
{
u32 digest_buf[4];
} md5crypt_tmp_t;
#define md5apr1_magic0 0x72706124u #define md5apr1_magic0 0x72706124u
#define md5apr1_magic1 0x00002431u #define md5apr1_magic1 0x00002431u

View File

@ -18,6 +18,12 @@
#define PUTCHAR_LE(a,p,c) ((u8 *)(a))[(p)] = (u8) (c) #define PUTCHAR_LE(a,p,c) ((u8 *)(a))[(p)] = (u8) (c)
#define GETCHAR_LE(a,p) ((u8 *)(a))[(p)] #define GETCHAR_LE(a,p) ((u8 *)(a))[(p)]
typedef struct md5crypt_tmp
{
u32 digest_buf[4];
} md5crypt_tmp_t;
#define md5apr1_magic0 0x72706124u #define md5apr1_magic0 0x72706124u
#define md5apr1_magic1 0x00002431u #define md5apr1_magic1 0x00002431u

View File

@ -16,6 +16,20 @@
#define PUTCHAR64_BE(a,p,c) ((u8 *)(a))[(p) ^ 7] = (u8) (c) #define PUTCHAR64_BE(a,p,c) ((u8 *)(a))[(p) ^ 7] = (u8) (c)
#define GETCHAR64_BE(a,p) ((u8 *)(a))[(p) ^ 7] #define GETCHAR64_BE(a,p) ((u8 *)(a))[(p) ^ 7]
typedef struct sha512crypt_tmp
{
u64 l_alt_result[8];
u64 l_p_bytes[2];
u64 l_s_bytes[2];
// pure version
u32 alt_result[16];
u32 p_bytes[64];
u32 s_bytes[64];
} sha512crypt_tmp_t;
typedef struct typedef struct
{ {
u64 state[8]; u64 state[8];

View File

@ -13,6 +13,20 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct sha512crypt_tmp
{
u64 l_alt_result[8];
u64 l_p_bytes[2];
u64 l_s_bytes[2];
// pure version
u32 alt_result[16];
u32 p_bytes[64];
u32 s_bytes[64];
} sha512crypt_tmp_t;
__kernel void m01800_init (KERN_ATTR_TMPS (sha512crypt_tmp_t)) __kernel void m01800_init (KERN_ATTR_TMPS (sha512crypt_tmp_t))
{ {
/** /**

View File

@ -17,6 +17,16 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct dcc2_tmp
{
u32 ipad[5];
u32 opad[5];
u32 dgst[5];
u32 out[4];
} dcc2_tmp_t;
DECLSPEC void hmac_sha1_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) DECLSPEC void hmac_sha1_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{ {
digest[0] = ipad[0]; digest[0] = ipad[0];

View File

@ -19,6 +19,39 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct wpa_eapol
{
u32 pke[32];
u32 eapol[64 + 16];
u16 eapol_len;
u8 message_pair;
int message_pair_chgd;
u8 keyver;
u8 orig_mac_ap[6];
u8 orig_mac_sta[6];
u8 orig_nonce_ap[32];
u8 orig_nonce_sta[32];
u8 essid_len;
u8 essid[32];
u32 keymic[4];
u32 hash[4];
int nonce_compare;
int nonce_error_corrections;
int detected_le;
int detected_be;
} wpa_eapol_t;
typedef struct wpa_pbkdf2_tmp
{
u32 ipad[5];
u32 opad[5];
u32 dgst[10];
u32 out[10];
} wpa_pbkdf2_tmp_t;
DECLSPEC void make_kn (u32 *k) DECLSPEC void make_kn (u32 *k)
{ {
u32 kl[4]; u32 kl[4];
@ -431,7 +464,7 @@ __kernel void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -551,7 +584,7 @@ __kernel void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -742,7 +775,7 @@ __kernel void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -862,7 +895,7 @@ __kernel void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -1136,7 +1169,7 @@ __kernel void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -1287,7 +1320,7 @@ __kernel void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }

View File

@ -19,6 +19,35 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct wpa_pmk_tmp
{
u32 out[8];
} wpa_pmk_tmp_t;
typedef struct wpa_eapol
{
u32 pke[32];
u32 eapol[64 + 16];
u16 eapol_len;
u8 message_pair;
int message_pair_chgd;
u8 keyver;
u8 orig_mac_ap[6];
u8 orig_mac_sta[6];
u8 orig_nonce_ap[32];
u8 orig_nonce_sta[32];
u8 essid_len;
u8 essid[32];
u32 keymic[4];
u32 hash[4];
int nonce_compare;
int nonce_error_corrections;
int detected_le;
int detected_be;
} wpa_eapol_t;
DECLSPEC u8 hex_convert (const u8 c) DECLSPEC u8 hex_convert (const u8 c)
{ {
return (c & 15) + (c >> 6) * 9; return (c & 15) + (c >> 6) * 9;
@ -306,7 +335,7 @@ __kernel void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -426,7 +455,7 @@ __kernel void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -617,7 +646,7 @@ __kernel void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -737,7 +766,7 @@ __kernel void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -1011,7 +1040,7 @@ __kernel void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }
@ -1162,7 +1191,7 @@ __kernel void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t))
{ {
if (atomic_inc (&hashes_shown[digest_cur]) == 0) if (atomic_inc (&hashes_shown[digest_cur]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0);
} }
} }
} }

View File

@ -14,478 +14,7 @@
#include "inc_rp_optimized.h" #include "inc_rp_optimized.h"
#include "inc_rp_optimized.cl" #include "inc_rp_optimized.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_cipher_des.cl"
#define PERM_OP(a,b,tt,n,m) \
{ \
tt = a >> n; \
tt = tt ^ b; \
tt = tt & m; \
b = b ^ tt; \
tt = tt << n; \
a = a ^ tt; \
}
#define HPERM_OP(a,tt,n,m) \
{ \
tt = a << (16 + n); \
tt = tt ^ a; \
tt = tt & m; \
a = a ^ tt; \
tt = tt >> (16 + n); \
a = a ^ tt; \
}
#define IP(l,r,tt) \
{ \
PERM_OP (r, l, tt, 4, 0x0f0f0f0f); \
PERM_OP (l, r, tt, 16, 0x0000ffff); \
PERM_OP (r, l, tt, 2, 0x33333333); \
PERM_OP (l, r, tt, 8, 0x00ff00ff); \
PERM_OP (r, l, tt, 1, 0x55555555); \
}
#define FP(l,r,tt) \
{ \
PERM_OP (l, r, tt, 1, 0x55555555); \
PERM_OP (r, l, tt, 8, 0x00ff00ff); \
PERM_OP (l, r, tt, 2, 0x33333333); \
PERM_OP (r, l, tt, 16, 0x0000ffff); \
PERM_OP (l, r, tt, 4, 0x0f0f0f0f); \
}
__constant u32a c_SPtrans[8][64] =
{
{
0x02080800, 0x00080000, 0x02000002, 0x02080802,
0x02000000, 0x00080802, 0x00080002, 0x02000002,
0x00080802, 0x02080800, 0x02080000, 0x00000802,
0x02000802, 0x02000000, 0x00000000, 0x00080002,
0x00080000, 0x00000002, 0x02000800, 0x00080800,
0x02080802, 0x02080000, 0x00000802, 0x02000800,
0x00000002, 0x00000800, 0x00080800, 0x02080002,
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
}
};
__constant u32a c_skb[8][64] =
{
{
0x00000000, 0x00000010, 0x20000000, 0x20000010,
0x00010000, 0x00010010, 0x20010000, 0x20010010,
0x00000800, 0x00000810, 0x20000800, 0x20000810,
0x00010800, 0x00010810, 0x20010800, 0x20010810,
0x00000020, 0x00000030, 0x20000020, 0x20000030,
0x00010020, 0x00010030, 0x20010020, 0x20010030,
0x00000820, 0x00000830, 0x20000820, 0x20000830,
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
#if VECT_SIZE == 1
#define BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, __local u32 (*s_SPtrans)[64])
{
u32x tt;
u32x r = data[0];
u32x l = data[1];
IP (r, l, tt);
r = rotl32 (r, 3u);
l = rotl32 (l, 3u);
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i += 2)
{
u32x u;
u32x t;
u = Kc[i + 0] ^ r;
t = Kd[i + 0] ^ rotl32 (r, 28u);
l ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i + 1] ^ l;
t = Kd[i + 1] ^ rotl32 (l, 28u);
r ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = rotl32 (l, 29u);
r = rotl32 (r, 29u);
FP (r, l, tt);
iv[0] = l;
iv[1] = r;
}
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, __local u32 (*s_skb)[64])
{
u32x tt;
PERM_OP (d, c, tt, 4, 0x0f0f0f0f);
HPERM_OP (c, tt, 2, 0xcccc0000);
HPERM_OP (d, tt, 2, 0xcccc0000);
PERM_OP (d, c, tt, 1, 0x55555555);
PERM_OP (c, d, tt, 8, 0x00ff00ff);
PERM_OP (d, c, tt, 1, 0x55555555);
d = ((d & 0x000000ff) << 16)
| ((d & 0x0000ff00) << 0)
| ((d & 0x00ff0000) >> 16)
| ((c & 0xf0000000) >> 4);
c = c & 0x0fffffff;
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
{
c = ((c >> 1) | (c << 27));
d = ((d >> 1) | (d << 27));
}
else
{
c = ((c >> 2) | (c << 26));
d = ((d >> 2) | (d << 26));
}
c = c & 0x0fffffff;
d = d & 0x0fffffff;
const u32x c00 = (c >> 0) & 0x0000003f;
const u32x c06 = (c >> 6) & 0x00383003;
const u32x c07 = (c >> 7) & 0x0000003c;
const u32x c13 = (c >> 13) & 0x0000060f;
const u32x c20 = (c >> 20) & 0x00000001;
u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb)
| BOX (((c06 >> 0) & 0xff)
|((c07 >> 0) & 0xff), 1, s_skb)
| BOX (((c13 >> 0) & 0xff)
|((c06 >> 8) & 0xff), 2, s_skb)
| BOX (((c20 >> 0) & 0xff)
|((c13 >> 8) & 0xff)
|((c06 >> 16) & 0xff), 3, s_skb);
const u32x d00 = (d >> 0) & 0x00003c3f;
const u32x d07 = (d >> 7) & 0x00003f03;
const u32x d21 = (d >> 21) & 0x0000000f;
const u32x d22 = (d >> 22) & 0x00000030;
u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb)
| BOX (((d07 >> 0) & 0xff)
|((d00 >> 8) & 0xff), 5, s_skb)
| BOX (((d07 >> 8) & 0xff), 6, s_skb)
| BOX (((d21 >> 0) & 0xff)
|((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
Kc[i] = rotl32 (Kc[i], 2u);
Kd[i] = rotl32 (Kd[i], 2u);
}
}
__kernel void m03100_m04 (KERN_ATTR_RULES ()) __kernel void m03100_m04 (KERN_ATTR_RULES ())
{ {
@ -498,9 +27,11 @@ __kernel void m03100_m04 (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -527,6 +58,13 @@ __kernel void m03100_m04 (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -721,9 +259,11 @@ __kernel void m03100_s04 (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -750,6 +290,13 @@ __kernel void m03100_s04 (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -12,478 +12,7 @@
#include "inc_types.cl" #include "inc_types.cl"
#include "inc_common.cl" #include "inc_common.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_cipher_des.cl"
#define PERM_OP(a,b,tt,n,m) \
{ \
tt = a >> n; \
tt = tt ^ b; \
tt = tt & m; \
b = b ^ tt; \
tt = tt << n; \
a = a ^ tt; \
}
#define HPERM_OP(a,tt,n,m) \
{ \
tt = a << (16 + n); \
tt = tt ^ a; \
tt = tt & m; \
a = a ^ tt; \
tt = tt >> (16 + n); \
a = a ^ tt; \
}
#define IP(l,r,tt) \
{ \
PERM_OP (r, l, tt, 4, 0x0f0f0f0f); \
PERM_OP (l, r, tt, 16, 0x0000ffff); \
PERM_OP (r, l, tt, 2, 0x33333333); \
PERM_OP (l, r, tt, 8, 0x00ff00ff); \
PERM_OP (r, l, tt, 1, 0x55555555); \
}
#define FP(l,r,tt) \
{ \
PERM_OP (l, r, tt, 1, 0x55555555); \
PERM_OP (r, l, tt, 8, 0x00ff00ff); \
PERM_OP (l, r, tt, 2, 0x33333333); \
PERM_OP (r, l, tt, 16, 0x0000ffff); \
PERM_OP (l, r, tt, 4, 0x0f0f0f0f); \
}
__constant u32a c_SPtrans[8][64] =
{
{
0x02080800, 0x00080000, 0x02000002, 0x02080802,
0x02000000, 0x00080802, 0x00080002, 0x02000002,
0x00080802, 0x02080800, 0x02080000, 0x00000802,
0x02000802, 0x02000000, 0x00000000, 0x00080002,
0x00080000, 0x00000002, 0x02000800, 0x00080800,
0x02080802, 0x02080000, 0x00000802, 0x02000800,
0x00000002, 0x00000800, 0x00080800, 0x02080002,
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
}
};
__constant u32a c_skb[8][64] =
{
{
0x00000000, 0x00000010, 0x20000000, 0x20000010,
0x00010000, 0x00010010, 0x20010000, 0x20010010,
0x00000800, 0x00000810, 0x20000800, 0x20000810,
0x00010800, 0x00010810, 0x20010800, 0x20010810,
0x00000020, 0x00000030, 0x20000020, 0x20000030,
0x00010020, 0x00010030, 0x20010020, 0x20010030,
0x00000820, 0x00000830, 0x20000820, 0x20000830,
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
#if VECT_SIZE == 1
#define BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, __local u32 (*s_SPtrans)[64])
{
u32x tt;
u32x r = data[0];
u32x l = data[1];
IP (r, l, tt);
r = rotl32 (r, 3u);
l = rotl32 (l, 3u);
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i += 2)
{
u32x u;
u32x t;
u = Kc[i + 0] ^ r;
t = Kd[i + 0] ^ rotl32 (r, 28u);
l ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i + 1] ^ l;
t = Kd[i + 1] ^ rotl32 (l, 28u);
r ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = rotl32 (l, 29u);
r = rotl32 (r, 29u);
FP (r, l, tt);
iv[0] = l;
iv[1] = r;
}
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, __local u32 (*s_skb)[64])
{
u32x tt;
PERM_OP (d, c, tt, 4, 0x0f0f0f0f);
HPERM_OP (c, tt, 2, 0xcccc0000);
HPERM_OP (d, tt, 2, 0xcccc0000);
PERM_OP (d, c, tt, 1, 0x55555555);
PERM_OP (c, d, tt, 8, 0x00ff00ff);
PERM_OP (d, c, tt, 1, 0x55555555);
d = ((d & 0x000000ff) << 16)
| ((d & 0x0000ff00) << 0)
| ((d & 0x00ff0000) >> 16)
| ((c & 0xf0000000) >> 4);
c = c & 0x0fffffff;
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
{
c = ((c >> 1) | (c << 27));
d = ((d >> 1) | (d << 27));
}
else
{
c = ((c >> 2) | (c << 26));
d = ((d >> 2) | (d << 26));
}
c = c & 0x0fffffff;
d = d & 0x0fffffff;
const u32x c00 = (c >> 0) & 0x0000003f;
const u32x c06 = (c >> 6) & 0x00383003;
const u32x c07 = (c >> 7) & 0x0000003c;
const u32x c13 = (c >> 13) & 0x0000060f;
const u32x c20 = (c >> 20) & 0x00000001;
u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb)
| BOX (((c06 >> 0) & 0xff)
|((c07 >> 0) & 0xff), 1, s_skb)
| BOX (((c13 >> 0) & 0xff)
|((c06 >> 8) & 0xff), 2, s_skb)
| BOX (((c20 >> 0) & 0xff)
|((c13 >> 8) & 0xff)
|((c06 >> 16) & 0xff), 3, s_skb);
const u32x d00 = (d >> 0) & 0x00003c3f;
const u32x d07 = (d >> 7) & 0x00003f03;
const u32x d21 = (d >> 21) & 0x0000000f;
const u32x d22 = (d >> 22) & 0x00000030;
u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb)
| BOX (((d07 >> 0) & 0xff)
|((d00 >> 8) & 0xff), 5, s_skb)
| BOX (((d07 >> 8) & 0xff), 6, s_skb)
| BOX (((d21 >> 0) & 0xff)
|((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
Kc[i] = rotl32 (Kc[i], 2u);
Kd[i] = rotl32 (Kd[i], 2u);
}
}
__kernel void m03100_m04 (KERN_ATTR_BASIC ()) __kernel void m03100_m04 (KERN_ATTR_BASIC ())
{ {
@ -496,9 +25,11 @@ __kernel void m03100_m04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -525,6 +56,13 @@ __kernel void m03100_m04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -779,9 +317,11 @@ __kernel void m03100_s04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -808,6 +348,13 @@ __kernel void m03100_s04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -11,480 +11,9 @@
#include "inc_types.cl" #include "inc_types.cl"
#include "inc_common.cl" #include "inc_common.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_cipher_des.cl"
#define PERM_OP(a,b,tt,n,m) \ DECLSPEC void m03100m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{ \
tt = a >> n; \
tt = tt ^ b; \
tt = tt & m; \
b = b ^ tt; \
tt = tt << n; \
a = a ^ tt; \
}
#define HPERM_OP(a,tt,n,m) \
{ \
tt = a << (16 + n); \
tt = tt ^ a; \
tt = tt & m; \
a = a ^ tt; \
tt = tt >> (16 + n); \
a = a ^ tt; \
}
#define IP(l,r,tt) \
{ \
PERM_OP (r, l, tt, 4, 0x0f0f0f0f); \
PERM_OP (l, r, tt, 16, 0x0000ffff); \
PERM_OP (r, l, tt, 2, 0x33333333); \
PERM_OP (l, r, tt, 8, 0x00ff00ff); \
PERM_OP (r, l, tt, 1, 0x55555555); \
}
#define FP(l,r,tt) \
{ \
PERM_OP (l, r, tt, 1, 0x55555555); \
PERM_OP (r, l, tt, 8, 0x00ff00ff); \
PERM_OP (l, r, tt, 2, 0x33333333); \
PERM_OP (r, l, tt, 16, 0x0000ffff); \
PERM_OP (l, r, tt, 4, 0x0f0f0f0f); \
}
__constant u32a c_SPtrans[8][64] =
{
{
0x02080800, 0x00080000, 0x02000002, 0x02080802,
0x02000000, 0x00080802, 0x00080002, 0x02000002,
0x00080802, 0x02080800, 0x02080000, 0x00000802,
0x02000802, 0x02000000, 0x00000000, 0x00080002,
0x00080000, 0x00000002, 0x02000800, 0x00080800,
0x02080802, 0x02080000, 0x00000802, 0x02000800,
0x00000002, 0x00000800, 0x00080800, 0x02080002,
0x00000800, 0x02000802, 0x02080002, 0x00000000,
0x00000000, 0x02080802, 0x02000800, 0x00080002,
0x02080800, 0x00080000, 0x00000802, 0x02000800,
0x02080002, 0x00000800, 0x00080800, 0x02000002,
0x00080802, 0x00000002, 0x02000002, 0x02080000,
0x02080802, 0x00080800, 0x02080000, 0x02000802,
0x02000000, 0x00000802, 0x00080002, 0x00000000,
0x00080000, 0x02000000, 0x02000802, 0x02080800,
0x00000002, 0x02080002, 0x00000800, 0x00080802,
},
{
0x40108010, 0x00000000, 0x00108000, 0x40100000,
0x40000010, 0x00008010, 0x40008000, 0x00108000,
0x00008000, 0x40100010, 0x00000010, 0x40008000,
0x00100010, 0x40108000, 0x40100000, 0x00000010,
0x00100000, 0x40008010, 0x40100010, 0x00008000,
0x00108010, 0x40000000, 0x00000000, 0x00100010,
0x40008010, 0x00108010, 0x40108000, 0x40000010,
0x40000000, 0x00100000, 0x00008010, 0x40108010,
0x00100010, 0x40108000, 0x40008000, 0x00108010,
0x40108010, 0x00100010, 0x40000010, 0x00000000,
0x40000000, 0x00008010, 0x00100000, 0x40100010,
0x00008000, 0x40000000, 0x00108010, 0x40008010,
0x40108000, 0x00008000, 0x00000000, 0x40000010,
0x00000010, 0x40108010, 0x00108000, 0x40100000,
0x40100010, 0x00100000, 0x00008010, 0x40008000,
0x40008010, 0x00000010, 0x40100000, 0x00108000,
},
{
0x04000001, 0x04040100, 0x00000100, 0x04000101,
0x00040001, 0x04000000, 0x04000101, 0x00040100,
0x04000100, 0x00040000, 0x04040000, 0x00000001,
0x04040101, 0x00000101, 0x00000001, 0x04040001,
0x00000000, 0x00040001, 0x04040100, 0x00000100,
0x00000101, 0x04040101, 0x00040000, 0x04000001,
0x04040001, 0x04000100, 0x00040101, 0x04040000,
0x00040100, 0x00000000, 0x04000000, 0x00040101,
0x04040100, 0x00000100, 0x00000001, 0x00040000,
0x00000101, 0x00040001, 0x04040000, 0x04000101,
0x00000000, 0x04040100, 0x00040100, 0x04040001,
0x00040001, 0x04000000, 0x04040101, 0x00000001,
0x00040101, 0x04000001, 0x04000000, 0x04040101,
0x00040000, 0x04000100, 0x04000101, 0x00040100,
0x04000100, 0x00000000, 0x04040001, 0x00000101,
0x04000001, 0x00040101, 0x00000100, 0x04040000,
},
{
0x00401008, 0x10001000, 0x00000008, 0x10401008,
0x00000000, 0x10400000, 0x10001008, 0x00400008,
0x10401000, 0x10000008, 0x10000000, 0x00001008,
0x10000008, 0x00401008, 0x00400000, 0x10000000,
0x10400008, 0x00401000, 0x00001000, 0x00000008,
0x00401000, 0x10001008, 0x10400000, 0x00001000,
0x00001008, 0x00000000, 0x00400008, 0x10401000,
0x10001000, 0x10400008, 0x10401008, 0x00400000,
0x10400008, 0x00001008, 0x00400000, 0x10000008,
0x00401000, 0x10001000, 0x00000008, 0x10400000,
0x10001008, 0x00000000, 0x00001000, 0x00400008,
0x00000000, 0x10400008, 0x10401000, 0x00001000,
0x10000000, 0x10401008, 0x00401008, 0x00400000,
0x10401008, 0x00000008, 0x10001000, 0x00401008,
0x00400008, 0x00401000, 0x10400000, 0x10001008,
0x00001008, 0x10000000, 0x10000008, 0x10401000,
},
{
0x08000000, 0x00010000, 0x00000400, 0x08010420,
0x08010020, 0x08000400, 0x00010420, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x00010400,
0x08000420, 0x08010020, 0x08010400, 0x00000000,
0x00010400, 0x08000000, 0x00010020, 0x00000420,
0x08000400, 0x00010420, 0x00000000, 0x08000020,
0x00000020, 0x08000420, 0x08010420, 0x00010020,
0x08010000, 0x00000400, 0x00000420, 0x08010400,
0x08010400, 0x08000420, 0x00010020, 0x08010000,
0x00010000, 0x00000020, 0x08000020, 0x08000400,
0x08000000, 0x00010400, 0x08010420, 0x00000000,
0x00010420, 0x08000000, 0x00000400, 0x00010020,
0x08000420, 0x00000400, 0x00000000, 0x08010420,
0x08010020, 0x08010400, 0x00000420, 0x00010000,
0x00010400, 0x08010020, 0x08000400, 0x00000420,
0x00000020, 0x00010420, 0x08010000, 0x08000020,
},
{
0x80000040, 0x00200040, 0x00000000, 0x80202000,
0x00200040, 0x00002000, 0x80002040, 0x00200000,
0x00002040, 0x80202040, 0x00202000, 0x80000000,
0x80002000, 0x80000040, 0x80200000, 0x00202040,
0x00200000, 0x80002040, 0x80200040, 0x00000000,
0x00002000, 0x00000040, 0x80202000, 0x80200040,
0x80202040, 0x80200000, 0x80000000, 0x00002040,
0x00000040, 0x00202000, 0x00202040, 0x80002000,
0x00002040, 0x80000000, 0x80002000, 0x00202040,
0x80202000, 0x00200040, 0x00000000, 0x80002000,
0x80000000, 0x00002000, 0x80200040, 0x00200000,
0x00200040, 0x80202040, 0x00202000, 0x00000040,
0x80202040, 0x00202000, 0x00200000, 0x80002040,
0x80000040, 0x80200000, 0x00202040, 0x00000000,
0x00002000, 0x80000040, 0x80002040, 0x80202000,
0x80200000, 0x00002040, 0x00000040, 0x80200040,
},
{
0x00004000, 0x00000200, 0x01000200, 0x01000004,
0x01004204, 0x00004004, 0x00004200, 0x00000000,
0x01000000, 0x01000204, 0x00000204, 0x01004000,
0x00000004, 0x01004200, 0x01004000, 0x00000204,
0x01000204, 0x00004000, 0x00004004, 0x01004204,
0x00000000, 0x01000200, 0x01000004, 0x00004200,
0x01004004, 0x00004204, 0x01004200, 0x00000004,
0x00004204, 0x01004004, 0x00000200, 0x01000000,
0x00004204, 0x01004000, 0x01004004, 0x00000204,
0x00004000, 0x00000200, 0x01000000, 0x01004004,
0x01000204, 0x00004204, 0x00004200, 0x00000000,
0x00000200, 0x01000004, 0x00000004, 0x01000200,
0x00000000, 0x01000204, 0x01000200, 0x00004200,
0x00000204, 0x00004000, 0x01004204, 0x01000000,
0x01004200, 0x00000004, 0x00004004, 0x01004204,
0x01000004, 0x01004200, 0x01004000, 0x00004004,
},
{
0x20800080, 0x20820000, 0x00020080, 0x00000000,
0x20020000, 0x00800080, 0x20800000, 0x20820080,
0x00000080, 0x20000000, 0x00820000, 0x00020080,
0x00820080, 0x20020080, 0x20000080, 0x20800000,
0x00020000, 0x00820080, 0x00800080, 0x20020000,
0x20820080, 0x20000080, 0x00000000, 0x00820000,
0x20000000, 0x00800000, 0x20020080, 0x20800080,
0x00800000, 0x00020000, 0x20820000, 0x00000080,
0x00800000, 0x00020000, 0x20000080, 0x20820080,
0x00020080, 0x20000000, 0x00000000, 0x00820000,
0x20800080, 0x20020080, 0x20020000, 0x00800080,
0x20820000, 0x00000080, 0x00800080, 0x20020000,
0x20820080, 0x00800000, 0x20800000, 0x20000080,
0x00820000, 0x00020080, 0x20020080, 0x20800000,
0x00000080, 0x20820000, 0x00820080, 0x00000000,
0x20000000, 0x20800080, 0x00020000, 0x00820080,
}
};
__constant u32a c_skb[8][64] =
{
{
0x00000000, 0x00000010, 0x20000000, 0x20000010,
0x00010000, 0x00010010, 0x20010000, 0x20010010,
0x00000800, 0x00000810, 0x20000800, 0x20000810,
0x00010800, 0x00010810, 0x20010800, 0x20010810,
0x00000020, 0x00000030, 0x20000020, 0x20000030,
0x00010020, 0x00010030, 0x20010020, 0x20010030,
0x00000820, 0x00000830, 0x20000820, 0x20000830,
0x00010820, 0x00010830, 0x20010820, 0x20010830,
0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00090000, 0x00090010, 0x20090000, 0x20090010,
0x00080800, 0x00080810, 0x20080800, 0x20080810,
0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030,
0x00090020, 0x00090030, 0x20090020, 0x20090030,
0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,
},
{
0x00000000, 0x02000000, 0x00002000, 0x02002000,
0x00200000, 0x02200000, 0x00202000, 0x02202000,
0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00200004, 0x02200004, 0x00202004, 0x02202004,
0x00000400, 0x02000400, 0x00002400, 0x02002400,
0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00000404, 0x02000404, 0x00002404, 0x02002404,
0x00200404, 0x02200404, 0x00202404, 0x02202404,
0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x10200000, 0x12200000, 0x10202000, 0x12202000,
0x10000004, 0x12000004, 0x10002004, 0x12002004,
0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400,
0x10200400, 0x12200400, 0x10202400, 0x12202400,
0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,
},
{
0x00000000, 0x00000001, 0x00040000, 0x00040001,
0x01000000, 0x01000001, 0x01040000, 0x01040001,
0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x01000002, 0x01000003, 0x01040002, 0x01040003,
0x00000200, 0x00000201, 0x00040200, 0x00040201,
0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000202, 0x00000203, 0x00040202, 0x00040203,
0x01000202, 0x01000203, 0x01040202, 0x01040203,
0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x09000000, 0x09000001, 0x09040000, 0x09040001,
0x08000002, 0x08000003, 0x08040002, 0x08040003,
0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201,
0x09000200, 0x09000201, 0x09040200, 0x09040201,
0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,
},
{
0x00000000, 0x00100000, 0x00000100, 0x00100100,
0x00000008, 0x00100008, 0x00000108, 0x00100108,
0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x00001008, 0x00101008, 0x00001108, 0x00101108,
0x04000000, 0x04100000, 0x04000100, 0x04100100,
0x04000008, 0x04100008, 0x04000108, 0x04100108,
0x04001000, 0x04101000, 0x04001100, 0x04101100,
0x04001008, 0x04101008, 0x04001108, 0x04101108,
0x00020000, 0x00120000, 0x00020100, 0x00120100,
0x00020008, 0x00120008, 0x00020108, 0x00120108,
0x00021000, 0x00121000, 0x00021100, 0x00121100,
0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100,
0x04020008, 0x04120008, 0x04020108, 0x04120108,
0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,
},
{
0x00000000, 0x10000000, 0x00010000, 0x10010000,
0x00000004, 0x10000004, 0x00010004, 0x10010004,
0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x20000004, 0x30000004, 0x20010004, 0x30010004,
0x00100000, 0x10100000, 0x00110000, 0x10110000,
0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x20100000, 0x30100000, 0x20110000, 0x30110000,
0x20100004, 0x30100004, 0x20110004, 0x30110004,
0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x00001004, 0x10001004, 0x00011004, 0x10011004,
0x20001000, 0x30001000, 0x20011000, 0x30011000,
0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000,
0x00101004, 0x10101004, 0x00111004, 0x10111004,
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,
},
{
0x00000000, 0x08000000, 0x00000008, 0x08000008,
0x00000400, 0x08000400, 0x00000408, 0x08000408,
0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00020400, 0x08020400, 0x00020408, 0x08020408,
0x00000001, 0x08000001, 0x00000009, 0x08000009,
0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00020001, 0x08020001, 0x00020009, 0x08020009,
0x00020401, 0x08020401, 0x00020409, 0x08020409,
0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
},
{
0x00000000, 0x00000100, 0x00080000, 0x00080100,
0x01000000, 0x01000100, 0x01080000, 0x01080100,
0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x01000010, 0x01000110, 0x01080010, 0x01080110,
0x00200000, 0x00200100, 0x00280000, 0x00280100,
0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x00200010, 0x00200110, 0x00280010, 0x00280110,
0x01200010, 0x01200110, 0x01280010, 0x01280110,
0x00000200, 0x00000300, 0x00080200, 0x00080300,
0x01000200, 0x01000300, 0x01080200, 0x01080300,
0x00000210, 0x00000310, 0x00080210, 0x00080310,
0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300,
0x01200200, 0x01200300, 0x01280200, 0x01280300,
0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,
},
{
0x00000000, 0x04000000, 0x00040000, 0x04040000,
0x00000002, 0x04000002, 0x00040002, 0x04040002,
0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00002002, 0x04002002, 0x00042002, 0x04042002,
0x00000020, 0x04000020, 0x00040020, 0x04040020,
0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x00002020, 0x04002020, 0x00042020, 0x04042020,
0x00002022, 0x04002022, 0x00042022, 0x04042022,
0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00000802, 0x04000802, 0x00040802, 0x04040802,
0x00002800, 0x04002800, 0x00042800, 0x04042800,
0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820,
0x00000822, 0x04000822, 0x00040822, 0x04040822,
0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822
}
};
#if VECT_SIZE == 1
#define BOX(i,n,S) (S)[(n)][(i)]
#elif VECT_SIZE == 2
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
#elif VECT_SIZE == 4
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
#elif VECT_SIZE == 8
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
#elif VECT_SIZE == 16
#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
#endif
DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, __local u32 (*s_SPtrans)[64])
{
u32x tt;
u32x r = data[0];
u32x l = data[1];
IP (r, l, tt);
r = rotl32 (r, 3u);
l = rotl32 (l, 3u);
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i += 2)
{
u32x u;
u32x t;
u = Kc[i + 0] ^ r;
t = Kd[i + 0] ^ rotl32 (r, 28u);
l ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
u = Kc[i + 1] ^ l;
t = Kd[i + 1] ^ rotl32 (l, 28u);
r ^= BOX (((u >> 2) & 0x3f), 0, s_SPtrans)
| BOX (((u >> 10) & 0x3f), 2, s_SPtrans)
| BOX (((u >> 18) & 0x3f), 4, s_SPtrans)
| BOX (((u >> 26) & 0x3f), 6, s_SPtrans)
| BOX (((t >> 2) & 0x3f), 1, s_SPtrans)
| BOX (((t >> 10) & 0x3f), 3, s_SPtrans)
| BOX (((t >> 18) & 0x3f), 5, s_SPtrans)
| BOX (((t >> 26) & 0x3f), 7, s_SPtrans);
}
l = rotl32 (l, 29u);
r = rotl32 (r, 29u);
FP (r, l, tt);
iv[0] = l;
iv[1] = r;
}
DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, __local u32 (*s_skb)[64])
{
u32x tt;
PERM_OP (d, c, tt, 4, 0x0f0f0f0f);
HPERM_OP (c, tt, 2, 0xcccc0000);
HPERM_OP (d, tt, 2, 0xcccc0000);
PERM_OP (d, c, tt, 1, 0x55555555);
PERM_OP (c, d, tt, 8, 0x00ff00ff);
PERM_OP (d, c, tt, 1, 0x55555555);
d = ((d & 0x000000ff) << 16)
| ((d & 0x0000ff00) << 0)
| ((d & 0x00ff0000) >> 16)
| ((c & 0xf0000000) >> 4);
c = c & 0x0fffffff;
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
{
c = ((c >> 1) | (c << 27));
d = ((d >> 1) | (d << 27));
}
else
{
c = ((c >> 2) | (c << 26));
d = ((d >> 2) | (d << 26));
}
c = c & 0x0fffffff;
d = d & 0x0fffffff;
const u32x c00 = (c >> 0) & 0x0000003f;
const u32x c06 = (c >> 6) & 0x00383003;
const u32x c07 = (c >> 7) & 0x0000003c;
const u32x c13 = (c >> 13) & 0x0000060f;
const u32x c20 = (c >> 20) & 0x00000001;
u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb)
| BOX (((c06 >> 0) & 0xff)
|((c07 >> 0) & 0xff), 1, s_skb)
| BOX (((c13 >> 0) & 0xff)
|((c06 >> 8) & 0xff), 2, s_skb)
| BOX (((c20 >> 0) & 0xff)
|((c13 >> 8) & 0xff)
|((c06 >> 16) & 0xff), 3, s_skb);
const u32x d00 = (d >> 0) & 0x00003c3f;
const u32x d07 = (d >> 7) & 0x00003f03;
const u32x d21 = (d >> 21) & 0x0000000f;
const u32x d22 = (d >> 22) & 0x00000030;
u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb)
| BOX (((d07 >> 0) & 0xff)
|((d00 >> 8) & 0xff), 5, s_skb)
| BOX (((d07 >> 8) & 0xff), 6, s_skb)
| BOX (((d21 >> 0) & 0xff)
|((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
Kc[i] = rotl32 (Kc[i], 2u);
Kd[i] = rotl32 (Kd[i], 2u);
}
}
DECLSPEC void m03100m (__local u32 (*s_SPtrans)[64], __local u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{ {
/** /**
* modifier * modifier
@ -665,7 +194,7 @@ DECLSPEC void m03100m (__local u32 (*s_SPtrans)[64], __local u32 (*s_skb)[64], u
} }
} }
DECLSPEC void m03100s (__local u32 (*s_SPtrans)[64], __local u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) DECLSPEC void m03100s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{ {
/** /**
* modifier * modifier
@ -894,9 +423,11 @@ __kernel void m03100_m04 (KERN_ATTR_VECTOR ())
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -923,6 +454,13 @@ __kernel void m03100_m04 (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -968,9 +506,11 @@ __kernel void m03100_m08 (KERN_ATTR_VECTOR ())
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -997,6 +537,13 @@ __kernel void m03100_m08 (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -1046,9 +593,11 @@ __kernel void m03100_s04 (KERN_ATTR_VECTOR ())
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -1075,6 +624,13 @@ __kernel void m03100_s04 (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -1120,9 +676,11 @@ __kernel void m03100_s08 (KERN_ATTR_VECTOR ())
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
/** /**
* sbox, kbox * des shared
*/ */
#ifdef REAL_SHM
__local u32 s_SPtrans[8][64]; __local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64]; __local u32 s_skb[8][64];
@ -1149,6 +707,13 @@ __kernel void m03100_s08 (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_SPtrans)[64] = c_SPtrans;
__constant u32a (*s_skb)[64] = c_skb;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -12,6 +12,19 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct bcrypt_tmp
{
u32 E[18];
u32 P[18];
u32 S0[256];
u32 S1[256];
u32 S2[256];
u32 S3[256];
} bcrypt_tmp_t;
// http://www.schneier.com/code/constants.txt // http://www.schneier.com/code/constants.txt
__constant u32a c_sbox0[256] = __constant u32a c_sbox0[256] =
@ -286,16 +299,21 @@ __constant u32a c_sbox3[256] =
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
}; };
#define BF_ROUND(L,R,N) \ #define BF_ROUND(L,R,N) \
{ \ { \
u32 tmp; \ u32 tmp; \
\ \
tmp = S0[hc_bfe_S ((L), 24, 8)]; \ const u32 r0 = hc_bfe_S ((L), 24, 8); \
tmp += S1[hc_bfe_S ((L), 16, 8)]; \ const u32 r1 = hc_bfe_S ((L), 16, 8); \
tmp ^= S2[hc_bfe_S ((L), 8, 8)]; \ const u32 r2 = hc_bfe_S ((L), 8, 8); \
tmp += S3[hc_bfe_S ((L), 0, 8)]; \ const u32 r3 = hc_bfe_S ((L), 0, 8); \
\ \
(R) ^= tmp ^ P[(N)]; \ tmp = S0[r0]; \
tmp += S1[r1]; \
tmp ^= S2[r2]; \
tmp += S3[r3]; \
\
(R) ^= tmp ^ P[(N)]; \
} }
#define BF_ENCRYPT(L,R) \ #define BF_ENCRYPT(L,R) \
@ -348,7 +366,7 @@ DECLSPEC void expand_key (u32 *E, u32 *W, const int len)
} }
} }
__kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_init (KERN_ATTR_TMPS (bcrypt_tmp_t)) __kernel void __attribute__((reqd_work_group_size(FIXED_LOCAL_SIZE, 1, 1))) m03200_init (KERN_ATTR_TMPS (bcrypt_tmp_t))
{ {
/** /**
* base * base
@ -425,10 +443,10 @@ __kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_init (KERN_A
* do the key setup * do the key setup
*/ */
__local u32 S0_all[8][256]; __local u32 S0_all[FIXED_LOCAL_SIZE][256];
__local u32 S1_all[8][256]; __local u32 S1_all[FIXED_LOCAL_SIZE][256];
__local u32 S2_all[8][256]; __local u32 S2_all[FIXED_LOCAL_SIZE][256];
__local u32 S3_all[8][256]; __local u32 S3_all[FIXED_LOCAL_SIZE][256];
__local u32 *S0 = S0_all[lid]; __local u32 *S0 = S0_all[lid];
__local u32 *S1 = S1_all[lid]; __local u32 *S1 = S1_all[lid];
@ -567,7 +585,7 @@ __kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_init (KERN_A
} }
} }
__kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_loop (KERN_ATTR_TMPS (bcrypt_tmp_t)) __kernel void __attribute__((reqd_work_group_size(FIXED_LOCAL_SIZE, 1, 1))) m03200_loop (KERN_ATTR_TMPS (bcrypt_tmp_t))
{ {
/** /**
* base * base
@ -594,10 +612,10 @@ __kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_loop (KERN_A
P[i] = tmps[gid].P[i]; P[i] = tmps[gid].P[i];
} }
__local u32 S0_all[8][256]; __local u32 S0_all[FIXED_LOCAL_SIZE][256];
__local u32 S1_all[8][256]; __local u32 S1_all[FIXED_LOCAL_SIZE][256];
__local u32 S2_all[8][256]; __local u32 S2_all[FIXED_LOCAL_SIZE][256];
__local u32 S3_all[8][256]; __local u32 S3_all[FIXED_LOCAL_SIZE][256];
__local u32 *S0 = S0_all[lid]; __local u32 *S0 = S0_all[lid];
__local u32 *S1 = S1_all[lid]; __local u32 *S1 = S1_all[lid];
@ -765,7 +783,7 @@ __kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_loop (KERN_A
} }
} }
__kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_comp (KERN_ATTR_TMPS (bcrypt_tmp_t)) __kernel void __attribute__((reqd_work_group_size(FIXED_LOCAL_SIZE, 1, 1))) m03200_comp (KERN_ATTR_TMPS (bcrypt_tmp_t))
{ {
/** /**
* base * base
@ -785,10 +803,10 @@ __kernel void __attribute__((reqd_work_group_size(8, 1, 1))) m03200_comp (KERN_A
P[i] = tmps[gid].P[i]; P[i] = tmps[gid].P[i];
} }
__local u32 S0_all[8][256]; __local u32 S0_all[FIXED_LOCAL_SIZE][256];
__local u32 S1_all[8][256]; __local u32 S1_all[FIXED_LOCAL_SIZE][256];
__local u32 S2_all[8][256]; __local u32 S2_all[FIXED_LOCAL_SIZE][256];
__local u32 S3_all[8][256]; __local u32 S3_all[FIXED_LOCAL_SIZE][256];
__local u32 *S0 = S0_all[lid]; __local u32 *S0 = S0_all[lid];
__local u32 *S1 = S1_all[lid]; __local u32 *S1 = S1_all[lid];

View File

@ -16,6 +16,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct pwsafe3_tmp
{
u32 digest_buf[8];
} pwsafe3_tmp_t;
__kernel void m05200_init (KERN_ATTR_TMPS (pwsafe3_tmp_t)) __kernel void m05200_init (KERN_ATTR_TMPS (pwsafe3_tmp_t))
{ {
/** /**

View File

@ -15,6 +15,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -15,6 +15,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05300_mxx (KERN_ATTR_RULES_ESALT (ikepsk_t)) __kernel void m05300_mxx (KERN_ATTR_RULES_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -13,6 +13,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -13,6 +13,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05300_mxx (KERN_ATTR_ESALT (ikepsk_t)) __kernel void m05300_mxx (KERN_ATTR_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -13,6 +13,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -13,6 +13,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05300_mxx (KERN_ATTR_VECTOR_ESALT (ikepsk_t)) __kernel void m05300_mxx (KERN_ATTR_VECTOR_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -15,6 +15,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -15,6 +15,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05400_mxx (KERN_ATTR_RULES_ESALT (ikepsk_t)) __kernel void m05400_mxx (KERN_ATTR_RULES_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -13,6 +13,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -13,6 +13,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05400_mxx (KERN_ATTR_ESALT (ikepsk_t)) __kernel void m05400_mxx (KERN_ATTR_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -13,6 +13,16 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -13,6 +13,16 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_sha1.cl" #include "inc_hash_sha1.cl"
typedef struct ikepsk
{
u32 nr_buf[16];
u32 nr_len;
u32 msg_buf[128];
u32 msg_len[6];
} ikepsk_t;
__kernel void m05400_mxx (KERN_ATTR_VECTOR_ESALT (ikepsk_t)) __kernel void m05400_mxx (KERN_ATTR_VECTOR_ESALT (ikepsk_t))
{ {
/** /**

View File

@ -14,6 +14,18 @@
#include "inc_rp_optimized.cl" #include "inc_rp_optimized.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -15,6 +15,18 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -12,6 +12,18 @@
#include "inc_common.cl" #include "inc_common.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -13,6 +13,18 @@
#include "inc_scalar.cl" #include "inc_scalar.cl"
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -12,6 +12,18 @@
#include "inc_common.cl" #include "inc_common.cl"
#include "inc_simd.cl" #include "inc_simd.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -13,6 +13,18 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
tt = a >> n; \ tt = a >> n; \

View File

@ -16,6 +16,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -16,6 +16,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
__kernel void m05600_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) __kernel void m05600_mxx (KERN_ATTR_RULES_ESALT (netntlm_t))
{ {
/** /**

View File

@ -14,6 +14,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -14,6 +14,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
__kernel void m05600_mxx (KERN_ATTR_ESALT (netntlm_t)) __kernel void m05600_mxx (KERN_ATTR_ESALT (netntlm_t))
{ {
/** /**

View File

@ -14,6 +14,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{ {
w0[0] = w0[0] ^ 0x36363636; w0[0] = w0[0] ^ 0x36363636;

View File

@ -14,6 +14,18 @@
#include "inc_hash_md4.cl" #include "inc_hash_md4.cl"
#include "inc_hash_md5.cl" #include "inc_hash_md5.cl"
typedef struct netntlm
{
u32 user_len;
u32 domain_len;
u32 srvchall_len;
u32 clichall_len;
u32 userdomain_buf[64];
u32 chall_buf[256];
} netntlm_t;
__kernel void m05600_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) __kernel void m05600_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t))
{ {
/** /**

View File

@ -13,6 +13,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct androidpin_tmp
{
u32 digest_buf[5];
} androidpin_tmp_t;
__constant u32a c_pc_dec[1024] = __constant u32a c_pc_dec[1024] =
{ {
0x00000030, 0x00000030,

View File

@ -13,6 +13,12 @@
#define COMPARE_S "inc_comp_single.cl" #define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl" #define COMPARE_M "inc_comp_multi.cl"
typedef struct androidpin_tmp
{
u32 digest_buf[5];
} androidpin_tmp_t;
__constant u32a c_pc_dec[1024] = __constant u32a c_pc_dec[1024] =
{ {
0x00000030, 0x00000030,

View File

@ -20,7 +20,7 @@ DECLSPEC void ripemd160_transform_transport_vector (const u32x *w, u32x *dgst)
ripemd160_transform_vector (w + 0, w + 4, w + 8, w + 12, dgst); ripemd160_transform_vector (w + 0, w + 4, w + 8, w + 12, dgst);
} }
__kernel void m06000_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) __kernel void m06000_m04 (KERN_ATTR_RULES ())
{ {
/** /**
* modifier * modifier
@ -110,7 +110,7 @@ __kernel void m06000_m16 (KERN_ATTR_RULES ())
{ {
} }
__kernel void m06000_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) __kernel void m06000_s04 (KERN_ATTR_RULES ())
{ {
/** /**
* modifier * modifier

View File

@ -18,7 +18,7 @@ DECLSPEC void ripemd160_transform_transport_vector (const u32x *w, u32x *dgst)
ripemd160_transform_vector (w + 0, w + 4, w + 8, w + 12, dgst); ripemd160_transform_vector (w + 0, w + 4, w + 8, w + 12, dgst);
} }
__kernel void m06000_m04 (KERN_ATTR_ESALT (netntlm_t)) __kernel void m06000_m04 (KERN_ATTR_BASIC ())
{ {
/** /**
* modifier * modifier
@ -166,7 +166,7 @@ __kernel void m06000_m16 (KERN_ATTR_BASIC ())
{ {
} }
__kernel void m06000_s04 (KERN_ATTR_ESALT (netntlm_t)) __kernel void m06000_s04 (KERN_ATTR_BASIC ())
{ {
/** /**
* modifier * modifier

View File

@ -15,7 +15,7 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_whirlpool.cl" #include "inc_hash_whirlpool.cl"
DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl); whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl);
} }
@ -31,9 +31,11 @@ __kernel void m06100_m04 (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -60,6 +62,13 @@ __kernel void m06100_m04 (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -162,9 +171,11 @@ __kernel void m06100_s04 (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -191,6 +202,13 @@ __kernel void m06100_s04 (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -26,9 +26,11 @@ __kernel void m06100_mxx (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -55,6 +57,13 @@ __kernel void m06100_mxx (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -101,9 +110,11 @@ __kernel void m06100_sxx (KERN_ATTR_RULES ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -130,6 +141,13 @@ __kernel void m06100_sxx (KERN_ATTR_RULES ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -13,7 +13,7 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_whirlpool.cl" #include "inc_hash_whirlpool.cl"
DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl); whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl);
} }
@ -29,9 +29,11 @@ __kernel void m06100_m04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -58,6 +60,13 @@ __kernel void m06100_m04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -218,9 +227,11 @@ __kernel void m06100_s04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -247,6 +258,13 @@ __kernel void m06100_s04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -24,9 +24,11 @@ __kernel void m06100_mxx (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -53,6 +55,13 @@ __kernel void m06100_mxx (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -97,9 +106,11 @@ __kernel void m06100_sxx (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -126,6 +137,13 @@ __kernel void m06100_sxx (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -13,12 +13,12 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#include "inc_hash_whirlpool.cl" #include "inc_hash_whirlpool.cl"
DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) DECLSPEC void whirlpool_transform_transport_vector (const u32x *w, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl); whirlpool_transform_vector (w + 0, w + 4, w + 8, w + 12, digest, s_Ch, s_Cl);
} }
DECLSPEC void m06100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC (), __local u32 (*s_Cl)[256], __local u32 (*s_Ch)[256]) DECLSPEC void m06100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC (), SHM_TYPE u32 (*s_Cl)[256], SHM_TYPE u32 (*s_Ch)[256])
{ {
/** /**
* modifier * modifier
@ -87,7 +87,7 @@ DECLSPEC void m06100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
} }
} }
DECLSPEC void m06100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC (), __local u32 (*s_Cl)[256], __local u32 (*s_Ch)[256]) DECLSPEC void m06100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC (), SHM_TYPE u32 (*s_Cl)[256], SHM_TYPE u32 (*s_Ch)[256])
{ {
/** /**
* modifier * modifier
@ -179,9 +179,11 @@ __kernel void m06100_m04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -208,6 +210,13 @@ __kernel void m06100_m04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -262,9 +271,11 @@ __kernel void m06100_m08 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -291,6 +302,13 @@ __kernel void m06100_m08 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -349,9 +367,11 @@ __kernel void m06100_s04 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -378,6 +398,13 @@ __kernel void m06100_s04 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -432,9 +459,11 @@ __kernel void m06100_s08 (KERN_ATTR_BASIC ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -461,6 +490,13 @@ __kernel void m06100_s08 (KERN_ATTR_BASIC ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -24,9 +24,11 @@ __kernel void m06100_mxx (KERN_ATTR_VECTOR ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -53,6 +55,13 @@ __kernel void m06100_mxx (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -110,9 +119,11 @@ __kernel void m06100_sxx (KERN_ATTR_VECTOR ())
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** /**
* shared * Whirlpool shared
*/ */
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -139,6 +150,13 @@ __kernel void m06100_sxx (KERN_ATTR_VECTOR ())
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{ {
@ -353,43 +372,27 @@ __kernel void m06211_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = tmps[gid].out[14]; ukey2[6] = tmps[gid].out[14];
ukey2[7] = tmps[gid].out[15]; ukey2[7] = tmps[gid].out[15];
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{ {
@ -353,43 +372,27 @@ __kernel void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = tmps[gid].out[14]; ukey2[6] = tmps[gid].out[14];
ukey2[7] = tmps[gid].out[15]; ukey2[7] = tmps[gid].out[15];
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -415,59 +418,27 @@ __kernel void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey4[6] = tmps[gid].out[30]; ukey4[6] = tmps[gid].out[30];
ukey4[7] = tmps[gid].out[31]; ukey4[7] = tmps[gid].out[31];
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{ {
@ -353,43 +372,27 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = tmps[gid].out[14]; ukey2[6] = tmps[gid].out[14];
ukey2[7] = tmps[gid].out[15]; ukey2[7] = tmps[gid].out[15];
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -415,59 +418,27 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey4[6] = tmps[gid].out[30]; ukey4[6] = tmps[gid].out[30];
ukey4[7] = tmps[gid].out[31]; ukey4[7] = tmps[gid].out[31];
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -493,27 +464,19 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey6[6] = tmps[gid].out[46]; ukey6[6] = tmps[gid].out[46];
ukey6[7] = tmps[gid].out[47]; ukey6[7] = tmps[gid].out[47];
if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc64_tmp
{
u64 ipad[8];
u64 opad[8];
u64 dgst[32];
u64 out[32];
} tc64_tmp_t;
DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest)
{ {
@ -497,43 +516,27 @@ __kernel void m06221_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc64_tmp
{
u64 ipad[8];
u64 opad[8];
u64 dgst[32];
u64 out[32];
} tc64_tmp_t;
DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest)
{ {
@ -497,43 +516,27 @@ __kernel void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -559,59 +562,27 @@ __kernel void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15]));
ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15])); ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15]));
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,13 +16,32 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
typedef struct tc64_tmp
{
u64 ipad[8];
u64 opad[8];
u64 dgst[32];
u64 out[32];
} tc64_tmp_t;
DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest)
{ {
@ -497,43 +516,27 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -559,59 +562,27 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15]));
ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15])); ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15]));
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -637,27 +608,19 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
ukey6[6] = swap32_S (h32_from_64_S (tmps[gid].out[23])); ukey6[6] = swap32_S (h32_from_64_S (tmps[gid].out[23]));
ukey6[7] = swap32_S (l32_from_64_S (tmps[gid].out[23])); ukey6[7] = swap32_S (l32_from_64_S (tmps[gid].out[23]));
if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,15 +16,34 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
digest[ 0] = ipad[ 0]; digest[ 0] = ipad[ 0];
digest[ 1] = ipad[ 1]; digest[ 1] = ipad[ 1];
@ -139,6 +158,14 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
} }
barrier (CLK_LOCAL_MEM_FENCE);
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -165,6 +192,13 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -335,16 +369,14 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
__kernel void m06231_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06231_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
/** /**
* modifier * Whirlpool shared
*/ */
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0); const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** #ifdef REAL_SHM
* shared
*/
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -372,6 +404,13 @@ __kernel void m06231_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if ((gid * VECT_SIZE) >= gid_max) return; if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[16]; u32x ipad[16];
@ -587,6 +626,45 @@ __kernel void m06231_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
#endif #endif
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256];
__local u32 s_Cl[8][256];
for (u32 i = lid; i < 256; i += lsz)
{
s_Ch[0][i] = Ch[0][i];
s_Ch[1][i] = Ch[1][i];
s_Ch[2][i] = Ch[2][i];
s_Ch[3][i] = Ch[3][i];
s_Ch[4][i] = Ch[4][i];
s_Ch[5][i] = Ch[5][i];
s_Ch[6][i] = Ch[6][i];
s_Ch[7][i] = Ch[7][i];
s_Cl[0][i] = Cl[0][i];
s_Cl[1][i] = Cl[1][i];
s_Cl[2][i] = Cl[2][i];
s_Cl[3][i] = Cl[3][i];
s_Cl[4][i] = Cl[4][i];
s_Cl[5][i] = Cl[5][i];
s_Cl[6][i] = Cl[6][i];
s_Cl[7][i] = Cl[7][i];
}
barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
u32 ukey1[8]; u32 ukey1[8];
@ -611,43 +689,27 @@ __kernel void m06231_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[6] = swap32_S (tmps[gid].out[14]);
ukey2[7] = swap32_S (tmps[gid].out[15]); ukey2[7] = swap32_S (tmps[gid].out[15]);
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,15 +16,34 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
digest[ 0] = ipad[ 0]; digest[ 0] = ipad[ 0];
digest[ 1] = ipad[ 1]; digest[ 1] = ipad[ 1];
@ -139,6 +158,14 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
} }
barrier (CLK_LOCAL_MEM_FENCE);
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -165,6 +192,13 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -335,16 +369,14 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
__kernel void m06232_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06232_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
/** /**
* modifier * Whirlpool shared
*/ */
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0); const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** #ifdef REAL_SHM
* shared
*/
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -372,6 +404,13 @@ __kernel void m06232_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if ((gid * VECT_SIZE) >= gid_max) return; if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[16]; u32x ipad[16];
@ -587,6 +626,45 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
#endif #endif
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256];
__local u32 s_Cl[8][256];
for (u32 i = lid; i < 256; i += lsz)
{
s_Ch[0][i] = Ch[0][i];
s_Ch[1][i] = Ch[1][i];
s_Ch[2][i] = Ch[2][i];
s_Ch[3][i] = Ch[3][i];
s_Ch[4][i] = Ch[4][i];
s_Ch[5][i] = Ch[5][i];
s_Ch[6][i] = Ch[6][i];
s_Ch[7][i] = Ch[7][i];
s_Cl[0][i] = Cl[0][i];
s_Cl[1][i] = Cl[1][i];
s_Cl[2][i] = Cl[2][i];
s_Cl[3][i] = Cl[3][i];
s_Cl[4][i] = Cl[4][i];
s_Cl[5][i] = Cl[5][i];
s_Cl[6][i] = Cl[6][i];
s_Cl[7][i] = Cl[7][i];
}
barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
u32 ukey1[8]; u32 ukey1[8];
@ -611,43 +689,27 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[6] = swap32_S (tmps[gid].out[14]);
ukey2[7] = swap32_S (tmps[gid].out[15]); ukey2[7] = swap32_S (tmps[gid].out[15]);
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -673,59 +735,27 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey4[6] = swap32_S (tmps[gid].out[30]); ukey4[6] = swap32_S (tmps[gid].out[30]);
ukey4[7] = swap32_S (tmps[gid].out[31]); ukey4[7] = swap32_S (tmps[gid].out[31]);
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

View File

@ -16,15 +16,34 @@
#include "inc_cipher_aes.cl" #include "inc_cipher_aes.cl"
#include "inc_cipher_twofish.cl" #include "inc_cipher_twofish.cl"
#include "inc_cipher_serpent.cl" #include "inc_cipher_serpent.cl"
#include "inc_cipher_camellia.cl"
#include "inc_cipher_kuznyechik.cl" typedef struct tc
{
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;
#include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl"
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) typedef struct tc_tmp
{
u32 ipad[16];
u32 opad[16];
u32 dgst[64];
u32 out[64];
} tc_tmp_t;
DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
{ {
digest[ 0] = ipad[ 0]; digest[ 0] = ipad[ 0];
digest[ 1] = ipad[ 1]; digest[ 1] = ipad[ 1];
@ -139,6 +158,14 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
} }
barrier (CLK_LOCAL_MEM_FENCE);
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -165,6 +192,13 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
/** /**
@ -335,16 +369,14 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
__kernel void m06233_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06233_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
/** /**
* modifier * Whirlpool shared
*/ */
const u64 gid = get_global_id (0); const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0); const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0); const u64 lsz = get_local_size (0);
/** #ifdef REAL_SHM
* shared
*/
__local u32 s_Ch[8][256]; __local u32 s_Ch[8][256];
__local u32 s_Cl[8][256]; __local u32 s_Cl[8][256];
@ -372,6 +404,13 @@ __kernel void m06233_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
barrier (CLK_LOCAL_MEM_FENCE); barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if ((gid * VECT_SIZE) >= gid_max) return; if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[16]; u32x ipad[16];
@ -587,6 +626,45 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
#endif #endif
/**
* Whirlpool shared
*/
#ifdef REAL_SHM
__local u32 s_Ch[8][256];
__local u32 s_Cl[8][256];
for (u32 i = lid; i < 256; i += lsz)
{
s_Ch[0][i] = Ch[0][i];
s_Ch[1][i] = Ch[1][i];
s_Ch[2][i] = Ch[2][i];
s_Ch[3][i] = Ch[3][i];
s_Ch[4][i] = Ch[4][i];
s_Ch[5][i] = Ch[5][i];
s_Ch[6][i] = Ch[6][i];
s_Ch[7][i] = Ch[7][i];
s_Cl[0][i] = Cl[0][i];
s_Cl[1][i] = Cl[1][i];
s_Cl[2][i] = Cl[2][i];
s_Cl[3][i] = Cl[3][i];
s_Cl[4][i] = Cl[4][i];
s_Cl[5][i] = Cl[5][i];
s_Cl[6][i] = Cl[6][i];
s_Cl[7][i] = Cl[7][i];
}
barrier (CLK_LOCAL_MEM_FENCE);
#else
__constant u32a (*s_Ch)[256] = Ch;
__constant u32a (*s_Cl)[256] = Cl;
#endif
if (gid >= gid_max) return; if (gid >= gid_max) return;
u32 ukey1[8]; u32 ukey1[8];
@ -611,43 +689,27 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[6] = swap32_S (tmps[gid].out[14]);
ukey2[7] = swap32_S (tmps[gid].out[15]); ukey2[7] = swap32_S (tmps[gid].out[15]);
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -673,59 +735,27 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey4[6] = swap32_S (tmps[gid].out[30]); ukey4[6] = swap32_S (tmps[gid].out[30]);
ukey4[7] = swap32_S (tmps[gid].out[31]); ukey4[7] = swap32_S (tmps[gid].out[31]);
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1)
{ {
if (atomic_inc (&hashes_shown[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, 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[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
}
}
if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
@ -751,27 +781,19 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
ukey6[6] = swap32_S (tmps[gid].out[46]); ukey6[6] = swap32_S (tmps[gid].out[46]);
ukey6[7] = swap32_S (tmps[gid].out[47]); ukey6[7] = swap32_S (tmps[gid].out[47]);
if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
} }
} }
if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, 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[0]) == 0) if (atomic_inc (&hashes_shown[0]) == 0)
{ {
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0);
}
}
if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1)
{
if (atomic_inc (&hashes_shown[0]) == 0)
{
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More