1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-14 17:51:05 +00:00

OpenCL Kernels: Added datatypes to literals of some 64 bit kernel constants

This commit is contained in:
Jens Steube 2020-07-22 14:06:58 +02:00
parent 70ba719169
commit 4658e470a2
26 changed files with 1783 additions and 1789 deletions

View File

@ -2903,7 +2903,7 @@ DECLSPEC void switch_buffer_by_offset_le (u32x *w0, u32x *w1, u32x *w2, u32x *w3
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -4495,7 +4495,7 @@ DECLSPEC void switch_buffer_by_offset_be (u32x *w0, u32x *w1, u32x *w2, u32x *w3
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -5295,7 +5295,7 @@ DECLSPEC void switch_buffer_by_offset_carry_be (u32x *w0, u32x *w1, u32x *w2, u3
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -6931,7 +6931,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_le (u32x *w0, u32x *w1, u32x *w2, u32x
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -9199,7 +9199,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_le (u32x *w0, u32x *w1, u32x *w2
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -12055,7 +12055,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_be (u32x *w0, u32x *w1, u32x *w2, u32x
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -14911,7 +14911,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_be (u32x *w0, u32x *w1, u32x *w2
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -20971,7 +20971,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_le (u32x *w, const u32 offset)
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -29699,7 +29699,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_be (u32x *w, const u32 offset)
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -36494,7 +36494,7 @@ DECLSPEC void switch_buffer_by_offset_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3,
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -38086,7 +38086,7 @@ DECLSPEC void switch_buffer_by_offset_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *w3,
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -38886,7 +38886,7 @@ DECLSPEC void switch_buffer_by_offset_carry_be_S (u32 *w0, u32 *w1, u32 *w2, u32
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -40522,7 +40522,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_le_S (u32 *w0, u32 *w1, u32 *w2, u32 *
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -42790,7 +42790,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_le_S (u32 *w0, u32 *w1, u32 *w2,
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -45646,7 +45646,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_be_S (u32 *w0, u32 *w1, u32 *w2, u32 *
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -48502,7 +48502,7 @@ DECLSPEC void switch_buffer_by_offset_8x4_carry_be_S (u32 *w0, u32 *w1, u32 *w2,
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -54562,7 +54562,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_le_S (u32 *w, const u32 offset)
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)
@ -63290,7 +63290,7 @@ DECLSPEC void switch_buffer_by_offset_1x64_be_S (u32 *w, const u32 offset)
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> ((offset & 3) * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> ((offset & 3) * 8));
#endif #endif
switch (offset_switch) switch (offset_switch)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -895,7 +895,7 @@ DECLSPEC void append_block8_optimized (const u32 offset, u32 *buf0, u32 *buf1, c
#endif #endif
#if defined IS_AMD #if defined IS_AMD
const int selector = 0x0706050403020100 >> (offset_minus_4 * 8); const int selector = l32_from_64_S (0x0706050403020100UL >> (offset_minus_4 * 8));
#endif #endif
const u32 src_r00 = src_r0[0]; const u32 src_r00 = src_r0[0];

View File

@ -170,7 +170,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -168,7 +168,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -168,7 +168,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -170,7 +170,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -168,7 +168,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -168,7 +168,7 @@ DECLSPEC void hmac_sha512_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipa
w1_t[1] = digest[5]; w1_t[1] = digest[5];
w1_t[2] = digest[6]; w1_t[2] = digest[6];
w1_t[3] = digest[7]; w1_t[3] = digest[7];
w2_t[0] = 0x8000000000000000; w2_t[0] = 0x8000000000000000UL;
w2_t[1] = 0; w2_t[1] = 0;
w2_t[2] = 0; w2_t[2] = 0;
w2_t[3] = 0; w2_t[3] = 0;

View File

@ -145,7 +145,7 @@ KERNEL_FQ void m03100_m04 (KERN_ATTR_RULES ())
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */
@ -389,7 +389,7 @@ KERNEL_FQ void m03100_s04 (KERN_ATTR_RULES ())
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */

View File

@ -203,7 +203,7 @@ KERNEL_FQ void m03100_m04 (KERN_ATTR_BASIC ())
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */
@ -507,7 +507,7 @@ KERNEL_FQ void m03100_s04 (KERN_ATTR_BASIC ())
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */

View File

@ -99,7 +99,7 @@ DECLSPEC void m03100m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64],
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */
@ -292,7 +292,7 @@ DECLSPEC void m03100s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64],
dst[15] = w3[3]; dst[15] = w3[3];
/** /**
* precompute key1 since key is static: 0x0123456789abcdef * precompute key1 since key is static: 0x0123456789abcdefUL
* plus LEFT_ROTATE by 2 * plus LEFT_ROTATE by 2
*/ */

View File

@ -54,10 +54,10 @@ DECLSPEC int replace_u32_le (const u32 input, u32 *output, int cur_len)
u64 m64 = input64; u64 m64 = input64;
m64 ^= 0x002e002e002e002e; // convert 0x2e to 0x00 m64 ^= 0x002e002e002e002eUL; // convert 0x2e to 0x00
m64 ^= 0x00ff00ff00ff00ff; // convert 0x00 to 0xff (jit will optimize this to one instruction) m64 ^= 0x00ff00ff00ff00ffUL; // convert 0x00 to 0xff (jit will optimize this to one instruction)
m64 += 0x0001000100010001; // only 0xff can set 9th bit m64 += 0x0001000100010001UL; // only 0xff can set 9th bit
m64 &= 0x0100010001000100; // only 9th bit survives m64 &= 0x0100010001000100UL; // only 9th bit survives
m64 |= m64 << 1; // converts 0x0100 to 0xff00 m64 |= m64 << 1; // converts 0x0100 to 0xff00
m64 |= m64 << 2; m64 |= m64 << 2;

View File

@ -52,10 +52,10 @@ DECLSPEC int replace_u32_le (const u32 input, u32 *output, int cur_len)
u64 m64 = input64; u64 m64 = input64;
m64 ^= 0x002e002e002e002e; // convert 0x2e to 0x00 m64 ^= 0x002e002e002e002eUL; // convert 0x2e to 0x00
m64 ^= 0x00ff00ff00ff00ff; // convert 0x00 to 0xff (jit will optimize this to one instruction) m64 ^= 0x00ff00ff00ff00ffUL; // convert 0x00 to 0xff (jit will optimize this to one instruction)
m64 += 0x0001000100010001; // only 0xff can set 9th bit m64 += 0x0001000100010001UL; // only 0xff can set 9th bit
m64 &= 0x0100010001000100; // only 9th bit survives m64 &= 0x0100010001000100UL; // only 9th bit survives
m64 |= m64 << 1; // converts 0x0100 to 0xff00 m64 |= m64 << 1; // converts 0x0100 to 0xff00
m64 |= m64 << 2; m64 |= m64 << 2;

View File

@ -52,10 +52,10 @@ DECLSPEC int replace_u32_be (const u32 input, u32 *output, int cur_len)
u64 m64 = input64; u64 m64 = input64;
m64 ^= 0x002e002e002e002e; // convert 0x2e to 0x00 m64 ^= 0x002e002e002e002eUL; // convert 0x2e to 0x00
m64 ^= 0x00ff00ff00ff00ff; // convert 0x00 to 0xff (jit will optimize this to one instruction) m64 ^= 0x00ff00ff00ff00ffUL; // convert 0x00 to 0xff (jit will optimize this to one instruction)
m64 += 0x0001000100010001; // only 0xff can set 9th bit m64 += 0x0001000100010001UL; // only 0xff can set 9th bit
m64 &= 0x0100010001000100; // only 9th bit survives m64 &= 0x0100010001000100UL; // only 9th bit survives
m64 |= m64 << 1; // converts 0x0100 to 0xff00 m64 |= m64 << 1; // converts 0x0100 to 0xff00
m64 |= m64 << 2; m64 |= m64 << 2;

View File

@ -17,7 +17,7 @@
#include "inc_hash_streebog256.cl" #include "inc_hash_streebog256.cl"
#endif #endif
#define INITVAL 0x0101010101010101 #define INITVAL 0x0101010101010101UL
DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256]) DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256])
{ {

View File

@ -15,7 +15,7 @@
#include "inc_hash_streebog256.cl" #include "inc_hash_streebog256.cl"
#endif #endif
#define INITVAL 0x0101010101010101 #define INITVAL 0x0101010101010101UL
DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256]) DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256])
{ {

View File

@ -15,7 +15,7 @@
#include "inc_hash_streebog256.cl" #include "inc_hash_streebog256.cl"
#endif #endif
#define INITVAL 0x0101010101010101 #define INITVAL 0x0101010101010101UL
DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256]) DECLSPEC void streebog_g (u64x *h, const u64x *m, LOCAL_AS u64 (*s_sbob_sl64)[256])
{ {

View File

@ -97,12 +97,12 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
u64x padding[8] = { 0 }; u64x padding[8] = { 0 };
u64x message[8]; u64x message[8];
padding[7] = 0x0100000000000000; padding[7] = 0x0100000000000000UL;
//inner HMAC: ipad + message //inner HMAC: ipad + message
//first transform: precalculated ipad hash //first transform: precalculated ipad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = previous HMAC digest //second transform: message = previous HMAC digest
message[7] = hl32_to_64 (w3[2], w3[3]); message[7] = hl32_to_64 (w3[2], w3[3]);
@ -125,7 +125,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
//final: padding byte //final: padding byte
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
@ -140,7 +140,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
//outer HMAC: opad + digest //outer HMAC: opad + digest
//first transform: precalculated opad hash //first transform: precalculated opad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = inner HMAC digest //second transform: message = inner HMAC digest
message[0] = digest[0]; message[0] = digest[0];
@ -163,7 +163,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);

View File

@ -148,12 +148,12 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
u64x padding[8] = { 0 }; u64x padding[8] = { 0 };
u64x message[8]; u64x message[8];
padding[7] = 0x0100000000000000; padding[7] = 0x0100000000000000UL;
//inner HMAC: ipad + message //inner HMAC: ipad + message
//first transform: precalculated ipad hash //first transform: precalculated ipad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = previous HMAC digest //second transform: message = previous HMAC digest
message[7] = hl32_to_64 (w3[2], w3[3]); message[7] = hl32_to_64 (w3[2], w3[3]);
@ -176,7 +176,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
//final: padding byte //final: padding byte
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
@ -191,7 +191,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
//outer HMAC: opad + digest //outer HMAC: opad + digest
//first transform: precalculated opad hash //first transform: precalculated opad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = inner HMAC digest //second transform: message = inner HMAC digest
message[0] = digest[0]; message[0] = digest[0];
@ -214,7 +214,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);

View File

@ -213,12 +213,12 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
u64x padding[8] = { 0 }; u64x padding[8] = { 0 };
u64x message[8]; u64x message[8];
padding[7] = 0x0100000000000000; padding[7] = 0x0100000000000000UL;
//inner HMAC: ipad + message //inner HMAC: ipad + message
//first transform: precalculated ipad hash //first transform: precalculated ipad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = previous HMAC digest //second transform: message = previous HMAC digest
message[7] = hl32_to_64 (w3[2], w3[3]); message[7] = hl32_to_64 (w3[2], w3[3]);
@ -241,7 +241,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
//final: padding byte //final: padding byte
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
@ -256,7 +256,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
//outer HMAC: opad + digest //outer HMAC: opad + digest
//first transform: precalculated opad hash //first transform: precalculated opad hash
counterbuf[7] = 0x0002000000000000; counterbuf[7] = 0x0002000000000000UL;
//second transform: message = inner HMAC digest //second transform: message = inner HMAC digest
message[0] = digest[0]; message[0] = digest[0];
@ -279,7 +279,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
counterbuf[7] = 0x0004000000000000; counterbuf[7] = 0x0004000000000000UL;
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64); streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);

View File

@ -36,14 +36,12 @@ typedef struct ethereum_pbkdf2
CONSTANT_VK u64a keccakf_rndc[24] = CONSTANT_VK u64a keccakf_rndc[24] =
{ {
0x0000000000000001, 0x0000000000008082, 0x800000000000808a, KECCAK_RNDC_00, KECCAK_RNDC_01, KECCAK_RNDC_02, KECCAK_RNDC_03,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001, KECCAK_RNDC_04, KECCAK_RNDC_05, KECCAK_RNDC_06, KECCAK_RNDC_07,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a, KECCAK_RNDC_08, KECCAK_RNDC_09, KECCAK_RNDC_10, KECCAK_RNDC_11,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a, KECCAK_RNDC_12, KECCAK_RNDC_13, KECCAK_RNDC_14, KECCAK_RNDC_15,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089, KECCAK_RNDC_16, KECCAK_RNDC_17, KECCAK_RNDC_18, KECCAK_RNDC_19,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080, KECCAK_RNDC_20, KECCAK_RNDC_21, KECCAK_RNDC_22, KECCAK_RNDC_23
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
}; };
#ifndef KECCAK_ROUNDS #ifndef KECCAK_ROUNDS
@ -465,7 +463,7 @@ KERNEL_FQ void m15600_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, ethereum_
const u32 add80w = (rsiz - 1) / 8; const u32 add80w = (rsiz - 1) / 8;
st[add80w] |= 0x8000000000000000; st[add80w] |= 0x8000000000000000UL;
keccak_transform_S (st); keccak_transform_S (st);

View File

@ -318,14 +318,12 @@ DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, GLOBAL_AS uint4 *V0, GLOBAL_AS ui
CONSTANT_VK u64a keccakf_rndc[24] = CONSTANT_VK u64a keccakf_rndc[24] =
{ {
0x0000000000000001, 0x0000000000008082, 0x800000000000808a, KECCAK_RNDC_00, KECCAK_RNDC_01, KECCAK_RNDC_02, KECCAK_RNDC_03,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001, KECCAK_RNDC_04, KECCAK_RNDC_05, KECCAK_RNDC_06, KECCAK_RNDC_07,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a, KECCAK_RNDC_08, KECCAK_RNDC_09, KECCAK_RNDC_10, KECCAK_RNDC_11,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a, KECCAK_RNDC_12, KECCAK_RNDC_13, KECCAK_RNDC_14, KECCAK_RNDC_15,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089, KECCAK_RNDC_16, KECCAK_RNDC_17, KECCAK_RNDC_18, KECCAK_RNDC_19,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080, KECCAK_RNDC_20, KECCAK_RNDC_21, KECCAK_RNDC_22, KECCAK_RNDC_23
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
}; };
DECLSPEC void keccak_transform_S (u64 *st) DECLSPEC void keccak_transform_S (u64 *st)
@ -653,7 +651,7 @@ KERNEL_FQ void m15700_comp (KERN_ATTR_TMPS_ESALT (scrypt_tmp_t, ethereum_scrypt_
const u32 add80w = (rsiz - 1) / 8; const u32 add80w = (rsiz - 1) / 8;
st[add80w] |= 0x8000000000000000; st[add80w] |= 0x8000000000000000UL;
keccak_transform_S (st); keccak_transform_S (st);

View File

@ -38,14 +38,12 @@ typedef struct pbkdf2_sha256_tmp
CONSTANT_VK u64a keccakf_rndc[24] = CONSTANT_VK u64a keccakf_rndc[24] =
{ {
0x0000000000000001, 0x0000000000008082, 0x800000000000808a, KECCAK_RNDC_00, KECCAK_RNDC_01, KECCAK_RNDC_02, KECCAK_RNDC_03,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001, KECCAK_RNDC_04, KECCAK_RNDC_05, KECCAK_RNDC_06, KECCAK_RNDC_07,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a, KECCAK_RNDC_08, KECCAK_RNDC_09, KECCAK_RNDC_10, KECCAK_RNDC_11,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a, KECCAK_RNDC_12, KECCAK_RNDC_13, KECCAK_RNDC_14, KECCAK_RNDC_15,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089, KECCAK_RNDC_16, KECCAK_RNDC_17, KECCAK_RNDC_18, KECCAK_RNDC_19,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080, KECCAK_RNDC_20, KECCAK_RNDC_21, KECCAK_RNDC_22, KECCAK_RNDC_23
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
}; };
#ifndef KECCAK_ROUNDS #ifndef KECCAK_ROUNDS
@ -552,186 +550,186 @@ KERNEL_FQ void m16300_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, ethereum_
switch (padding_len) switch (padding_len)
{ {
case 16: case 16:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x1010101010101010) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x1010101010101010UL) ||
((seed[seed_idx - 2] & 0xffffffffffffffff) != 0x1010101010101010)) ((seed[seed_idx - 2] & 0xffffffffffffffffUL) != 0x1010101010101010UL))
{ {
return; return;
} }
seed[seed_idx - 2] = 0x0102; seed[seed_idx - 2] = 0x0102UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 15: case 15:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0f0f0f0f0f0f0f0f) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0f0f0f0f0f0f0f0fUL) ||
((seed[seed_idx - 2] & 0xffffffffffffff00) != 0x0f0f0f0f0f0f0f00)) ((seed[seed_idx - 2] & 0xffffffffffffff00UL) != 0x0f0f0f0f0f0f0f00UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x00000000000000ff; seed[seed_idx - 2] &= 0x00000000000000ffUL;
seed[seed_idx - 2] |= 0x0000000000010200; seed[seed_idx - 2] |= 0x0000000000010200UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 14: case 14:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0e0e0e0e0e0e0e0e) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0e0e0e0e0e0e0e0eUL) ||
((seed[seed_idx - 2] & 0xffffffffffff0000) != 0x0e0e0e0e0e0e0000)) ((seed[seed_idx - 2] & 0xffffffffffff0000UL) != 0x0e0e0e0e0e0e0000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x000000000000ffff; seed[seed_idx - 2] &= 0x000000000000ffffUL;
seed[seed_idx - 2] |= 0x0000000001020000; seed[seed_idx - 2] |= 0x0000000001020000UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 13: case 13:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0d0d0d0d0d0d0d0d) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0d0d0d0d0d0d0d0dUL) ||
((seed[seed_idx - 2] & 0xffffffffff000000) != 0x0d0d0d0d0d000000)) ((seed[seed_idx - 2] & 0xffffffffff000000UL) != 0x0d0d0d0d0d000000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x0000000000ffffff; seed[seed_idx - 2] &= 0x0000000000ffffffUL;
seed[seed_idx - 2] |= 0x0000000102000000; seed[seed_idx - 2] |= 0x0000000102000000UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 12: case 12:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0c0c0c0c0c0c0c0c) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0c0c0c0c0c0c0c0cUL) ||
((seed[seed_idx - 2] & 0xffffffff00000000) != 0x0c0c0c0c00000000)) ((seed[seed_idx - 2] & 0xffffffff00000000UL) != 0x0c0c0c0c00000000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x00000000ffffffff; seed[seed_idx - 2] &= 0x00000000ffffffffUL;
seed[seed_idx - 2] |= 0x0000010200000000; seed[seed_idx - 2] |= 0x0000010200000000UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 11: case 11:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0b0b0b0b0b0b0b0b) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0b0b0b0b0b0b0b0bUL) ||
((seed[seed_idx - 2] & 0xffffff0000000000) != 0x0b0b0b0000000000)) ((seed[seed_idx - 2] & 0xffffff0000000000UL) != 0x0b0b0b0000000000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x000000ffffffffff; seed[seed_idx - 2] &= 0x000000ffffffffffUL;
seed[seed_idx - 2] |= 0x0001020000000000; seed[seed_idx - 2] |= 0x0001020000000000UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 10: case 10:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0a0a0a0a0a0a0a0a) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0a0a0a0a0a0a0a0aUL) ||
((seed[seed_idx - 2] & 0xffff000000000000) != 0x0a0a000000000000)) ((seed[seed_idx - 2] & 0xffff000000000000UL) != 0x0a0a000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x0000ffffffffffff; seed[seed_idx - 2] &= 0x0000ffffffffffffUL;
seed[seed_idx - 2] |= 0x0102000000000000; seed[seed_idx - 2] |= 0x0102000000000000UL;
seed[seed_idx - 1] = 0; seed[seed_idx - 1] = 0UL;
break; break;
case 9: case 9:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0909090909090909) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0909090909090909UL) ||
((seed[seed_idx - 2] & 0xff00000000000000) != 0x0900000000000000)) ((seed[seed_idx - 2] & 0xff00000000000000UL) != 0x0900000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 2] &= 0x00ffffffffffffff; seed[seed_idx - 2] &= 0x00ffffffffffffffUL;
seed[seed_idx - 2] |= 0x0200000000000000; seed[seed_idx - 2] |= 0x0200000000000000UL;
seed[seed_idx - 1] = 0x01; seed[seed_idx - 1] = 0x01UL;
break; break;
case 8: case 8:
if (((seed[seed_idx - 1] & 0xffffffffffffffff) != 0x0808080808080808) || if (((seed[seed_idx - 1] & 0xffffffffffffffffUL) != 0x0808080808080808UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] = 0x0102; seed[seed_idx - 1] = 0x0102UL;
break; break;
case 7: case 7:
if (((seed[seed_idx - 1] & 0xffffffffffffff00) != 0x0707070707070700) || if (((seed[seed_idx - 1] & 0xffffffffffffff00UL) != 0x0707070707070700UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x00000000000000ff; seed[seed_idx - 1] &= 0x00000000000000ffUL;
seed[seed_idx - 1] |= 0x0000000000010200; seed[seed_idx - 1] |= 0x0000000000010200UL;
break; break;
case 6: case 6:
if (((seed[seed_idx - 1] & 0xffffffffffff0000) != 0x0606060606060000) || if (((seed[seed_idx - 1] & 0xffffffffffff0000UL) != 0x0606060606060000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x000000000000ffff; seed[seed_idx - 1] &= 0x000000000000ffffUL;
seed[seed_idx - 1] |= 0x0000000001020000; seed[seed_idx - 1] |= 0x0000000001020000UL;
break; break;
case 5: case 5:
if (((seed[seed_idx - 1] & 0xffffffffff000000) != 0x0505050505000000) || if (((seed[seed_idx - 1] & 0xffffffffff000000UL) != 0x0505050505000000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x0000000000ffffff; seed[seed_idx - 1] &= 0x0000000000ffffffUL;
seed[seed_idx - 1] |= 0x0000000102000000; seed[seed_idx - 1] |= 0x0000000102000000UL;
break; break;
case 4: case 4:
if (((seed[seed_idx - 1] & 0xffffffff00000000) != 0x0404040400000000) || if (((seed[seed_idx - 1] & 0xffffffff00000000UL) != 0x0404040400000000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x00000000ffffffff; seed[seed_idx - 1] &= 0x00000000ffffffffUL;
seed[seed_idx - 1] |= 0x0000010200000000; seed[seed_idx - 1] |= 0x0000010200000000UL;
break; break;
case 3: case 3:
if (((seed[seed_idx - 1] & 0xffffff0000000000) != 0x0303030000000000) || if (((seed[seed_idx - 1] & 0xffffff0000000000UL) != 0x0303030000000000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x000000ffffffffff; seed[seed_idx - 1] &= 0x000000ffffffffffUL;
seed[seed_idx - 1] |= 0x0001020000000000; seed[seed_idx - 1] |= 0x0001020000000000UL;
break; break;
case 2: case 2:
if (((seed[seed_idx - 1] & 0xffff000000000000) != 0x0202000000000000) || if (((seed[seed_idx - 1] & 0xffff000000000000UL) != 0x0202000000000000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x0000ffffffffffff; seed[seed_idx - 1] &= 0x0000ffffffffffffUL;
seed[seed_idx - 1] |= 0x0102000000000000; seed[seed_idx - 1] |= 0x0102000000000000UL;
break; break;
case 1: case 1:
if (((seed[seed_idx - 1] & 0xff00000000000000) != 0x0100000000000000) || if (((seed[seed_idx - 1] & 0xff00000000000000UL) != 0x0100000000000000UL) ||
((seed[seed_idx - 2] & 0x0000000000000000) != 0x0000000000000000)) ((seed[seed_idx - 2] & 0x0000000000000000UL) != 0x0000000000000000UL))
{ {
return; return;
} }
seed[seed_idx - 1] &= 0x00ffffffffffffff; seed[seed_idx - 1] &= 0x00ffffffffffffffUL;
seed[seed_idx - 1] |= 0x0200000000000000; seed[seed_idx - 1] |= 0x0200000000000000UL;
seed[seed_idx - 0] = 0x01; seed[seed_idx - 0] = 0x01UL;
break; break;
default: default:
@ -761,7 +759,7 @@ KERNEL_FQ void m16300_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, ethereum_
// final: // final:
st[16] ^= 0x8000000000000000; st[16] ^= 0x8000000000000000UL;
keccak_transform_S (st); keccak_transform_S (st);