Silence warnings.
[dragonfly.git] / sys / crypto / md5.h
blob8c3d1e2f20e578f93fd92ac2f2ad22a779f27d00
1 /* $FreeBSD: src/sys/crypto/md5.h,v 1.1.2.1 2000/07/15 07:14:18 kris Exp $ */
2 /* $DragonFly: src/sys/crypto/md5.h,v 1.3 2003/08/27 10:59:04 rob Exp $ */
3 /* $KAME: md5.h,v 1.4 2000/03/27 04:36:22 sumikawa Exp $ */
5 /*
6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7 * All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the project nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #ifndef _NETINET6_MD5_H_
35 #define _NETINET6_MD5_H_
37 #define MD5_BUFLEN 64
39 typedef struct {
40 union {
41 u_int32_t md5_state32[4];
42 u_int8_t md5_state8[16];
43 } md5_st;
45 #define md5_sta md5_st.md5_state32[0]
46 #define md5_stb md5_st.md5_state32[1]
47 #define md5_stc md5_st.md5_state32[2]
48 #define md5_std md5_st.md5_state32[3]
49 #define md5_st8 md5_st.md5_state8
51 union {
52 u_int64_t md5_count64;
53 u_int8_t md5_count8[8];
54 } md5_count;
55 #define md5_n md5_count.md5_count64
56 #define md5_n8 md5_count.md5_count8
58 u_int md5_i;
59 u_int8_t md5_buf[MD5_BUFLEN];
60 } md5_ctxt;
62 extern void md5_init (md5_ctxt *);
63 extern void md5_loop (md5_ctxt *, u_int8_t *, u_int);
64 extern void md5_pad (md5_ctxt *);
65 extern void md5_result (u_int8_t *, md5_ctxt *);
67 /* compatibility */
68 #define MD5_CTX md5_ctxt
69 #define MD5Init(x) md5_init((x))
70 #define MD5Update(x, y, z) md5_loop((x), (y), (z))
71 #define MD5Final(x, y) \
72 do { \
73 md5_pad((y)); \
74 md5_result((x), (y)); \
75 } while (0)
77 #endif /* ! _NETINET6_MD5_H_*/