From 9bf0f36d0a40dea8030d54cab130af4317703bf6 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 9 May 2021 11:43:32 +0200 Subject: [PATCH] Get rid of MAYBE_VOLATILE for context position by replacing it with zero length check --- OpenCL/inc_hash_blake2b.cl | 20 ++++++++++++-------- OpenCL/inc_hash_blake2b.h | 12 ++++++------ OpenCL/inc_hash_md4.cl | 12 ++++++++---- OpenCL/inc_hash_md5.cl | 12 ++++++++---- OpenCL/inc_hash_ripemd160.cl | 12 ++++++++---- OpenCL/inc_hash_sha1.cl | 12 ++++++++---- OpenCL/inc_hash_sha224.cl | 12 ++++++++---- OpenCL/inc_hash_sha256.cl | 12 ++++++++---- OpenCL/inc_hash_sha384.cl | 12 ++++++++---- OpenCL/inc_hash_sha512.cl | 12 ++++++++---- OpenCL/inc_hash_streebog256.cl | 12 ++++++++---- OpenCL/inc_hash_streebog512.cl | 12 ++++++++---- OpenCL/inc_hash_whirlpool.cl | 12 ++++++++---- OpenCL/inc_vendor.h | 4 ---- OpenCL/m10700-pure.cl | 6 +++--- OpenCL/m12500-pure.cl | 8 ++++++-- OpenCL/m16400_a0-pure.cl | 8 +++----- OpenCL/m16400_a1-pure.cl | 8 +++----- OpenCL/m16400_a3-pure.cl | 8 +++----- OpenCL/m19200-pure.cl | 4 ++-- OpenCL/m23700-pure.cl | 8 ++++++-- OpenCL/m23800-pure.cl | 8 ++++++-- 22 files changed, 138 insertions(+), 88 deletions(-) diff --git a/OpenCL/inc_hash_blake2b.cl b/OpenCL/inc_hash_blake2b.cl index ac4377c2f..a90ee9e03 100644 --- a/OpenCL/inc_hash_blake2b.cl +++ b/OpenCL/inc_hash_blake2b.cl @@ -9,7 +9,7 @@ #include "inc_common.h" #include "inc_hash_blake2b.h" -DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const u32 len, const u64 f0) +DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const int len, const u64 f0) { const u64 t0 = hl32_to_64_S (0, len); @@ -86,9 +86,11 @@ DECLSPEC void blake2b_init (blake2b_ctx_t *ctx) ctx->len = 0; } -DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const u32 len) +DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len) { - MAYBE_VOLATILE const u32 pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; if (pos == 0) { @@ -195,7 +197,7 @@ DECLSPEC void blake2b_update_128 (blake2b_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, ctx->len += len; } -DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len) +DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const int len) { u32 w0[4]; u32 w1[4]; @@ -285,7 +287,7 @@ DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len) blake2b_update_128 (ctx, w0, w1, w2, w3, w4, w5, w6, w7, len - (u32) pos1); } -DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const u32 len) +DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len) { u32 w0[4]; u32 w1[4]; @@ -457,9 +459,11 @@ DECLSPEC void blake2b_init_vector (blake2b_ctx_vector_t *ctx) ctx->len = 0; } -DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const u32 len) +DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, const int len) { - MAYBE_VOLATILE const u32 pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; if (pos == 0) { @@ -566,7 +570,7 @@ DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u3 ctx->len += len; } -DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const u32 len) +DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const int len) { u32x w0[4]; u32x w1[4]; diff --git a/OpenCL/inc_hash_blake2b.h b/OpenCL/inc_hash_blake2b.h index 702027ce1..afcacf368 100644 --- a/OpenCL/inc_hash_blake2b.h +++ b/OpenCL/inc_hash_blake2b.h @@ -62,7 +62,7 @@ typedef struct blake2b_ctx u64 m[16]; // buffer u64 h[ 8]; // digest - u32 len; + int len; } blake2b_ctx_t; @@ -71,19 +71,19 @@ typedef struct blake2b_ctx_vector u64x m[16]; // buffer u64x h[ 8]; // digest - u32 len; + int len; } blake2b_ctx_vector_t; -DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const u32 len, const u64 f0); +DECLSPEC void blake2b_transform (u64 *h, const u64 *m, const int len, const u64 f0); DECLSPEC void blake2b_init (blake2b_ctx_t *ctx); -DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const u32 len); -DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const u32 len); +DECLSPEC void blake2b_update (blake2b_ctx_t *ctx, const u32 *w, const int len); +DECLSPEC void blake2b_update_global (blake2b_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len); DECLSPEC void blake2b_final (blake2b_ctx_t *ctx); DECLSPEC void blake2b_transform_vector (u64x *h, const u64x *m, const u32x len, const u64 f0); DECLSPEC void blake2b_init_vector (blake2b_ctx_vector_t *ctx); -DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const u32 len); +DECLSPEC void blake2b_update_vector (blake2b_ctx_vector_t *ctx, const u32x *w, const int len); DECLSPEC void blake2b_final_vector (blake2b_ctx_vector_t *ctx); #endif // _INC_HASH_BLAKE2B_H diff --git a/OpenCL/inc_hash_md4.cl b/OpenCL/inc_hash_md4.cl index 138df06f3..9da981841 100644 --- a/OpenCL/inc_hash_md4.cl +++ b/OpenCL/inc_hash_md4.cl @@ -107,7 +107,9 @@ DECLSPEC void md4_init (md4_ctx_t *ctx) DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -843,7 +845,7 @@ DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u3 DECLSPEC void md4_final (md4_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); @@ -1352,7 +1354,9 @@ DECLSPEC void md4_init_vector_from_scalar (md4_ctx_vector_t *ctx, md4_ctx_t *ctx DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1726,7 +1730,7 @@ DECLSPEC void md4_update_vector_utf16le_swap (md4_ctx_vector_t *ctx, const u32x DECLSPEC void md4_final_vector (md4_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); diff --git a/OpenCL/inc_hash_md5.cl b/OpenCL/inc_hash_md5.cl index 7031a0422..d9e4fcecd 100644 --- a/OpenCL/inc_hash_md5.cl +++ b/OpenCL/inc_hash_md5.cl @@ -143,7 +143,9 @@ DECLSPEC void md5_init (md5_ctx_t *ctx) DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -879,7 +881,7 @@ DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u3 DECLSPEC void md5_final (md5_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); @@ -1424,7 +1426,9 @@ DECLSPEC void md5_init_vector_from_scalar (md5_ctx_vector_t *ctx, md5_ctx_t *ctx DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1798,7 +1802,7 @@ DECLSPEC void md5_update_vector_utf16le_swap (md5_ctx_vector_t *ctx, const u32x DECLSPEC void md5_final_vector (md5_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); diff --git a/OpenCL/inc_hash_ripemd160.cl b/OpenCL/inc_hash_ripemd160.cl index e5b98d44c..da0830dc7 100644 --- a/OpenCL/inc_hash_ripemd160.cl +++ b/OpenCL/inc_hash_ripemd160.cl @@ -241,7 +241,9 @@ DECLSPEC void ripemd160_init (ripemd160_ctx_t *ctx) DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -977,7 +979,7 @@ DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL DECLSPEC void ripemd160_final (ripemd160_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); @@ -1621,7 +1623,9 @@ DECLSPEC void ripemd160_init_vector_from_scalar (ripemd160_ctx_vector_t *ctx, ri DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1995,7 +1999,7 @@ DECLSPEC void ripemd160_update_vector_utf16le_swap (ripemd160_ctx_vector_t *ctx, DECLSPEC void ripemd160_final_vector (ripemd160_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos); diff --git a/OpenCL/inc_hash_sha1.cl b/OpenCL/inc_hash_sha1.cl index c0806bd52..0ac702926 100644 --- a/OpenCL/inc_hash_sha1.cl +++ b/OpenCL/inc_hash_sha1.cl @@ -356,7 +356,9 @@ DECLSPEC void sha1_init (sha1_ctx_t *ctx) DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1328,7 +1330,7 @@ DECLSPEC void sha1_update_global_utf16be_swap (sha1_ctx_t *ctx, GLOBAL_AS const DECLSPEC void sha1_final (sha1_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -2089,7 +2091,9 @@ DECLSPEC void sha1_init_vector_from_scalar (sha1_ctx_vector_t *ctx, sha1_ctx_t * DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -2547,7 +2551,7 @@ DECLSPEC void sha1_update_vector_utf16beN (sha1_ctx_vector_t *ctx, const u32x *w DECLSPEC void sha1_final_vector (sha1_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_hash_sha224.cl b/OpenCL/inc_hash_sha224.cl index 026b5af62..5733578e4 100644 --- a/OpenCL/inc_hash_sha224.cl +++ b/OpenCL/inc_hash_sha224.cl @@ -158,7 +158,9 @@ DECLSPEC void sha224_init (sha224_ctx_t *ctx) DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -894,7 +896,7 @@ DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS co DECLSPEC void sha224_final (sha224_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -1438,7 +1440,9 @@ DECLSPEC void sha224_init_vector_from_scalar (sha224_ctx_vector_t *ctx, sha224_c DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1854,7 +1858,7 @@ DECLSPEC void sha224_update_vector_utf16beN (sha224_ctx_vector_t *ctx, const u32 DECLSPEC void sha224_final_vector (sha224_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_hash_sha256.cl b/OpenCL/inc_hash_sha256.cl index c4e11bc1e..6954ce3b1 100644 --- a/OpenCL/inc_hash_sha256.cl +++ b/OpenCL/inc_hash_sha256.cl @@ -158,7 +158,9 @@ DECLSPEC void sha256_init (sha256_ctx_t *ctx) DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -894,7 +896,7 @@ DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS co DECLSPEC void sha256_final (sha256_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -1438,7 +1440,9 @@ DECLSPEC void sha256_init_vector_from_scalar (sha256_ctx_vector_t *ctx, sha256_c DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1854,7 +1858,7 @@ DECLSPEC void sha256_update_vector_utf16beN (sha256_ctx_vector_t *ctx, const u32 DECLSPEC void sha256_final_vector (sha256_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_hash_sha384.cl b/OpenCL/inc_hash_sha384.cl index ad580b91d..e1126e532 100644 --- a/OpenCL/inc_hash_sha384.cl +++ b/OpenCL/inc_hash_sha384.cl @@ -178,7 +178,9 @@ DECLSPEC void sha384_init (sha384_ctx_t *ctx) 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) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; ctx->len += len; @@ -1398,7 +1400,7 @@ DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS co DECLSPEC void sha384_final (sha384_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); @@ -2186,7 +2188,9 @@ DECLSPEC void sha384_init_vector_from_scalar (sha384_ctx_vector_t *ctx, sha384_c 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) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; ctx->len += len; @@ -2894,7 +2898,7 @@ DECLSPEC void sha384_update_vector_utf16beN (sha384_ctx_vector_t *ctx, const u32 DECLSPEC void sha384_final_vector (sha384_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); diff --git a/OpenCL/inc_hash_sha512.cl b/OpenCL/inc_hash_sha512.cl index 8cc664557..1bc87cb58 100644 --- a/OpenCL/inc_hash_sha512.cl +++ b/OpenCL/inc_hash_sha512.cl @@ -178,7 +178,9 @@ DECLSPEC void sha512_init (sha512_ctx_t *ctx) 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) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; ctx->len += len; @@ -1398,7 +1400,7 @@ DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, GLOBAL_AS co DECLSPEC void sha512_final (sha512_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); @@ -2402,7 +2404,9 @@ DECLSPEC void sha512_init_vector_from_scalar (sha512_ctx_vector_t *ctx, sha512_c 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) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + if (len == 0) return; + + const int pos = ctx->len & 127; ctx->len += len; @@ -3110,7 +3114,7 @@ DECLSPEC void sha512_update_vector_utf16beN (sha512_ctx_vector_t *ctx, const u32 DECLSPEC void sha512_final_vector (sha512_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); diff --git a/OpenCL/inc_hash_streebog256.cl b/OpenCL/inc_hash_streebog256.cl index b44349cfa..58d08131d 100644 --- a/OpenCL/inc_hash_streebog256.cl +++ b/OpenCL/inc_hash_streebog256.cl @@ -758,7 +758,9 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1047,7 +1049,7 @@ DECLSPEC void streebog256_update_global_swap (streebog256_ctx_t *ctx, GLOBAL_AS DECLSPEC void streebog256_final (streebog256_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x01_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -1457,7 +1459,9 @@ DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1689,7 +1693,7 @@ DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, con DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_hash_streebog512.cl b/OpenCL/inc_hash_streebog512.cl index 9d1b83ead..45ce8dbb2 100644 --- a/OpenCL/inc_hash_streebog512.cl +++ b/OpenCL/inc_hash_streebog512.cl @@ -758,7 +758,9 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1047,7 +1049,7 @@ DECLSPEC void streebog512_update_global_swap (streebog512_ctx_t *ctx, GLOBAL_AS DECLSPEC void streebog512_final (streebog512_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x01_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -1476,7 +1478,9 @@ DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1708,7 +1712,7 @@ DECLSPEC void streebog512_update_vector_swap (streebog512_ctx_vector_t *ctx, con DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_hash_whirlpool.cl b/OpenCL/inc_hash_whirlpool.cl index 59a9a266b..efc518f39 100644 --- a/OpenCL/inc_hash_whirlpool.cl +++ b/OpenCL/inc_hash_whirlpool.cl @@ -762,7 +762,9 @@ DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u64 *s_MT0, SHM_TYP DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -1498,7 +1500,7 @@ DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, GLOBAL DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); @@ -2158,7 +2160,9 @@ DECLSPEC void whirlpool_init_vector_from_scalar (whirlpool_ctx_vector_t *ctx, wh DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; @@ -2532,7 +2536,7 @@ DECLSPEC void whirlpool_update_vector_utf16le_swap (whirlpool_ctx_vector_t *ctx, DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); diff --git a/OpenCL/inc_vendor.h b/OpenCL/inc_vendor.h index 6ca2c5707..9299caa3f 100644 --- a/OpenCL/inc_vendor.h +++ b/OpenCL/inc_vendor.h @@ -37,10 +37,6 @@ #define KERNEL_FQ __kernel #endif -#ifndef MAYBE_VOLATILE -#define MAYBE_VOLATILE -#endif - #ifndef MAYBE_UNUSED #define MAYBE_UNUSED #endif diff --git a/OpenCL/m10700-pure.cl b/OpenCL/m10700-pure.cl index 901b04a91..94254a0d9 100644 --- a/OpenCL/m10700-pure.cl +++ b/OpenCL/m10700-pure.cl @@ -88,7 +88,7 @@ DECLSPEC u32 sha256_update_aes_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, { u32 ex = 0; - MAYBE_VOLATILE const int pos = ctx->len & 63; + const int pos = ctx->len & 63; ctx->len += len; @@ -261,7 +261,7 @@ DECLSPEC u32 sha384_update_aes_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2 { u32 ex = 0; - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; ctx->len += len; @@ -554,7 +554,7 @@ DECLSPEC u32 sha512_update_aes_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2 { u32 ex = 0; - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; ctx->len += len; diff --git a/OpenCL/m12500-pure.cl b/OpenCL/m12500-pure.cl index 37a113649..315d6f41f 100644 --- a/OpenCL/m12500-pure.cl +++ b/OpenCL/m12500-pure.cl @@ -450,7 +450,9 @@ DECLSPEC void sha1_transform_rar29 (const u32 *w0, const u32 *w1, const u32 *w2, DECLSPEC void sha1_update_64_rar29 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int bytes, u32 *t) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (bytes == 0) return 0; + + const int pos = ctx->len & 63; int len = 64; @@ -583,7 +585,9 @@ DECLSPEC void sha1_update_rar29 (sha1_ctx_t *ctx, u32 *w, const int len) u32 w2[4]; u32 w3[4]; - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; int pos1 = 0; int pos4 = 0; diff --git a/OpenCL/m16400_a0-pure.cl b/OpenCL/m16400_a0-pure.cl index 410f42885..2bdf16a7f 100644 --- a/OpenCL/m16400_a0-pure.cl +++ b/OpenCL/m16400_a0-pure.cl @@ -118,11 +118,9 @@ DECLSPEC void cram_md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, c DECLSPEC void cram_md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - #ifdef IS_AMD - MAYBE_VOLATILE const int pos = ctx->len & 63; - #else - MAYBE_VOLATILE const int pos = ctx->len & 63; - #endif + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; diff --git a/OpenCL/m16400_a1-pure.cl b/OpenCL/m16400_a1-pure.cl index 67c1a2ec8..0953452d2 100644 --- a/OpenCL/m16400_a1-pure.cl +++ b/OpenCL/m16400_a1-pure.cl @@ -116,11 +116,9 @@ DECLSPEC void cram_md5_transform (const u32 *w0, const u32 *w1, const u32 *w2, c DECLSPEC void cram_md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len) { - #ifdef IS_AMD - MAYBE_VOLATILE const int pos = ctx->len & 63; - #else - MAYBE_VOLATILE const int pos = ctx->len & 63; - #endif + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; diff --git a/OpenCL/m16400_a3-pure.cl b/OpenCL/m16400_a3-pure.cl index 59520bbdf..22b6d422c 100644 --- a/OpenCL/m16400_a3-pure.cl +++ b/OpenCL/m16400_a3-pure.cl @@ -116,11 +116,9 @@ DECLSPEC void cram_md5_transform_vector (const u32x *w0, const u32x *w1, const u DECLSPEC void cram_md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len) { - #ifdef IS_AMD - MAYBE_VOLATILE const int pos = ctx->len & 63; - #else - MAYBE_VOLATILE const int pos = ctx->len & 63; - #endif + if (len == 0) return; + + const int pos = ctx->len & 63; ctx->len += len; diff --git a/OpenCL/m19200-pure.cl b/OpenCL/m19200-pure.cl index a856109ed..e0119a294 100644 --- a/OpenCL/m19200-pure.cl +++ b/OpenCL/m19200-pure.cl @@ -27,7 +27,7 @@ typedef struct qnx_sha512_tmp DECLSPEC u32 sha512_update_128_qnxbug (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, u32 *w4, u32 *w5, u32 *w6, u32 *w7, const int len, u32 sav) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; ctx->len += len; @@ -313,7 +313,7 @@ DECLSPEC u32 sha512_update_global_swap_qnxbug (sha512_ctx_t *ctx, GLOBAL_AS cons DECLSPEC void sha512_final_qnxbug (sha512_ctx_t *ctx, u32 sav) { - MAYBE_VOLATILE const int pos = ctx->len & 127; + const int pos = ctx->len & 127; append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3); diff --git a/OpenCL/m23700-pure.cl b/OpenCL/m23700-pure.cl index 980a5e333..48e7c61f6 100644 --- a/OpenCL/m23700-pure.cl +++ b/OpenCL/m23700-pure.cl @@ -558,7 +558,9 @@ DECLSPEC void sha1_transform_rar29 (const u32 *w0, const u32 *w1, const u32 *w2, DECLSPEC void sha1_update_64_rar29 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int bytes, u32 *t) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (bytes == 0) return; + + const int pos = ctx->len & 63; int len = 64; @@ -691,7 +693,9 @@ DECLSPEC void sha1_update_rar29 (sha1_ctx_t *ctx, u32 *w, const int len) u32 w2[4]; u32 w3[4]; - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; int pos1 = 0; int pos4 = 0; diff --git a/OpenCL/m23800-pure.cl b/OpenCL/m23800-pure.cl index 8078a0a58..788c8b558 100644 --- a/OpenCL/m23800-pure.cl +++ b/OpenCL/m23800-pure.cl @@ -469,7 +469,9 @@ DECLSPEC void sha1_transform_rar29 (const u32 *w0, const u32 *w1, const u32 *w2, DECLSPEC void sha1_update_64_rar29 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int bytes, u32 *t) { - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (bytes == 0) return; + + const int pos = ctx->len & 63; int len = 64; @@ -602,7 +604,9 @@ DECLSPEC void sha1_update_rar29 (sha1_ctx_t *ctx, u32 *w, const int len) u32 w2[4]; u32 w3[4]; - MAYBE_VOLATILE const int pos = ctx->len & 63; + if (len == 0) return; + + const int pos = ctx->len & 63; int pos1 = 0; int pos4 = 0;