Uprating of the passphrase pixie.
[u/mdw/catacomb] / gmac.h
diff --git a/gmac.h b/gmac.h
index 9471308..9419bbf 100644 (file)
--- a/gmac.h
+++ b/gmac.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: gmac.h,v 1.1 1999/12/10 23:16:01 mdw Exp $
+ * $Id: gmac.h,v 1.4 2004/04/08 01:36:15 mdw Exp $
  *
  * Generic MAC function interface
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: gmac.h,v $
- * Revision 1.1  1999/12/10 23:16:01  mdw
- * Generic interface.
- *
- */
-
 #ifndef CATACOMB_GMAC_H
 #define CATACOMB_GMAC_H
 
 
 #include <stddef.h>
 
+#ifndef CATACOMB_GCIPHER_H
+#  include "gcipher.h"
+#endif
+
 #ifndef CATACOMB_GHASH_H
 #  include "ghash.h"
 #endif
@@ -57,16 +53,36 @@ typedef struct gmac {
 } gmac;
 
 typedef struct gmac_ops {
-  const struct gchash_base *b;         /* Pointer to basic information */
+  const struct gcmac *c;               /* Pointer to MAC class */
   ghash *(*init)(gmac */*m*/);         /* Create keyed hash instance */
   void (*destroy)(gmac */*m*/);                /* Destroy MAC key block */
 } gmac_ops;
 
 typedef struct gcmac {
-  gchash_base b;                       /* Basic information */
+  const char *name;                    /* Name of the MAC function */
+  size_t hashsz;                       /* Size of output hash */
+  const octet *keysz;                  /* Key size options */
   gmac *(*key)(const void */*k*/, size_t /*sz*/); /* Create key */
 } gcmac;
 
+#define GM_KEY(cm, k, ksz)     (cm)->key((k), (ksz))
+#define GM_CLASS(km)           (km)->ops->c
+#define GM_INIT(km)            (km)->ops->init((km))
+#define GM_DESTROY(km)         (km)->ops->destroy((km))
+
+/*----- Tables ------------------------------------------------------------*/
+
+extern const gcmac *const gmactab[];
+
+/* --- @gmac_byname@ --- *
+ *
+ * Arguments:  @const char *p@ = pointer to name string
+ *
+ * Returns:    The named cipher class, or null.
+ */
+
+extern const gcmac *gmac_byname(const char */*p*/);
+
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus