symm/hmac-def.h: Fix the NMAC and SSLMAC classes. 2.3.x
authorMark Wooding <mdw@distorted.org.uk>
Tue, 4 Jul 2017 16:55:55 +0000 (17:55 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 4 Jul 2017 23:46:05 +0000 (00:46 +0100)
Thanks to GCC 6 for pointing out that many of the necessary bits of
functionality were hanging around unused.  (Why did earlier versions not
spot this?)

It looks like they never worked properly.  I hereby deprecate them, and
intend to remove them in Catacomb 2.5.

symm/hmac-def.h

index 032c69f..893c686 100644 (file)
@@ -231,7 +231,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 {                                                 \
@@ -269,7 +269,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);                                                     \
@@ -278,7 +278,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);                                                     \
@@ -341,10 +341,10 @@ static const ghash_ops gops =                                             \
   { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
 static const gchash gnch = { #pre "-nmac", PRE##_HASHSZ, ghinit };     \
 static const ghash_ops gnops =                                         \
-  { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
+  { &gnch, ghhash, ghdone, ghdestroy, ghcopy };                                \
 static const gchash gsslch = { #pre "-sslmac", PRE##_HASHSZ, ghinit }; \
 static const ghash_ops gsslops =                                       \
-  { &gch, ghhash, ghdone, ghdestroy, ghcopy };                         \
+  { &gsslch, ghhash, ghdone, ghdestroy, ghcopy };                      \
                                                                        \
 HMAC_TEST(PRE, pre)