Debian Codegraph @

contrib/mod_sftp/umac.h

raw symbols SCIP
1 /* -----------------------------------------------------------------------
2 *
3 * umac.h -- C Implementation UMAC Message Authentication
4 *
5 * Version 0.93a of rfc4418.txt -- 2006 July 14
6 *
7 * For a full description of UMAC message authentication see the UMAC
8 * world-wide-web page at http://www.cs.ucdavis.edu/~rogaway/umac
9 * Please report bugs and suggestions to the UMAC webpage.
10 *
11 * Copyright (c) 1999-2004 Ted Krovetz
12 *
13 * Permission to use, copy, modify, and distribute this software and
14 * its documentation for any purpose and with or without fee, is hereby
15 * granted provided that the above copyright notice appears in all copies
16 * and in supporting documentation, and that the name of the copyright
17 * holder not be used in advertising or publicity pertaining to
18 * distribution of the software without specific, written prior permission.
19 *
20 * Comments should be directed to Ted Krovetz ([email protected])
21 *
22 * ---------------------------------------------------------------------- */
23
24 /* ////////////////////// IMPORTANT NOTES /////////////////////////////////
25 *
26 * 1) This version does not work properly on messages larger than 16MB
27 *
28 * 2) If you set the switch to use SSE2, then all data must be 16-byte
29 * aligned
30 *
31 * 3) When calling the function umac(), it is assumed that msg is in
32 * a writable buffer of length divisible by 32 bytes. The message itself
33 * does not have to fill the entire buffer, but bytes beyond msg may be
34 * zeroed.
35 *
36 * 4) Two free AES implementations are supported by this implementation of
37 * UMAC. Paulo Barreto's version is in the public domain and can be found
38 * at http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ (search for
39 * "Barreto"). The only two files needed are rijndael-alg-fst.c and
40 * rijndael-alg-fst.h.
41 * Brian Gladman's version is distributed with GNU Public License
42 * and can be found at http://fp.gladman.plus.com/AES/index.htm. It
43 * includes a fast IA-32 assembly version.
44 *
45 /////////////////////////////////////////////////////////////////////// */
46 #ifndef HEADER_UMAC_H
47 #define HEADER_UMAC_H
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 struct umac_ctx *umac_alloc(void);
54 /* Dynamically allocate a umac_ctx struct. */
55
56 struct umac_ctx *umac_new(const unsigned char key[]);
57 /* Dynamically allocate a umac_ctx struct, initialize variables,
58 * generate subkeys from key.
59 */
60
61 void umac_init(struct umac_ctx *ctx, const unsigned char key[]);
62 /* Initialize a previously allocated umac_ctx struct. */
63
64 int umac_reset(struct umac_ctx *ctx);
65 /* Reset a umac_ctx to begin authenticating a new message */
66
67 int umac_update(struct umac_ctx *ctx, const unsigned char *input, long len);
68 /* Incorporate len bytes pointed to by input into context ctx */
69
70 int umac_final(struct umac_ctx *ctx, unsigned char tag[], const unsigned char nonce[8]);
71 /* Incorporate any pending data and the ctr value, and return tag.
72 * This function returns error code if ctr < 0.
73 */
74
75 int umac_delete(struct umac_ctx *ctx);
76 /* Deallocate the context structure */
77
78 /* ProFTPD Note: We reuse umac_ctx for the umac-128 implementation, as the
79 * structure is opaque. We simply recompile the umac.c file with different
80 * preprocessor macros to get the umac-128 implementation.
81 */
82 struct umac_ctx *umac128_alloc(void);
83 struct umac_ctx *umac128_new(const unsigned char key[]);
84 void umac128_init(struct umac_ctx *ctx, const unsigned char key[]);
85 int umac128_reset(struct umac_ctx *ctx);
86 int umac128_update(struct umac_ctx *ctx, const unsigned char *input, long len);
87 int umac128_final(struct umac_ctx *ctx, unsigned char tag[], const unsigned char nonce[8]);
88 int umac128_delete(struct umac_ctx *ctx);
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif /* HEADER_UMAC_H */