xref: /onnv-gate/usr/src/uts/common/sys/md5.h (revision 4002:d12f36b7c388)
10Sstevel@tonic-gate /*
2*4002Sdarrenm  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate /*
70Sstevel@tonic-gate  * Cleaned up version of the md5.h header file from RFC 1321.
80Sstevel@tonic-gate  */
90Sstevel@tonic-gate 
100Sstevel@tonic-gate /*
110Sstevel@tonic-gate  * MD5.H - header file for MD5C.C
120Sstevel@tonic-gate  */
130Sstevel@tonic-gate 
140Sstevel@tonic-gate /*
150Sstevel@tonic-gate  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
160Sstevel@tonic-gate  * rights reserved.
170Sstevel@tonic-gate  *
180Sstevel@tonic-gate  * License to copy and use this software is granted provided that it
190Sstevel@tonic-gate  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
200Sstevel@tonic-gate  * Algorithm" in all material mentioning or referencing this software
210Sstevel@tonic-gate  * or this function.
220Sstevel@tonic-gate  *
230Sstevel@tonic-gate  * License is also granted to make and use derivative works provided
240Sstevel@tonic-gate  * that such works are identified as "derived from the RSA Data
250Sstevel@tonic-gate  * Security, Inc. MD5 Message-Digest Algorithm" in all material
260Sstevel@tonic-gate  * mentioning or referencing the derived work.
270Sstevel@tonic-gate  *
280Sstevel@tonic-gate  * RSA Data Security, Inc. makes no representations concerning either
290Sstevel@tonic-gate  * the merchantability of this software or the suitability of this
300Sstevel@tonic-gate  * software for any particular purpose. It is provided "as is"
310Sstevel@tonic-gate  * without express or implied warranty of any kind.
320Sstevel@tonic-gate  *
330Sstevel@tonic-gate  * These notices must be retained in any copies of any part of this
340Sstevel@tonic-gate  * documentation and/or software.
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #ifndef _SYS_MD5_H
380Sstevel@tonic-gate #define	_SYS_MD5_H
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #include <sys/types.h>		/* for uint_* */
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /*
450Sstevel@tonic-gate  * Definitions for MD5 hashing functions, conformant to RFC 1321
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #ifdef	__cplusplus
490Sstevel@tonic-gate extern "C" {
500Sstevel@tonic-gate #endif
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #define	MD5_DIGEST_LENGTH	16
530Sstevel@tonic-gate 
540Sstevel@tonic-gate /* MD5 context. */
550Sstevel@tonic-gate typedef struct	{
560Sstevel@tonic-gate 	uint32_t state[4];	/* state (ABCD) */
570Sstevel@tonic-gate 	uint32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
580Sstevel@tonic-gate 	union	{
590Sstevel@tonic-gate 		uint8_t		buf8[64];	/* undigested input */
600Sstevel@tonic-gate 		uint32_t	buf32[16];	/* realigned input */
610Sstevel@tonic-gate 	} buf_un;
620Sstevel@tonic-gate } MD5_CTX;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate void MD5Init(MD5_CTX *);
650Sstevel@tonic-gate void MD5Update(MD5_CTX *, const void *, unsigned int);
66*4002Sdarrenm void MD5Final(void *, MD5_CTX *);
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #ifdef	__cplusplus
690Sstevel@tonic-gate }
700Sstevel@tonic-gate #endif
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #endif /* _SYS_MD5_H */
73