math/mpx-mul4-*.S: Use more portable type syntax for ambiguous instructions.
[catacomb] / symm / whirlpool.c
index ff517ce..f22a366 100644 (file)
@@ -206,7 +206,7 @@ void whirlpool_set(whirlpool_ctx *ctx, const void *buf, unsigned long count)
   }
   ctx->off = 0;
   ctx->nl = U32(count);
-  ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
+  ctx->nh = U32(((count & ~(unsigned long)MASK32) >> 16) >> 16);
 }
 
 /* --- @whirlpool_hash@, @whirlpool256_hash@ --- *
@@ -294,10 +294,31 @@ unsigned long whirlpool_state(whirlpool_ctx *ctx, void *state)
 
 /* --- Generic interface --- */
 
-GHASH_DEF(WHIRLPOOL, whirlpool)
+#define HASHES(_)                                                      \
+  _(WHIRLPOOL, whirlpool)                                              \
+  _(WHIRLPOOL256, whirlpool256)
 
-/* --- Test code --- */
+HASHES(GHASH_DEF)
 
-HASH_TEST(WHIRLPOOL, whirlpool)
+/*----- Test rig ----------------------------------------------------------*/
+
+#ifdef TEST_RIG
+
+#include <mLib/testrig.h>
+
+HASHES(HASH_VERIFY)
+
+static const test_chunk defs[] = {
+  HASHES(HASH_TESTDEFS)
+  { 0, 0, { 0 } }
+};
+
+int main(int argc, char *argv[])
+{
+  test_run(argc, argv, defs, SRCDIR "/t/whirlpool");
+  return (0);
+}
+
+#endif
 
 /*----- That's all, folks -------------------------------------------------*/