xref: /haiku/src/libs/compat/openbsd_wlan/crypto/michael.h (revision 97f11716bfaa0f385eb0e28a52bf56a5023b9e99)
1*04171cfcSAugustin Cavalier /*	$OpenBSD: michael.h,v 1.2 2012/12/05 23:20:15 deraadt Exp $	*/
2*04171cfcSAugustin Cavalier 
3*04171cfcSAugustin Cavalier /*
4*04171cfcSAugustin Cavalier  * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
5*04171cfcSAugustin Cavalier  *
6*04171cfcSAugustin Cavalier  * Permission to use, copy, modify, and distribute this software for any
7*04171cfcSAugustin Cavalier  * purpose with or without fee is hereby granted, provided that the above
8*04171cfcSAugustin Cavalier  * copyright notice and this permission notice appear in all copies.
9*04171cfcSAugustin Cavalier  *
10*04171cfcSAugustin Cavalier  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*04171cfcSAugustin Cavalier  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*04171cfcSAugustin Cavalier  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*04171cfcSAugustin Cavalier  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*04171cfcSAugustin Cavalier  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*04171cfcSAugustin Cavalier  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*04171cfcSAugustin Cavalier  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*04171cfcSAugustin Cavalier  */
18*04171cfcSAugustin Cavalier 
19*04171cfcSAugustin Cavalier #ifndef _MICHAEL_H_
20*04171cfcSAugustin Cavalier #define _MICHAEL_H_
21*04171cfcSAugustin Cavalier 
22*04171cfcSAugustin Cavalier #define	MICHAEL_BLOCK_LENGTH		8
23*04171cfcSAugustin Cavalier #define MICHAEL_RAW_BLOCK_LENGTH	4
24*04171cfcSAugustin Cavalier #define	MICHAEL_DIGEST_LENGTH		8
25*04171cfcSAugustin Cavalier 
26*04171cfcSAugustin Cavalier typedef struct michael_context {
27*04171cfcSAugustin Cavalier 	u_int32_t	michael_key[2];
28*04171cfcSAugustin Cavalier 	u_int32_t	michael_l, michael_r;
29*04171cfcSAugustin Cavalier 	u_int32_t	michael_state;
30*04171cfcSAugustin Cavalier 	u_int		michael_count;
31*04171cfcSAugustin Cavalier } MICHAEL_CTX;
32*04171cfcSAugustin Cavalier 
33*04171cfcSAugustin Cavalier __BEGIN_DECLS
34*04171cfcSAugustin Cavalier void	 michael_init(MICHAEL_CTX *);
35*04171cfcSAugustin Cavalier void	 michael_update(MICHAEL_CTX *, const u_int8_t *, u_int)
36*04171cfcSAugustin Cavalier 	    __attribute__((__bounded__(__buffer__, 2, 3)));
37*04171cfcSAugustin Cavalier void	 michael_final(u_int8_t [MICHAEL_DIGEST_LENGTH], MICHAEL_CTX *)
38*04171cfcSAugustin Cavalier 	    __attribute__((__bounded__(__minbytes__, 1,
39*04171cfcSAugustin Cavalier 	    MICHAEL_DIGEST_LENGTH)));
40*04171cfcSAugustin Cavalier void	 michael_key(const u_int8_t *, MICHAEL_CTX *)
41*04171cfcSAugustin Cavalier 	    __attribute__((__bounded__(__minbytes__, 1,
42*04171cfcSAugustin Cavalier 	    MICHAEL_BLOCK_LENGTH)));
43*04171cfcSAugustin Cavalier __END_DECLS
44*04171cfcSAugustin Cavalier 
45*04171cfcSAugustin Cavalier #endif /* _MICHAEL_H_ */
46