xref: /xnu-11215.41.3/libkern/libkern/crypto/md5.h (revision 33de042d024d46de5ff4e89f2471de6608e37fa4)
1 /*
2  * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 
29 /*
30  * MD5.H - header file for MD5.C
31  */
32 
33 /*
34  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
35  * rights reserved.
36  *
37  * License to copy and use this software is granted provided that it
38  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
39  * Algorithm" in all material mentioning or referencing this software
40  * or this function.
41  *
42  * License is also granted to make and use derivative works provided
43  * that such works are identified as "derived from the RSA Data
44  * Security, Inc. MD5 Message-Digest Algorithm" in all material
45  * mentioning or referencing the derived work.
46  *
47  * RSA Data Security, Inc. makes no representations concerning either
48  * the merchantability of this software or the suitability of this
49  * software for any particular purpose. It is provided "as is"
50  * without express or implied warranty of any kind.
51  *
52  * These notices must be retained in any copies of any part of this
53  * documentation and/or software.
54  */
55 
56 #ifndef _CRYPTO_MD5_H_
57 #define _CRYPTO_MD5_H_
58 
59 #if KERNEL
60 #include <sys/types.h>
61 #else /* !KERNEL */
62 #include <machine/types.h>
63 #endif /* KERNEL */
64 #include <sys/cdefs.h>
65 
66 __BEGIN_DECLS
67 
68 #define MD5_DIGEST_LENGTH       16
69 
70 /* MD5 context. */
71 typedef struct {
72 	u_int32_t state[4];     /* state (ABCD) */
73 	u_int32_t count[2];     /* number of bits, modulo 2^64 (lsb first) */
74 	unsigned char buffer[64];       /* input buffer */
75 } MD5_CTX;
76 
77 extern void MD5Init(MD5_CTX *);
78 extern void MD5Update(MD5_CTX *, const void *, unsigned int);
79 extern void MD5Final(unsigned char [MD5_DIGEST_LENGTH], MD5_CTX *);
80 
81 __END_DECLS
82 
83 #endif /* _CRYPTO_MD5_H_ */
84