3 * Generic MAC function interface
5 * (c) 1999 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
12 * Catacomb is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * Catacomb is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with Catacomb; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 #ifndef CATACOMB_GMAC_H
29 #define CATACOMB_GMAC_H
35 /*----- Header files ------------------------------------------------------*/
39 #ifndef CATACOMB_GCIPHER_H
43 #ifndef CATACOMB_GHASH_H
47 /*----- Generic MAC function interface ------------------------------------*/
50 const struct gmac_ops *ops; /* Pointer to MAC operations */
53 typedef struct gmac_ops {
54 const struct gcmac *c; /* Pointer to MAC class */
55 ghash *(*init)(gmac */*m*/); /* Create keyed hash instance */
56 void (*destroy)(gmac */*m*/); /* Destroy MAC key block */
59 typedef struct gcmac {
60 const char *name; /* Name of the MAC function */
61 size_t hashsz; /* Size of output hash */
62 const octet *keysz; /* Key size options */
63 gmac *(*key)(const void */*k*/, size_t /*sz*/); /* Create key */
66 #define GM_KEY(cm, k, ksz) (cm)->key((k), (ksz))
67 #define GM_CLASS(km) (km)->ops->c
68 #define GM_INIT(km) (km)->ops->init((km))
69 #define GM_DESTROY(km) (km)->ops->destroy((km))
71 /*----- Tables ------------------------------------------------------------*/
73 extern const gcmac *const gmactab[];
75 /* --- @gmac_byname@ --- *
77 * Arguments: @const char *p@ = pointer to name string
79 * Returns: The named cipher class, or null.
82 extern const gcmac *gmac_byname(const char */*p*/);
84 /*----- That's all, folks -------------------------------------------------*/