~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
math/mpx-mul4-*.S: Fix up some of the commentary.
[catacomb]
/
symm
/
sha3.c
diff --git
a/symm/sha3.c
b/symm/sha3.c
index
97b41e3
..
36bd430
100644
(file)
--- a/
symm/sha3.c
+++ b/
symm/sha3.c
@@
-231,7
+231,7
@@
static void leftenc_sz(shake_ctx *ctx, size_t n)
octet b[9];
unsigned i;
octet b[9];
unsigned i;
- SET64(t, ((n&~MASK32) >> 16) >> 16, n&MASK32);
+ SET64(t, ((n&~
(size_t)
MASK32) >> 16) >> 16, n&MASK32);
STORE64_B_(b + 1, t);
for (i = 1; i < 8 && !b[i]; i++);
i--; b[i] = 8 - i;
STORE64_B_(b + 1, t);
for (i = 1; i < 8 && !b[i]; i++);
i--; b[i] = 8 - i;
@@
-244,7
+244,7
@@
static void rightenc_sz(shake_ctx *ctx, size_t n)
octet b[9];
unsigned i;
octet b[9];
unsigned i;
- SET64(t, ((n&~MASK32) >> 16) >> 16, n&MASK32);
+ SET64(t, ((n&~
(size_t)
MASK32) >> 16) >> 16, n&MASK32);
STORE64_B_(b, t);
for (i = 0; i < 7 && !b[i]; i++);
b[8] = 8 - i;
STORE64_B_(b, t);
for (i = 0; i < 7 && !b[i]; i++);
b[8] = 8 - i;
@@
-563,7
+563,7
@@
static gcipher *shake128_gcinit(const void *k, size_t sz)
static gcipher *shake256_gcinit(const void *k, size_t sz)
{
shake_gcctx *cc = S_CREATE(shake_gcctx);
static gcipher *shake256_gcinit(const void *k, size_t sz)
{
shake_gcctx *cc = S_CREATE(shake_gcctx);
- cc->gc.ops = &shake
128
_gcops;
+ cc->gc.ops = &shake
256
_gcops;
shake256_init(&cc->c); shake_hash(&cc->c, k, sz); shake_xof(&cc->c);
return (&cc->gc);
}
shake256_init(&cc->c); shake_hash(&cc->c, k, sz); shake_xof(&cc->c);
return (&cc->gc);
}
@@
-957,6
+957,7
@@
grand *kmac256_rand(const void *perso, size_t psz, const void *k, size_t sz)
#include <stdio.h>
#include <stdio.h>
+#include <mLib/macros.h>
#include <mLib/report.h>
#include <mLib/testrig.h>
#include <mLib/report.h>
#include <mLib/testrig.h>
@@
-979,7
+980,7
@@
static int vrf_sha3_mct(void (*initfn)(sha3_ctx *),
sha3_done(&ctx, d.buf);
}
sha3_done(&ctx, d.buf);
}
- if (
memcmp(d.buf, out->buf, out->len) != 0
) {
+ if (
MEMCMP(d.buf, !=, out->buf, out->len)
) {
ok = 0;
printf("\nfail\n\tsteps = %d\n\tinput = ", n);
type_hex.dump(in, stdout);
ok = 0;
printf("\nfail\n\tsteps = %d\n\tinput = ", n);
type_hex.dump(in, stdout);
@@
-1037,7
+1038,7
@@
static int vrf_shaky(void (*initfn)(shake_ctx *,
p += i; sz -= i;
}
p += i; sz -= i;
}
- if (
memcmp(d.buf, want->buf, want->len) != 0
) {
+ if (
MEMCMP(d.buf, !=, want->buf, want->len)
) {
ok = 0;
printf("\nfail (get):\n\tstep = %i\n\tinput = ", *ip);
type_hex.dump(m, stdout);
ok = 0;
printf("\nfail (get):\n\tstep = %i\n\tinput = ", *ip);
type_hex.dump(m, stdout);
@@
-1071,7
+1072,7
@@
static int vrf_shaky(void (*initfn)(shake_ctx *,
p += i; sz -= i;
}
p += i; sz -= i;
}
- if (
memcmp(d.buf, want->buf, want->len) != 0
) {
+ if (
MEMCMP(d.buf, !=, want->buf, want->len)
) {
ok = 0;
printf("\nfail (mask):\n\tstep = %i\n\tinput = ", *ip);
type_hex.dump(m, stdout);
ok = 0;
printf("\nfail (mask):\n\tstep = %i\n\tinput = ", *ip);
type_hex.dump(m, stdout);
@@
-1131,7
+1132,7
@@
static int vrf_kmac(void (*initfn)(kmac_ctx *, const void *, size_t,
if (tsz) kmac_done(&ctx, d.buf, tsz);
else { kmac_xof(&ctx); kmac_get(&ctx, d.buf, d.len); }
if (tsz) kmac_done(&ctx, d.buf, tsz);
else { kmac_xof(&ctx); kmac_get(&ctx, d.buf, d.len); }
- if (
memcmp(d.buf, want->buf, want->len) != 0
) {
+ if (
MEMCMP(d.buf, !=, want->buf, want->len)
) {
ok = 0;
printf("\nfail");
printf("\n\tperso = `%s'", perso->buf);
ok = 0;
printf("\nfail");
printf("\n\tperso = `%s'", perso->buf);