math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / symm / gmac.h
CommitLineData
aa1082f2 1/* -*-c-*-
2 *
aa1082f2 3 * Generic MAC function interface
4 *
5 * (c) 1999 Straylight/Edgeware
6 */
7
45c0fd36 8/*----- Licensing notice --------------------------------------------------*
aa1082f2 9 *
10 * This file is part of Catacomb.
11 *
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.
45c0fd36 16 *
aa1082f2 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.
45c0fd36 21 *
aa1082f2 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,
25 * MA 02111-1307, USA.
26 */
27
aa1082f2 28#ifndef CATACOMB_GMAC_H
29#define CATACOMB_GMAC_H
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
35/*----- Header files ------------------------------------------------------*/
36
37#include <stddef.h>
38
05555229 39#ifndef CATACOMB_GCIPHER_H
40# include "gcipher.h"
41#endif
42
aa1082f2 43#ifndef CATACOMB_GHASH_H
44# include "ghash.h"
45#endif
46
47/*----- Generic MAC function interface ------------------------------------*/
48
49typedef struct gmac {
50 const struct gmac_ops *ops; /* Pointer to MAC operations */
51} gmac;
52
53typedef struct gmac_ops {
05555229 54 const struct gcmac *c; /* Pointer to MAC class */
aa1082f2 55 ghash *(*init)(gmac */*m*/); /* Create keyed hash instance */
56 void (*destroy)(gmac */*m*/); /* Destroy MAC key block */
57} gmac_ops;
58
59typedef struct gcmac {
05555229 60 const char *name; /* Name of the MAC function */
61 size_t hashsz; /* Size of output hash */
62 const octet *keysz; /* Key size options */
aa1082f2 63 gmac *(*key)(const void */*k*/, size_t /*sz*/); /* Create key */
64} gcmac;
65
59919ae4 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))
70
71/*----- Tables ------------------------------------------------------------*/
72
73extern const gcmac *const gmactab[];
74
75/* --- @gmac_byname@ --- *
76 *
77 * Arguments: @const char *p@ = pointer to name string
78 *
79 * Returns: The named cipher class, or null.
80 */
81
82extern const gcmac *gmac_byname(const char */*p*/);
83
aa1082f2 84/*----- That's all, folks -------------------------------------------------*/
85
86#ifdef __cplusplus
87 }
88#endif
89
90#endif