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