xref: /titanic_51/usr/src/uts/common/sys/md5.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Cleaned up version of the md5.h header file from RFC 1321.
29  */
30 
31 /*
32  * MD5.H - header file for MD5C.C
33  */
34 
35 /*
36  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
37  * rights reserved.
38  *
39  * License to copy and use this software is granted provided that it
40  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
41  * Algorithm" in all material mentioning or referencing this software
42  * or this function.
43  *
44  * License is also granted to make and use derivative works provided
45  * that such works are identified as "derived from the RSA Data
46  * Security, Inc. MD5 Message-Digest Algorithm" in all material
47  * mentioning or referencing the derived work.
48  *
49  * RSA Data Security, Inc. makes no representations concerning either
50  * the merchantability of this software or the suitability of this
51  * software for any particular purpose. It is provided "as is"
52  * without express or implied warranty of any kind.
53  *
54  * These notices must be retained in any copies of any part of this
55  * documentation and/or software.
56  */
57 
58 #ifndef _SYS_MD5_H
59 #define	_SYS_MD5_H
60 
61 #pragma ident	"%Z%%M%	%I%	%E% SMI"
62 
63 #include <sys/types.h>		/* for uint_* */
64 
65 /*
66  * Definitions for MD5 hashing functions, conformant to RFC 1321
67  */
68 
69 #ifdef	__cplusplus
70 extern "C" {
71 #endif
72 
73 #define	MD5_DIGEST_LENGTH	16
74 
75 /* MD5 context. */
76 typedef struct	{
77 	uint32_t state[4];	/* state (ABCD) */
78 	uint32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
79 	union	{
80 		uint8_t		buf8[64];	/* undigested input */
81 		uint32_t	buf32[16];	/* realigned input */
82 	} buf_un;
83 } MD5_CTX;
84 
85 void MD5Init(MD5_CTX *);
86 void MD5Update(MD5_CTX *, const void *, unsigned int);
87 void MD5Final(unsigned char [MD5_DIGEST_LENGTH], MD5_CTX *);
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif /* _SYS_MD5_H */
94