Closed claudioandre-br closed 2 years ago
Ouch. I presume it worked prior to 3238f8f2f?
Ah, no - those formats were disabled then because the old code required SSE 4.1.
Can you try this? I noticed it looked strange for big endian.
diff --git a/src/gost3411-2012-core_plug.c b/src/gost3411-2012-core_plug.c
index 324a93236..231f046b2 100644
--- a/src/gost3411-2012-core_plug.c
+++ b/src/gost3411-2012-core_plug.c
@@ -98,7 +98,7 @@ add512(const uint512_u *x, const uint512_u *y, uint512_u *r)
#else
const unsigned char *xp, *yp;
unsigned char *rp;
- unsigned int i;
+ int i;
int buf;
xp = (const unsigned char *) &x[0];
@@ -106,7 +106,7 @@ add512(const uint512_u *x, const uint512_u *y, uint512_u *r)
rp = (unsigned char *) &r[0];
buf = 0;
- for (i = 0; i < 64; i++)
+ for (i = 63; i >= 0; i--)
{
buf = xp[i] + yp[i] + (buf >> 8);
rp[i] = (unsigned char) buf & 0xFF;
EDIT: Apparently that doesn't matter - this code path works fine for LE either way. I can't understand why - it should end up totally different?! buf
is actually the carry and adding with carry from the other direction shouldn't produce the same result.
EDIT2: Maybe it would make a difference for BE - I'm not sure whether we're supposed to treat all 512 bits as BE, or as 8 64-bit BE words in LE order, or whatever other combinations there are 😵
Last resort fix 😢
diff --git a/src/stribog_fmt_plug.c b/src/stribog_fmt_plug.c
index 047b722a1..9a6dad6b9 100644
--- a/src/stribog_fmt_plug.c
+++ b/src/stribog_fmt_plug.c
@@ -8,6 +8,8 @@
#include "arch.h"
+#if ARCH_LITTLE_ENDIAN
+
#if FMT_EXTERNS_H
extern struct fmt_main fmt_stribog_256;
extern struct fmt_main fmt_stribog_512;
@@ -467,3 +469,13 @@ struct fmt_main fmt_stribog_512 = {
};
#endif /* plugin stanza */
+
+#else
+#if !defined(FMT_EXTERNS_H) && !defined(FMT_REGISTERS_H)
+#ifdef __GNUC__
+#warning Stribog-256 and Stribog-512 formats require little-endian, formats disabled
+#elif _MSC_VER
+#pragma message(": warning Stribog-256 and Stribog-512 formats require little-endian, formats disabled:")
+#endif
+#endif
+#endif /* ARCH_LITTLE_ENDIAN */
Still failing.
So if no other ideas are available, we shoud use the "last resort fix".
:1st_place_medal: :thumbsup: