{ a = TO_LANE(p[i]); XOR_LANE(s->S[i], s->S[i], a); }
}
+/* --- @keccak1600_set@ --- *
+ *
+ * Arguments: @keccak1600_state *s@ = a state to update
+ * @const kludge64 *p@ = pointer to 64-bit words to mix in
+ * @size_t n@ = size of the input, in 64-bit words
+ *
+ * Returns: ---
+ *
+ * Use: Stores data into a %$\Keccak[r, 1600 - r]$% state. Note that
+ * it's the caller's responsibility to pass in no more than
+ * %$r$% bits of data.
+ *
+ * This is not the operation you wanted for ordinary hashing.
+ * It's provided for the use of higher-level protocols which use
+ * duplexing and other fancy sponge features.
+ */
+
+void keccak1600_set(keccak1600_state *s, const kludge64 *p, size_t n)
+{
+ uint32 m = COMPL_MASK;
+ unsigned i;
+ lane a;
+
+ for (i = 0; i < n; i++) {
+ a = TO_LANE(p[i]); if (m&1) NOT_LANE(a, a);
+ s->S[i] = a; m >>= 1;
+ }
+}
+
/* --- @keccak1600_extract@ --- *
*
* Arguments: @const keccak1600_state *s@ = a state to extract output from
#include <stdio.h>
+#include <mLib/macros.h>
#include <mLib/quis.h>
#include <mLib/report.h>
#include <mLib/testrig.h>
keccak1600_p(&u, &u, n);
keccak1600_extract(&u, t, 25);
for (i = 0; i < 25; i++) STORE64_L_(d.buf + 8*i, t[i]);
- if (memcmp(d.buf, v[2].buf, 200) != 0) {
+ if (MEMCMP(d.buf, !=, v[2].buf, 200)) {
ok = 0;
fprintf(stderr, "failed!");
fprintf(stderr, "\n\t input = "); type_hex.dump(&v[0], stderr);