1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

Get rid of MAYBE_VOLATILE for context position by replacing it with zero length check

This commit is contained in:
Jens Steube 2021-05-09 11:43:32 +02:00
parent e4dab0f1bf
commit 9bf0f36d0a
22 changed files with 138 additions and 88 deletions

View File

@ -9,7 +9,7 @@
#include "inc_common.h" #include "inc_common.h"
#include "inc_hash_blake2b.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); const u64 t0 = hl32_to_64_S (0, len);
@ -86,9 +86,11 @@ DECLSPEC void blake2b_init (blake2b_ctx_t *ctx)
ctx->len = 0; 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) 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; 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 w0[4];
u32 w1[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); 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 w0[4];
u32 w1[4]; u32 w1[4];
@ -457,9 +459,11 @@ DECLSPEC void blake2b_init_vector (blake2b_ctx_vector_t *ctx)
ctx->len = 0; 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) if (pos == 0)
{ {
@ -566,7 +570,7 @@ DECLSPEC void blake2b_update_vector_128 (blake2b_ctx_vector_t *ctx, u32x *w0, u3
ctx->len += len; 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 w0[4];
u32x w1[4]; u32x w1[4];

View File

@ -62,7 +62,7 @@ typedef struct blake2b_ctx
u64 m[16]; // buffer u64 m[16]; // buffer
u64 h[ 8]; // digest u64 h[ 8]; // digest
u32 len; int len;
} blake2b_ctx_t; } blake2b_ctx_t;
@ -71,19 +71,19 @@ typedef struct blake2b_ctx_vector
u64x m[16]; // buffer u64x m[16]; // buffer
u64x h[ 8]; // digest u64x h[ 8]; // digest
u32 len; int len;
} blake2b_ctx_vector_t; } 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_init (blake2b_ctx_t *ctx);
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);
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);
DECLSPEC void blake2b_final (blake2b_ctx_t *ctx); 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_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_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); DECLSPEC void blake2b_final_vector (blake2b_ctx_vector_t *ctx);
#endif // _INC_HASH_BLAKE2B_H #endif // _INC_HASH_BLAKE2B_H

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_8x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x01_4x4_VV (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -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) 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; 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) 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); 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) 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; 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) 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); append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3);

View File

@ -37,10 +37,6 @@
#define KERNEL_FQ __kernel #define KERNEL_FQ __kernel
#endif #endif
#ifndef MAYBE_VOLATILE
#define MAYBE_VOLATILE
#endif
#ifndef MAYBE_UNUSED #ifndef MAYBE_UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif #endif

View File

@ -88,7 +88,7 @@ DECLSPEC u32 sha256_update_aes_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2,
{ {
u32 ex = 0; u32 ex = 0;
MAYBE_VOLATILE const int pos = ctx->len & 63; const int pos = ctx->len & 63;
ctx->len += len; 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; u32 ex = 0;
MAYBE_VOLATILE const int pos = ctx->len & 127; const int pos = ctx->len & 127;
ctx->len += len; 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; u32 ex = 0;
MAYBE_VOLATILE const int pos = ctx->len & 127; const int pos = ctx->len & 127;
ctx->len += len; ctx->len += len;

View File

@ -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) 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; 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 w2[4];
u32 w3[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 pos1 = 0;
int pos4 = 0; int pos4 = 0;

View File

@ -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) DECLSPEC void cram_md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
#ifdef IS_AMD if (len == 0) return;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#else const int pos = ctx->len & 63;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#endif
ctx->len += len; ctx->len += len;

View File

@ -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) DECLSPEC void cram_md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{ {
#ifdef IS_AMD if (len == 0) return;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#else const int pos = ctx->len & 63;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#endif
ctx->len += len; ctx->len += len;

View File

@ -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) 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 if (len == 0) return;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#else const int pos = ctx->len & 63;
MAYBE_VOLATILE const int pos = ctx->len & 63;
#endif
ctx->len += len; ctx->len += len;

View File

@ -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) 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; 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) 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); append_0x80_8x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, pos ^ 3);

View File

@ -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) 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; 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 w2[4];
u32 w3[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 pos1 = 0;
int pos4 = 0; int pos4 = 0;

View File

@ -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) 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; 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 w2[4];
u32 w3[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 pos1 = 0;
int pos4 = 0; int pos4 = 0;