9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _SYS_CRYPTO_COMMON_H
27 #define _SYS_CRYPTO_COMMON_H
28
29 #pragma ident "@(#)common.h 1.26 08/01/04 SMI"
30
31 /*
32 * Header file for the common data structures of the cryptographic framework
33 */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #include <sys/types.h>
40 #include <sys/uio.h>
41 #include <sys/stream.h>
42 #include <sys/mutex.h>
43 #include <sys/condvar.h>
44
45
46 /* Cryptographic Mechanisms */
47
48 #define CRYPTO_MAX_MECH_NAME 32
49 typedef char crypto_mech_name_t[CRYPTO_MAX_MECH_NAME];
170 #define SUN_CKM_BLOWFISH_CBC "CKM_BLOWFISH_CBC"
171 #define SUN_CKM_BLOWFISH_ECB "CKM_BLOWFISH_ECB"
172 #define SUN_CKM_AES_CBC "CKM_AES_CBC"
173 #define SUN_CKM_AES_ECB "CKM_AES_ECB"
174 #define SUN_CKM_AES_CTR "CKM_AES_CTR"
175 #define SUN_CKM_AES_CCM "CKM_AES_CCM"
176 #define SUN_CKM_RC4 "CKM_RC4"
177 #define SUN_CKM_RSA_PKCS "CKM_RSA_PKCS"
178 #define SUN_CKM_RSA_X_509 "CKM_RSA_X_509"
179 #define SUN_CKM_MD5_RSA_PKCS "CKM_MD5_RSA_PKCS"
180 #define SUN_CKM_SHA1_RSA_PKCS "CKM_SHA1_RSA_PKCS"
181 #define SUN_CKM_SHA256_RSA_PKCS "CKM_SHA256_RSA_PKCS"
182 #define SUN_CKM_SHA384_RSA_PKCS "CKM_SHA384_RSA_PKCS"
183 #define SUN_CKM_SHA512_RSA_PKCS "CKM_SHA512_RSA_PKCS"
184 #define SUN_CKM_EC_KEY_PAIR_GEN "CKM_EC_KEY_PAIR_GEN"
185 #define SUN_CKM_ECDH1_DERIVE "CKM_ECDH1_DERIVE"
186 #define SUN_CKM_ECDSA_SHA1 "CKM_ECDSA_SHA1"
187 #define SUN_CKM_ECDSA "CKM_ECDSA"
188
189 /* Shared operation context format for CKM_RC4 */
190 #if defined(__amd64)
191 typedef uint64_t arcfour_key_int_t;
192 #else
193 typedef uchar_t arcfour_key_int_t;
194 #endif /* __amd64 */
195
196 typedef struct {
197 arcfour_key_int_t arr[256];
198 arcfour_key_int_t i, j;
199 uint64_t pad; /* For 64-bit alignment */
200 } arcfour_state_t;
201
202 /* Data arguments of cryptographic operations */
203
204 typedef enum crypto_data_format {
205 CRYPTO_DATA_RAW = 1,
206 CRYPTO_DATA_UIO,
207 CRYPTO_DATA_MBLK
208 } crypto_data_format_t;
209
210 typedef struct crypto_data {
211 crypto_data_format_t cd_format; /* Format identifier */
212 off_t cd_offset; /* Offset from the beginning */
213 size_t cd_length; /* # of bytes in use */
214 caddr_t cd_miscdata; /* ancillary data */
215 union {
216 /* Raw format */
217 iovec_t cdu_raw; /* Pointer and length */
218
|
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _SYS_CRYPTO_COMMON_H
27 #define _SYS_CRYPTO_COMMON_H
28
29 #pragma ident "@(#)common.h 1.27 08/03/20 SMI"
30
31 /*
32 * Header file for the common data structures of the cryptographic framework
33 */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #include <sys/types.h>
40 #include <sys/uio.h>
41 #include <sys/stream.h>
42 #include <sys/mutex.h>
43 #include <sys/condvar.h>
44
45
46 /* Cryptographic Mechanisms */
47
48 #define CRYPTO_MAX_MECH_NAME 32
49 typedef char crypto_mech_name_t[CRYPTO_MAX_MECH_NAME];
170 #define SUN_CKM_BLOWFISH_CBC "CKM_BLOWFISH_CBC"
171 #define SUN_CKM_BLOWFISH_ECB "CKM_BLOWFISH_ECB"
172 #define SUN_CKM_AES_CBC "CKM_AES_CBC"
173 #define SUN_CKM_AES_ECB "CKM_AES_ECB"
174 #define SUN_CKM_AES_CTR "CKM_AES_CTR"
175 #define SUN_CKM_AES_CCM "CKM_AES_CCM"
176 #define SUN_CKM_RC4 "CKM_RC4"
177 #define SUN_CKM_RSA_PKCS "CKM_RSA_PKCS"
178 #define SUN_CKM_RSA_X_509 "CKM_RSA_X_509"
179 #define SUN_CKM_MD5_RSA_PKCS "CKM_MD5_RSA_PKCS"
180 #define SUN_CKM_SHA1_RSA_PKCS "CKM_SHA1_RSA_PKCS"
181 #define SUN_CKM_SHA256_RSA_PKCS "CKM_SHA256_RSA_PKCS"
182 #define SUN_CKM_SHA384_RSA_PKCS "CKM_SHA384_RSA_PKCS"
183 #define SUN_CKM_SHA512_RSA_PKCS "CKM_SHA512_RSA_PKCS"
184 #define SUN_CKM_EC_KEY_PAIR_GEN "CKM_EC_KEY_PAIR_GEN"
185 #define SUN_CKM_ECDH1_DERIVE "CKM_ECDH1_DERIVE"
186 #define SUN_CKM_ECDSA_SHA1 "CKM_ECDSA_SHA1"
187 #define SUN_CKM_ECDSA "CKM_ECDSA"
188
189 /* Shared operation context format for CKM_RC4 */
190 typedef struct {
191 #if defined(__amd64)
192 uint32_t i, j;
193 uint32_t arr[256];
194 #else
195 uchar_t arr[256];
196 uchar_t i, j;
197 #endif /* __amd64 */
198 uint64_t pad; /* For 64-bit alignment */
199 } arcfour_state_t;
200
201 /* Data arguments of cryptographic operations */
202
203 typedef enum crypto_data_format {
204 CRYPTO_DATA_RAW = 1,
205 CRYPTO_DATA_UIO,
206 CRYPTO_DATA_MBLK
207 } crypto_data_format_t;
208
209 typedef struct crypto_data {
210 crypto_data_format_t cd_format; /* Format identifier */
211 off_t cd_offset; /* Offset from the beginning */
212 size_t cd_length; /* # of bytes in use */
213 caddr_t cd_miscdata; /* ancillary data */
214 union {
215 /* Raw format */
216 iovec_t cdu_raw; /* Pointer and length */
217
|