symm/t/poly1305: Spell Dan Bernstein's name correctly.
[catacomb] / symm / hmac-def.h
index e639b8c..9ac8fb9 100644 (file)
 /* --- Useful constants --- */                                         \
                                                                        \
 const octet pre##_hmackeysz[] =                                                \
-  { KSZ_ANY | KSZ_16BIT, PRE##_STATESZ/256, PRE##_STATESZ%256 };       \
+  { KSZ_ANY | KSZ_16BIT, PRE##_HASHSZ/256, PRE##_HASHSZ%256 };         \
 const octet pre##_sslmackeysz[] =                                      \
-  { KSZ_ANY | KSZ_16BIT, PRE##_STATESZ/256, PRE##_STATESZ%256 };       \
+  { KSZ_ANY | KSZ_16BIT, PRE##_HASHSZ/256, PRE##_HASHSZ%256 };         \
 const octet pre##_nmackeysz[] =                                                \
-  { KSZ_SET | KSZ_16BIT,                                               \
-    2*PRE##_STATESZ/256, 2*PRE##_STATESZ%256, 0, 0 };                  \
+  { KSZ_SET | KSZ_16BIT, 2*PRE##_HASHSZ/256, 2*PRE##_HASHSZ%256, 0, 0 }; \
                                                                        \
 /* --- @pre_nmacinit@ --- *                                            \
  *                                                                     \
@@ -208,9 +207,7 @@ void pre##_macinit(pre##_macctx *ctx, const pre##_mackey *key)              \
  */                                                                    \
                                                                        \
 void pre##_machash(pre##_macctx *ctx, const void *buf, size_t sz)      \
-{                                                                      \
-  pre##_hash(&ctx->ctx, buf, sz);                                      \
-}                                                                      \
+  { pre##_hash(&ctx->ctx, buf, sz); }                                  \
                                                                        \
 /* --- @pre_macdone@ --- *                                             \
  *                                                                     \
@@ -232,7 +229,7 @@ void pre##_macdone(pre##_macctx *ctx, void *mac)                    \
                                                                        \
 /* --- Generic MAC interface --- */                                    \
                                                                        \
-static const gmac_ops gkops;                                           \
+static const gmac_ops gkops, gnkops, gsslkops;                         \
 static const ghash_ops gops, gnops, gsslops;                           \
                                                                        \
 typedef struct gkctx {                                                 \
@@ -270,7 +267,7 @@ static gmac *gnkey(const void *k, size_t sz)                                \
   gkctx *gk = S_CREATE(gkctx);                                         \
   const octet *kk = k;                                                 \
   assert(keysz(sz, pre##_nmackeysz) == sz);                            \
-  gk->m.ops = &gkops;                                                  \
+  gk->m.ops = &gnkops;                                                 \
   gk->gops = &gnops;                                                   \
   pre##_nmacinit(&gk->k, kk, kk + PRE##_STATESZ);                      \
   return (&gk->m);                                                     \
@@ -279,7 +276,7 @@ static gmac *gnkey(const void *k, size_t sz)                                \
 static gmac *gsslkey(const void *k, size_t sz)                         \
 {                                                                      \
   gkctx *gk = S_CREATE(gkctx);                                         \
-  gk->m.ops = &gkops;                                                  \
+  gk->m.ops = &gsslkops;                                               \
   gk->gops = &gsslops;                                                 \
   pre##_sslmacinit(&gk->k, k, sz);                                     \
   return (&gk->m);                                                     \
@@ -342,10 +339,10 @@ static const ghash_ops gops =                                             \
   { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
 static const gchash gnch = { name "-nmac", PRE##_HASHSZ, ghinit };     \
 static const ghash_ops gnops =                                         \
-  { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
+  { &gnch, ghhash, ghdone, ghdestroy, ghcopy };                                \
 static const gchash gsslch = { name "-sslmac", PRE##_HASHSZ, ghinit }; \
 static const ghash_ops gsslops =                                       \
-  { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
+  { &gsslch, ghhash, ghdone, ghdestroy, ghcopy };                      \
                                                                        \
 HMAC_TESTX(PRE, pre, name, fname)