xref: /titanic_50/usr/src/common/crypto/rng/fips_random.h (revision b5a2d8455dfa3190fc977c4bec53e91c99012767)
1fe54a78eSHai-May Chao /*
2fe54a78eSHai-May Chao  * CDDL HEADER START
3fe54a78eSHai-May Chao  *
4fe54a78eSHai-May Chao  * The contents of this file are subject to the terms of the
5fe54a78eSHai-May Chao  * Common Development and Distribution License (the "License").
6fe54a78eSHai-May Chao  * You may not use this file except in compliance with the License.
7fe54a78eSHai-May Chao  *
8fe54a78eSHai-May Chao  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fe54a78eSHai-May Chao  * or http://www.opensolaris.org/os/licensing.
10fe54a78eSHai-May Chao  * See the License for the specific language governing permissions
11fe54a78eSHai-May Chao  * and limitations under the License.
12fe54a78eSHai-May Chao  *
13fe54a78eSHai-May Chao  * When distributing Covered Code, include this CDDL HEADER in each
14fe54a78eSHai-May Chao  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fe54a78eSHai-May Chao  * If applicable, add the following below this CDDL HEADER, with the
16fe54a78eSHai-May Chao  * fields enclosed by brackets "[]" replaced with your own identifying
17fe54a78eSHai-May Chao  * information: Portions Copyright [yyyy] [name of copyright owner]
18fe54a78eSHai-May Chao  *
19fe54a78eSHai-May Chao  * CDDL HEADER END
20fe54a78eSHai-May Chao  */
21fe54a78eSHai-May Chao /*
22*b5a2d845SHai-May Chao  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fe54a78eSHai-May Chao  * Use is subject to license terms.
24fe54a78eSHai-May Chao  */
25fe54a78eSHai-May Chao 
26fe54a78eSHai-May Chao #ifndef	_COMMON_CRYPTO_FIPS_RANDOM_H
27fe54a78eSHai-May Chao #define	_COMMON_CRYPTO_FIPS_RANDOM_H
28fe54a78eSHai-May Chao 
29fe54a78eSHai-May Chao #ifdef	__cplusplus
30fe54a78eSHai-May Chao extern "C" {
31fe54a78eSHai-May Chao #endif
32fe54a78eSHai-May Chao 
33fe54a78eSHai-May Chao #include <sys/types.h>
34fe54a78eSHai-May Chao 
35fe54a78eSHai-May Chao #define	SHA1BLOCKBITS		512
36fe54a78eSHai-May Chao #define	SHA1BLOCKBYTES		(SHA1BLOCKBITS >> 3)
37fe54a78eSHai-May Chao #define	SHA1WORDS		5
38fe54a78eSHai-May Chao #define	BYTES_IN_WORD		4
39fe54a78eSHai-May Chao #define	SHA1BYTES		(BYTES_IN_WORD * SHA1WORDS)
40fe54a78eSHai-May Chao 
41*b5a2d845SHai-May Chao #ifdef _KERNEL
42*b5a2d845SHai-May Chao #define	SHA1_HASH_SIZE		20
43*b5a2d845SHai-May Chao #define	CK_RV			int
44*b5a2d845SHai-May Chao #define	CKR_OK			CRYPTO_SUCCESS
45*b5a2d845SHai-May Chao #define	CKR_DEVICE_ERROR	CRYPTO_DEVICE_ERROR
46*b5a2d845SHai-May Chao #endif
47*b5a2d845SHai-May Chao 
48fe54a78eSHai-May Chao extern void fips_random_inner(uint32_t *, uint32_t *, uint32_t *);
49*b5a2d845SHai-May Chao extern int fips_rng_post(void);
50fe54a78eSHai-May Chao 
51fe54a78eSHai-May Chao #ifdef	__cplusplus
52fe54a78eSHai-May Chao }
53fe54a78eSHai-May Chao #endif
54fe54a78eSHai-May Chao 
55fe54a78eSHai-May Chao #endif	/* _COMMON_CRYPTO_FIPS_RANDOM_H */
56