2 /* $OpenBSD: umac.h,v 1.1 2007/06/07 19:37:34 pvalchev Exp $ */
3 /* -----------------------------------------------------------------------
5 * umac.h -- C Implementation UMAC Message Authentication
7 * Version 0.93a of rfc4418.txt -- 2006 July 14
9 * For a full description of UMAC message authentication see the UMAC
10 * world-wide-web page at http://www.cs.ucdavis.edu/~rogaway/umac
11 * Please report bugs and suggestions to the UMAC webpage.
13 * Copyright (c) 1999-2004 Ted Krovetz
15 * Permission to use, copy, modify, and distribute this software and
16 * its documentation for any purpose and with or without fee, is hereby
17 * granted provided that the above copyright notice appears in all copies
18 * and in supporting documentation, and that the name of the copyright
19 * holder not be used in advertising or publicity pertaining to
20 * distribution of the software without specific, written prior permission.
22 * Comments should be directed to Ted Krovetz (tdk@acm.org)
24 * ---------------------------------------------------------------------- */
26 /* ////////////////////// IMPORTANT NOTES /////////////////////////////////
28 * 1) This version does not work properly on messages larger than 16MB
30 * 2) If you set the switch to use SSE2, then all data must be 16-byte
33 * 3) When calling the function umac(), it is assumed that msg is in
34 * a writable buffer of length divisible by 32 bytes. The message itself
35 * does not have to fill the entire buffer, but bytes beyond msg may be
38 * 4) Two free AES implementations are supported by this implementation of
39 * UMAC. Paulo Barreto's version is in the public domain and can be found
40 * at http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ (search for
41 * "Barreto"). The only two files needed are rijndael-alg-fst.c and
43 * Brian Gladman's version is distributed with GNU Public lisence
44 * and can be found at http://fp.gladman.plus.com/AES/index.htm. It
45 * includes a fast IA-32 assembly version.
47 /////////////////////////////////////////////////////////////////////// */
56 struct umac_ctx
*umac_new(u_char key
[]);
57 /* Dynamically allocate a umac_ctx struct, initialize variables,
58 * generate subkeys from key.
62 int umac_reset(struct umac_ctx
*ctx
);
63 /* Reset a umac_ctx to begin authenicating a new message */
66 int umac_update(struct umac_ctx
*ctx
, u_char
*input
, long len
);
67 /* Incorporate len bytes pointed to by input into context ctx */
69 int umac_final(struct umac_ctx
*ctx
, u_char tag
[], u_char nonce
[8]);
70 /* Incorporate any pending data and the ctr value, and return tag.
71 * This function returns error code if ctr < 0.
74 int umac_delete(struct umac_ctx
*ctx
);
75 /* Deallocate the context structure */
78 int umac(struct umac_ctx
*ctx
, u_char
*input
,
79 long len
, u_char tag
[],
81 /* All-in-one implementation of the functions Reset, Update and Final */
88 typedef struct uhash_ctx
*uhash_ctx_t
;
89 /* The uhash_ctx structure is defined by the implementation of the */
90 /* UHASH functions. */
92 uhash_ctx_t
uhash_alloc(u_char key
[16]);
93 /* Dynamically allocate a uhash_ctx struct and generate subkeys using */
94 /* the kdf and kdf_key passed in. If kdf_key_len is 0 then RC6 is */
95 /* used to generate key with a fixed key. If kdf_key_len > 0 but kdf */
96 /* is NULL then the first 16 bytes pointed at by kdf_key is used as a */
97 /* key for an RC6 based KDF. */
99 int uhash_free(uhash_ctx_t ctx
);
101 int uhash_set_params(uhash_ctx_t ctx
,
104 int uhash_reset(uhash_ctx_t ctx
);
106 int uhash_update(uhash_ctx_t ctx
,
110 int uhash_final(uhash_ctx_t ctx
,
113 int uhash(uhash_ctx_t ctx
,
124 #endif /* HEADER_UMAC_H */