1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-24 07:28:10 +00:00

Fix compile error caused by __add3()

This commit is contained in:
jsteube 2017-08-27 19:46:17 +02:00
parent 00e38cc2c6
commit a0be36d7b8
3 changed files with 48 additions and 53 deletions

View File

@ -31,27 +31,24 @@
#define MD4_Go(x,y,z) (MD4_G((x), (y), (z))) #define MD4_Go(x,y,z) (MD4_G((x), (y), (z)))
#endif #endif
#define MD4_STEP_S(f,a,b,c,d,x,K,s) \ #define MD4_STEP_S(f,a,b,c,d,x,K,s) \
{ \ { \
a += K; \ a += K; \
const u32 t = f (b, c, d); \ a = __add3_S (a, x, f (b, c, d)); \
a = __add3_S (a, x, t); \ a = rotl32_S (a, s); \
a = rotl32_S (a, s); \
} }
#define MD4_STEP(f,a,b,c,d,x,K,s) \ #define MD4_STEP(f,a,b,c,d,x,K,s) \
{ \ { \
a += K; \ a += K; \
const u32x t = f (b, c, d); \ a = __add3 (a, x, f (b, c, d)); \
a = __add3 (a, x, t); \ a = rotl32 (a, s); \
a = rotl32 (a, s); \
} }
#define MD4_STEP0(f,a,b,c,d,K,s) \ #define MD4_STEP0(f,a,b,c,d,K,s) \
{ \ { \
const u32x t = f (b, c, d); \ a = __add3 (a, K, f (b, c, d)); \
a = __add3 (a, K, t); \ a = rotl32 (a, s); \
a = rotl32 (a, s); \
} }
#define MD5_F_S(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) #define MD5_F_S(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
@ -86,28 +83,25 @@
#define MD5_Go(x,y,z) (MD5_G((x), (y), (z))) #define MD5_Go(x,y,z) (MD5_G((x), (y), (z)))
#endif #endif
#define MD5_STEP_S(f,a,b,c,d,x,K,s) \ #define MD5_STEP_S(f,a,b,c,d,x,K,s) \
{ \ { \
a += K; \ a += K; \
const u32 t = f (b, c, d); \ a = __add3_S (a, x, f (b, c, d)); \
a = __add3_S (a, x, t); \ a = rotl32_S (a, s); \
a = rotl32_S (a, s); \ a += b; \
a += b; \
} }
#define MD5_STEP(f,a,b,c,d,x,K,s) \ #define MD5_STEP(f,a,b,c,d,x,K,s) \
{ \ { \
a += K; \ a += K; \
const u32x t = f (b, c, d); \ a = __add3 (a, x, f (b, c, d)); \
a = __add3 (a, x, t); \
a = rotl32 (a, s); \ a = rotl32 (a, s); \
a += b; \ a += b; \
} }
#define MD5_STEP0(f,a,b,c,d,K,s) \ #define MD5_STEP0(f,a,b,c,d,K,s) \
{ \ { \
const u32x t = f (b, c, d); \ a = __add3 (a, K, f (b, c, d)); \
a = __add3 (a, K, t); \
a = rotl32 (a, s); \ a = rotl32 (a, s); \
a += b; \ a += b; \
} }
@ -136,36 +130,32 @@
#define SHA1_F2o(x,y,z) (SHA1_F2 ((x), (y), (z))) #define SHA1_F2o(x,y,z) (SHA1_F2 ((x), (y), (z)))
#endif #endif
#define SHA1_STEP_S(f,a,b,c,d,e,x) \ #define SHA1_STEP_S(f,a,b,c,d,e,x) \
{ \ { \
e += K; \ e += K; \
const u32 t = f (b, c, d); \ e = __add3_S (e, x, f (b, c, d)); \
e = __add3_S (e, x, t); \ e += rotl32_S (a, 5u); \
e += rotl32_S (a, 5u); \ b = rotl32_S (b, 30u); \
b = rotl32_S (b, 30u); \
} }
#define SHA1_STEP(f,a,b,c,d,e,x) \ #define SHA1_STEP(f,a,b,c,d,e,x) \
{ \ { \
e += K; \ e += K; \
const u32x t = f (b, c, d); \ e = __add3 (e, x, f (b, c, d)); \
e = __add3 (e, x, t); \
e += rotl32 (a, 5u); \ e += rotl32 (a, 5u); \
b = rotl32 (b, 30u); \ b = rotl32 (b, 30u); \
} }
#define SHA1_STEP0(f,a,b,c,d,e,x) \ #define SHA1_STEP0(f,a,b,c,d,e,x) \
{ \ { \
const u32x t = f (b, c, d); \ e = __add3 (e, K, f (b, c, d)); \
e = __add3 (e, K, t); \
e += rotl32 (a, 5u); \ e += rotl32 (a, 5u); \
b = rotl32 (b, 30u); \ b = rotl32 (b, 30u); \
} }
#define SHA1_STEPX(f,a,b,c,d,e,x) \ #define SHA1_STEPX(f,a,b,c,d,e,x) \
{ \ { \
const u32x t = f (b, c, d); \ e = __add3 (e, x, f (b, c, d)); \
e = __add3 (e, x, t); \
e += rotl32 (a, 5u); \ e += rotl32 (a, 5u); \
b = rotl32 (b, 30u); \ b = rotl32 (b, 30u); \
} }
@ -218,28 +208,20 @@
#define SHA256_STEP_S(F0,F1,a,b,c,d,e,f,g,h,x,K) \ #define SHA256_STEP_S(F0,F1,a,b,c,d,e,f,g,h,x,K) \
{ \ { \
const u32 t1 = SHA256_S3_S (e); \
const u32 t2 = F1 (e,f,g); \
h = __add3_S (h, K, x); \ h = __add3_S (h, K, x); \
h = __add3_S (h, t1, t2); \ h = __add3_S (h, SHA256_S3_S (e), F1 (e,f,g)); \
d += h; \ d += h; \
const u32 t3 = SHA256_S2_S (a); \ h = __add3_S (h, SHA256_S2_S (a), F0 (a,b,c)); \
const u32 t4 = F0 (a,b,c); \
h = __add3_S (h, t3, t4); \
} }
#define SHA256_EXPAND_S(x,y,z,w) (SHA256_S1_S (x) + y + SHA256_S0_S (z) + w) #define SHA256_EXPAND_S(x,y,z,w) (SHA256_S1_S (x) + y + SHA256_S0_S (z) + w)
#define SHA256_STEP(F0,F1,a,b,c,d,e,f,g,h,x,K) \ #define SHA256_STEP(F0,F1,a,b,c,d,e,f,g,h,x,K) \
{ \ { \
const u32 t1 = SHA256_S3 (e); \
const u32 t2 = F1 (e,f,g); \
h = __add3 (h, K, x); \ h = __add3 (h, K, x); \
h = __add3 (h, t1, t2); \ h = __add3 (h, SHA256_S3 (e), F1 (e,f,g)); \
d += h; \ d += h; \
const u32 t3 = SHA256_S2 (a); \ h = __add3 (h, SHA256_S2 (a), F0 (a,b,c)); \
const u32 t4 = F0 (a,b,c); \
h = __add3 (h, t3, t4); \
} }
#define SHA256_EXPAND(x,y,z,w) (SHA256_S1 (x) + y + SHA256_S0 (z) + w) #define SHA256_EXPAND(x,y,z,w) (SHA256_S1 (x) + y + SHA256_S0 (z) + w)

View File

@ -6,6 +6,9 @@
#ifndef _BITOPS_H #ifndef _BITOPS_H
#define _BITOPS_H #define _BITOPS_H
u32 __add3 (const u32 a, const u32 b, const u32 c);
u32 __add3_S (const u32 a, const u32 b, const u32 c);
u32 rotl32 (const u32 a, const u32 n); u32 rotl32 (const u32 a, const u32 n);
u32 rotr32 (const u32 a, const u32 n); u32 rotr32 (const u32 a, const u32 n);
u64 rotl64 (const u64 a, const u64 n); u64 rotl64 (const u64 a, const u64 n);

View File

@ -7,6 +7,16 @@
#include "types.h" #include "types.h"
#include "bitops.h" #include "bitops.h"
u32 __add3_S (const u32 a, const u32 b, const u32 c)
{
return a + b + c;
}
u32 __add3 (const u32 a, const u32 b, const u32 c)
{
return a + b + c;
}
u32 rotl32 (const u32 a, const u32 n) u32 rotl32 (const u32 a, const u32 n)
{ {
#if defined (_MSC_VER) #if defined (_MSC_VER)