Skip to content

Commit 8492346

Browse files
committed
zip-opencl: Honor 64-bit data length
This includes adding 64-bit length support to shared HMAC-SHA1 and in turn the CTX version of SHA1. Closes #5712
1 parent ff4c3b5 commit 8492346

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

run/opencl/opencl_hmac_sha1.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif
2626

2727
INLINE void hmac_sha1(HMAC_KEY_TYPE void *_key, uint key_len,
28-
HMAC_MSG_TYPE void *_data, uint data_len,
28+
HMAC_MSG_TYPE void *_data, uint64_t data_len,
2929
HMAC_OUT_TYPE void *_digest, uint digest_len)
3030
{
3131
HMAC_KEY_TYPE uchar *key = _key;
@@ -74,7 +74,7 @@ INLINE void hmac_sha1(HMAC_KEY_TYPE void *_key, uint key_len,
7474
SHA1_Update(&ctx, u.buf, 64);
7575
#ifdef USE_DATA_BUF
7676
HMAC_MSG_TYPE uint *data32 = (HMAC_MSG_TYPE uint*)_data;
77-
uint blocks = data_len / 64;
77+
uint64_t blocks = data_len / 64;
7878
data_len -= 64 * blocks;
7979
data += 64 * blocks;
8080
ctx.total += 64 * blocks;

run/opencl/opencl_sha1_ctx.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*/
4646

4747
typedef struct {
48-
uint total; /* number of bytes processed */
48+
uint64_t total; /* number of bytes processed */
4949
uint state[5]; /* intermediate digest state */
5050
uchar buffer[64]; /* data block being processed */
5151
} SHA_CTX;
@@ -125,7 +125,7 @@ INLINE void _sha1_process(SHA_CTX *ctx, const uchar data[64])
125125
/*
126126
* SHA-1 process buffer
127127
*/
128-
INLINE void SHA1_Update(SHA_CTX *ctx, const uchar *input, uint ilen)
128+
INLINE void SHA1_Update(SHA_CTX *ctx, const uchar *input, uint64_t ilen)
129129
{
130130
uint fill;
131131
uint left;
@@ -166,7 +166,7 @@ INLINE void SHA1_Update(SHA_CTX *ctx, const uchar *input, uint ilen)
166166
INLINE void SHA1_Final(uchar output[20], SHA_CTX *ctx)
167167
{
168168
uint last, padn;
169-
ulong bits;
169+
uint64_t bits;
170170
uchar msglen[8];
171171
uchar sha1_padding[64] = { 0x80 /* , 0, 0 ... */ };
172172

run/opencl/zip_kernel.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ kernel void zip_final(__global const uchar *pwbuf,
275275
const uint early_skip = 2 * salt->key_len / BLK_SZ * BLK_SZ;
276276
const uint late_skip = salt->key_len / BLK_SZ * BLK_SZ;
277277
const uint late_size = early_skip - late_skip;
278-
const uint comp_len = salt->autotune ? MIN(salt->comp_len, 0x1000000) : salt->comp_len;
278+
const uint64_t comp_len = salt->autotune ? MIN(salt->comp_len, 0x1000000) : salt->comp_len;
279279
uchar password[PLAINTEXT_LENGTH];
280280
uchar pwd_ver[3 * BLK_SZ];
281281

0 commit comments

Comments
 (0)