Fix some bugs in -m 10800, -m 15400 and -m 18700 in --backend-vector-width mode > 1

pull/2282/head
Jens Steube 4 years ago
parent 7306786eb0
commit cef13008dc

@ -219,7 +219,7 @@ DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u
if (len == 128)
{
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
@ -2089,7 +2089,7 @@ DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x
if (len == 128)
{
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;

@ -128,9 +128,39 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
* Generate a second 64 byte keystream
*/
ctx[12]++;
if (all(ctx[12] == 0)) ctx[13]++;
ctx[12] += 1;
#if VECT_SIZE == 1
if (ctx[12] == 0) ctx[13] += 1;
#endif
#if VECT_SIZE >= 2
if (ctx[12].s0 == 0) ctx[13].s0 += 1;
if (ctx[12].s1 == 0) ctx[13].s1 += 1;
#endif
#if VECT_SIZE >= 4
if (ctx[12].s2 == 0) ctx[13].s2 += 1;
if (ctx[12].s3 == 0) ctx[13].s3 += 1;
#endif
#if VECT_SIZE >= 8
if (ctx[12].s4 == 0) ctx[13].s4 += 1;
if (ctx[12].s5 == 0) ctx[13].s5 += 1;
if (ctx[12].s6 == 0) ctx[13].s6 += 1;
if (ctx[12].s7 == 0) ctx[13].s7 += 1;
#endif
#if VECT_SIZE >= 16
if (ctx[12].s8 == 0) ctx[13].s8 += 1;
if (ctx[12].s9 == 0) ctx[13].s9 += 1;
if (ctx[12].sa == 0) ctx[13].sa += 1;
if (ctx[12].sb == 0) ctx[13].sb += 1;
if (ctx[12].sc == 0) ctx[13].sc += 1;
if (ctx[12].sd == 0) ctx[13].sd += 1;
if (ctx[12].se == 0) ctx[13].se += 1;
if (ctx[12].sf == 0) ctx[13].sf += 1;
#endif
x[16] = ctx[ 0];
x[17] = ctx[ 1];

@ -126,9 +126,39 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
* Generate a second 64 byte keystream
*/
ctx[12]++;
if (all(ctx[12] == 0)) ctx[13]++;
ctx[12] += 1;
#if VECT_SIZE == 1
if (ctx[12] == 0) ctx[13] += 1;
#endif
#if VECT_SIZE >= 2
if (ctx[12].s0 == 0) ctx[13].s0 += 1;
if (ctx[12].s1 == 0) ctx[13].s1 += 1;
#endif
#if VECT_SIZE >= 4
if (ctx[12].s2 == 0) ctx[13].s2 += 1;
if (ctx[12].s3 == 0) ctx[13].s3 += 1;
#endif
#if VECT_SIZE >= 8
if (ctx[12].s4 == 0) ctx[13].s4 += 1;
if (ctx[12].s5 == 0) ctx[13].s5 += 1;
if (ctx[12].s6 == 0) ctx[13].s6 += 1;
if (ctx[12].s7 == 0) ctx[13].s7 += 1;
#endif
#if VECT_SIZE >= 16
if (ctx[12].s8 == 0) ctx[13].s8 += 1;
if (ctx[12].s9 == 0) ctx[13].s9 += 1;
if (ctx[12].sa == 0) ctx[13].sa += 1;
if (ctx[12].sb == 0) ctx[13].sb += 1;
if (ctx[12].sc == 0) ctx[13].sc += 1;
if (ctx[12].sd == 0) ctx[13].sd += 1;
if (ctx[12].se == 0) ctx[13].se += 1;
if (ctx[12].sf == 0) ctx[13].sf += 1;
#endif
x[16] = ctx[ 0];
x[17] = ctx[ 1];

@ -126,9 +126,39 @@ DECLSPEC void chacha20_transform (const u32x *w0, const u32x *w1, const u32 *pos
* Generate a second 64 byte keystream
*/
ctx[12]++;
if (all(ctx[12] == 0)) ctx[13]++;
ctx[12] += 1;
#if VECT_SIZE == 1
if (ctx[12] == 0) ctx[13] += 1;
#endif
#if VECT_SIZE >= 2
if (ctx[12].s0 == 0) ctx[13].s0 += 1;
if (ctx[12].s1 == 0) ctx[13].s1 += 1;
#endif
#if VECT_SIZE >= 4
if (ctx[12].s2 == 0) ctx[13].s2 += 1;
if (ctx[12].s3 == 0) ctx[13].s3 += 1;
#endif
#if VECT_SIZE >= 8
if (ctx[12].s4 == 0) ctx[13].s4 += 1;
if (ctx[12].s5 == 0) ctx[13].s5 += 1;
if (ctx[12].s6 == 0) ctx[13].s6 += 1;
if (ctx[12].s7 == 0) ctx[13].s7 += 1;
#endif
#if VECT_SIZE >= 16
if (ctx[12].s8 == 0) ctx[13].s8 += 1;
if (ctx[12].s9 == 0) ctx[13].s9 += 1;
if (ctx[12].sa == 0) ctx[13].sa += 1;
if (ctx[12].sb == 0) ctx[13].sb += 1;
if (ctx[12].sc == 0) ctx[13].sc += 1;
if (ctx[12].sd == 0) ctx[13].sd += 1;
if (ctx[12].se == 0) ctx[13].se += 1;
if (ctx[12].sf == 0) ctx[13].sf += 1;
#endif
x[16] = ctx[ 0];
x[17] = ctx[ 1];

@ -15,7 +15,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC u32 hashCode_g (const u32 init, GLOBAL_AS u32 *w, const u32 pw_len)
DECLSPEC u32 hashCode_g (const u32 init, GLOBAL_AS const u32 *w, const u32 pw_len)
{
u32 hash = init;

Loading…
Cancel
Save