xref: /onnv-gate/usr/src/uts/common/sys/sha1.h (revision 3825:3d0d37b7e5af)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51694Sdarrenm  * Common Development and Distribution License (the "License").
61694Sdarrenm  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3825Swyllys  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_SHA1_H
270Sstevel@tonic-gate #define	_SYS_SHA1_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/types.h>		/* for uint_* */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
373156Sgirish /*
383156Sgirish  * NOTE: n2rng (Niagara2 RNG driver) accesses the state field of
393156Sgirish  * SHA1_CTX directly.  NEVER change this structure without verifying
403156Sgirish  * compatiblity with n2rng.  The important thing is that the state
413156Sgirish  * must be in a field declared as uint32_t state[5].
423156Sgirish  */
430Sstevel@tonic-gate /* SHA-1 context. */
440Sstevel@tonic-gate typedef struct 	{
450Sstevel@tonic-gate 	uint32_t state[5];	/* state (ABCDE) */
460Sstevel@tonic-gate 	uint32_t count[2];	/* number of bits, modulo 2^64 (msb first) */
470Sstevel@tonic-gate 	union 	{
480Sstevel@tonic-gate 		uint8_t		buf8[64];	/* undigested input */
490Sstevel@tonic-gate 		uint32_t	buf32[16];	/* realigned input */
500Sstevel@tonic-gate 	} buf_un;
510Sstevel@tonic-gate } SHA1_CTX;
520Sstevel@tonic-gate 
53*3825Swyllys #define	SHA1_DIGEST_LENGTH 20
54*3825Swyllys 
550Sstevel@tonic-gate void SHA1Init(SHA1_CTX *);
561694Sdarrenm void SHA1Update(SHA1_CTX *, const void *, size_t);
571694Sdarrenm void SHA1Final(void *, SHA1_CTX *);
580Sstevel@tonic-gate 
590Sstevel@tonic-gate #ifdef	__cplusplus
600Sstevel@tonic-gate }
610Sstevel@tonic-gate #endif
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #endif /* _SYS_SHA1_H */
64