mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
make it work with Apple Metal
This commit is contained in:
parent
b4c12ee628
commit
5927fea637
@ -25,17 +25,17 @@
|
||||
}
|
||||
#define PUT_UINT32BE(n, b, i) \
|
||||
{ \
|
||||
(b)[(i) ] = (uchar) ((n) >> 24); \
|
||||
(b)[(i) + 1] = (uchar) ((n) >> 16); \
|
||||
(b)[(i) + 2] = (uchar) ((n) >> 8); \
|
||||
(b)[(i) + 3] = (uchar) ((n) ); \
|
||||
(b)[(i) ] = (u8) ((n) >> 24); \
|
||||
(b)[(i) + 1] = (u8) ((n) >> 16); \
|
||||
(b)[(i) + 2] = (u8) ((n) >> 8); \
|
||||
(b)[(i) + 3] = (u8) ((n) ); \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint K[32];
|
||||
} CAST_KEY;
|
||||
|
||||
#define GETBYTE(x, y) (uint)(uchar)((x)>>(8*(y)))
|
||||
#define GETBYTE(x, y) (uint)(u8)((x)>>(8*(y)))
|
||||
|
||||
/* Macros to access 8-bit bytes out of a 32-bit word */
|
||||
#define U8a(x) GETBYTE(x,3)
|
||||
@ -600,11 +600,11 @@ CONSTANT_AS uint S[8][256] = {
|
||||
#define _CAST_F2(l, r, i, j) _CAST_f2(l, r, K[i], K[i+j])
|
||||
#define _CAST_F3(l, r, i, j) _CAST_f3(l, r, K[i], K[i+j])
|
||||
|
||||
inline void Cast5Encrypt(const uchar *inBlock, uchar *outBlock, CAST_KEY *key)
|
||||
inline void Cast5Encrypt(PRIVATE_AS const u8 *inBlock, PRIVATE_AS u8 *outBlock, PRIVATE_AS CAST_KEY *key)
|
||||
{
|
||||
uint l; GET_UINT32BE(l, inBlock, 0);
|
||||
uint r; GET_UINT32BE(r, inBlock, 4);
|
||||
uint *K = key->K;
|
||||
PRIVATE_AS uint *K = key->K;
|
||||
uint t;
|
||||
|
||||
/* Do the work */
|
||||
@ -630,11 +630,11 @@ inline void Cast5Encrypt(const uchar *inBlock, uchar *outBlock, CAST_KEY *key)
|
||||
PUT_UINT32BE(l, outBlock, 4);
|
||||
}
|
||||
|
||||
inline void Cast5Decrypt(const uchar *inBlock, uchar *outBlock, CAST_KEY *key)
|
||||
inline void Cast5Decrypt(PRIVATE_AS const u8 *inBlock, PRIVATE_AS u8 *outBlock, PRIVATE_AS CAST_KEY *key)
|
||||
{
|
||||
uint l; GET_UINT32BE(l, inBlock, 0);
|
||||
uint r; GET_UINT32BE(r, inBlock, 4);
|
||||
uint *K = key->K;
|
||||
PRIVATE_AS uint *K = key->K;
|
||||
uint t;
|
||||
|
||||
/* Only do full 16 rounds if key length > 80 bits */
|
||||
@ -661,10 +661,10 @@ inline void Cast5Decrypt(const uchar *inBlock, uchar *outBlock, CAST_KEY *key)
|
||||
t = l = r = 0;
|
||||
}
|
||||
|
||||
inline void Cast5SetKey(CAST_KEY *key, uint keylength, const uchar *userKey)
|
||||
inline void Cast5SetKey(PRIVATE_AS CAST_KEY *key, uint keylength, PRIVATE_AS const u8 *userKey)
|
||||
{
|
||||
uint i;
|
||||
uint *K = key->K;
|
||||
PRIVATE_AS uint *K = key->K;
|
||||
uint X[4], Z[4];
|
||||
|
||||
GET_UINT32BE(X[0], userKey, 0);
|
||||
@ -727,4 +727,4 @@ inline void Cast5SetKey(CAST_KEY *key, uint keylength, const uchar *userKey)
|
||||
#define CAST_ecb_decrypt(in, out, ckey) Cast5Decrypt(in, out, ckey)
|
||||
|
||||
|
||||
#endif /* _OPENCL_CAST_H */
|
||||
#endif /* _OPENCL_CAST_H */
|
||||
|
@ -132,9 +132,9 @@ DECLSPEC void cast128_decrypt_cfb (GLOBAL_AS const u32 *encrypted_data, int data
|
||||
lencrypted_data[i + 2] = encrypted_data[i + 2];
|
||||
lencrypted_data[i + 3] = encrypted_data[i + 3];
|
||||
}
|
||||
u8 *lencrypted_data8 = (u8*)lencrypted_data;
|
||||
u8 *decrypted_data8 = (u8*)decrypted_data;
|
||||
u8 *key8 = (u8*)key;
|
||||
PRIVATE_AS u8 *lencrypted_data8 = (PRIVATE_AS u8*)lencrypted_data;
|
||||
PRIVATE_AS u8 *decrypted_data8 = (PRIVATE_AS u8*)decrypted_data;
|
||||
PRIVATE_AS u8 *key8 = (PRIVATE_AS u8*)key;
|
||||
|
||||
|
||||
// Copy the IV, since this will be modified
|
||||
@ -373,4 +373,4 @@ KERNEL_FQ void m17040_aux1 (KERN_ATTR_TMPS_ESALT (gpg_tmp_t, gpg_t))
|
||||
mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user