xref: /illumos-gate/usr/src/uts/common/sys/md5.h (revision fafb665d)
17c478bd9Sstevel@tonic-gate /*
2*5151fb12Sdarrenm  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate  * Cleaned up version of the md5.h header file from RFC 1321.
87c478bd9Sstevel@tonic-gate  */
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate /*
117c478bd9Sstevel@tonic-gate  * MD5.H - header file for MD5C.C
127c478bd9Sstevel@tonic-gate  */
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate /*
157c478bd9Sstevel@tonic-gate  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
167c478bd9Sstevel@tonic-gate  * rights reserved.
177c478bd9Sstevel@tonic-gate  *
187c478bd9Sstevel@tonic-gate  * License to copy and use this software is granted provided that it
197c478bd9Sstevel@tonic-gate  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
207c478bd9Sstevel@tonic-gate  * Algorithm" in all material mentioning or referencing this software
217c478bd9Sstevel@tonic-gate  * or this function.
227c478bd9Sstevel@tonic-gate  *
237c478bd9Sstevel@tonic-gate  * License is also granted to make and use derivative works provided
247c478bd9Sstevel@tonic-gate  * that such works are identified as "derived from the RSA Data
257c478bd9Sstevel@tonic-gate  * Security, Inc. MD5 Message-Digest Algorithm" in all material
267c478bd9Sstevel@tonic-gate  * mentioning or referencing the derived work.
277c478bd9Sstevel@tonic-gate  *
287c478bd9Sstevel@tonic-gate  * RSA Data Security, Inc. makes no representations concerning either
297c478bd9Sstevel@tonic-gate  * the merchantability of this software or the suitability of this
307c478bd9Sstevel@tonic-gate  * software for any particular purpose. It is provided "as is"
317c478bd9Sstevel@tonic-gate  * without express or implied warranty of any kind.
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  * These notices must be retained in any copies of any part of this
347c478bd9Sstevel@tonic-gate  * documentation and/or software.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifndef _SYS_MD5_H
387c478bd9Sstevel@tonic-gate #define	_SYS_MD5_H
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #include <sys/types.h>		/* for uint_* */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Definitions for MD5 hashing functions, conformant to RFC 1321
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
477c478bd9Sstevel@tonic-gate extern "C" {
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #define	MD5_DIGEST_LENGTH	16
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /* MD5 context. */
537c478bd9Sstevel@tonic-gate typedef struct	{
547c478bd9Sstevel@tonic-gate 	uint32_t state[4];	/* state (ABCD) */
557c478bd9Sstevel@tonic-gate 	uint32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
567c478bd9Sstevel@tonic-gate 	union	{
577c478bd9Sstevel@tonic-gate 		uint8_t		buf8[64];	/* undigested input */
587c478bd9Sstevel@tonic-gate 		uint32_t	buf32[16];	/* realigned input */
597c478bd9Sstevel@tonic-gate 	} buf_un;
607c478bd9Sstevel@tonic-gate } MD5_CTX;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate void MD5Init(MD5_CTX *);
637c478bd9Sstevel@tonic-gate void MD5Update(MD5_CTX *, const void *, unsigned int);
64*5151fb12Sdarrenm void MD5Final(void *, MD5_CTX *);
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
677c478bd9Sstevel@tonic-gate }
687c478bd9Sstevel@tonic-gate #endif
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #endif /* _SYS_MD5_H */
71