xref: /illumos-gate/usr/src/uts/common/sys/crypto/common.h (revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
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 2007 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	"%Z%%M%	%I%	%E% 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];
50 
51 typedef uint64_t crypto_mech_type_t;
52 
53 typedef struct crypto_mechanism {
54 	crypto_mech_type_t	cm_type;	/* mechanism type */
55 	caddr_t			cm_param;	/* mech. parameter */
56 	size_t			cm_param_len;	/* mech. parameter len */
57 } crypto_mechanism_t;
58 
59 #ifdef  _SYSCALL32
60 
61 typedef struct crypto_mechanism32 {
62 	crypto_mech_type_t	cm_type;	/* mechanism type */
63 	caddr32_t		cm_param;	/* mech. parameter */
64 	size32_t		cm_param_len;   /* mech. parameter len */
65 } crypto_mechanism32_t;
66 
67 #endif  /* _SYSCALL32 */
68 
69 /* CK_AES_CTR_PARAMS provides parameters to the CKM_AES_CTR mechanism */
70 typedef struct CK_AES_CTR_PARAMS {
71 	ulong_t	ulCounterBits;
72 	uint8_t cb[16];
73 } CK_AES_CTR_PARAMS;
74 
75 /* CK_AES_CCM_PARAMS provides parameters to the CKM_AES_CCM mechanism */
76 typedef struct CK_AES_CCM_PARAMS {
77 	ulong_t ulMACSize;
78 	ulong_t ulNonceSize;
79 	ulong_t ulAuthDataSize;
80 	ulong_t ulDataSize; /* used for plaintext or ciphertext */
81 	uchar_t *nonce;
82 	uchar_t *authData;
83 } CK_AES_CCM_PARAMS;
84 
85 
86 #ifdef _KERNEL
87 /*
88  * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
89  * CKM_ECDH1_KEY_DERIVE mechanism
90  */
91 typedef struct CK_ECDH1_DERIVE_PARAMS {
92 	ulong_t		kdf;
93 	ulong_t		ulSharedDataLen;
94 	uchar_t		*pSharedData;
95 	ulong_t		ulPublicDataLen;
96 	uchar_t		*pPublicData;
97 } CK_ECDH1_DERIVE_PARAMS;
98 #endif
99 
100 #ifdef _KERNEL
101 #ifdef  _SYSCALL32
102 
103 /* needed for 32-bit applications running on 64-bit kernels */
104 typedef struct CK_AES_CTR_PARAMS32 {
105 	uint32_t ulCounterBits;
106 	uint8_t cb[16];
107 } CK_AES_CTR_PARAMS32;
108 
109 /* needed for 32-bit applications running on 64-bit kernels */
110 typedef struct CK_AES_CCM_PARAMS32 {
111 	uint32_t ulMACSize;
112 	uint32_t ulNonceSize;
113 	uint32_t ulAuthDataSize;
114 	uint32_t ulDataSize;
115 	caddr32_t nonce;
116 	caddr32_t authData;
117 } CK_AES_CCM_PARAMS32;
118 
119 typedef struct CK_ECDH1_DERIVE_PARAMS32 {
120 	uint32_t	kdf;
121 	uint32_t	ulSharedDataLen;
122 	caddr32_t	pSharedData;
123 	uint32_t	ulPublicDataLen;
124 	caddr32_t	pPublicData;
125 } CK_ECDH1_DERIVE_PARAMS32;
126 
127 #endif  /* _SYSCALL32 */
128 #endif /* _KERNEL */
129 
130 /*
131  * The measurement unit bit flag for a mechanism's minimum or maximum key size.
132  * The unit are mechanism dependant.  It can be in bits or in bytes.
133  */
134 typedef uint32_t crypto_keysize_unit_t;
135 
136 /*
137  * The following bit flags are valid in cm_mech_flags field in
138  * the crypto_mech_info_t structure of the SPI.
139  *
140  * Only the first two bit flags are valid in mi_keysize_unit
141  * field in the crypto_mechanism_info_t structure of the API.
142  */
143 #define	CRYPTO_KEYSIZE_UNIT_IN_BITS	0x00000001
144 #define	CRYPTO_KEYSIZE_UNIT_IN_BYTES	0x00000002
145 #define	CRYPTO_CAN_SHARE_OPSTATE	0x00000004 /* supports sharing */
146 
147 
148 /* Mechanisms supported out-of-the-box */
149 #define	SUN_CKM_MD4			"CKM_MD4"
150 #define	SUN_CKM_MD5			"CKM_MD5"
151 #define	SUN_CKM_MD5_HMAC		"CKM_MD5_HMAC"
152 #define	SUN_CKM_MD5_HMAC_GENERAL	"CKM_MD5_HMAC_GENERAL"
153 #define	SUN_CKM_SHA1			"CKM_SHA_1"
154 #define	SUN_CKM_SHA1_HMAC		"CKM_SHA_1_HMAC"
155 #define	SUN_CKM_SHA1_HMAC_GENERAL	"CKM_SHA_1_HMAC_GENERAL"
156 #define	SUN_CKM_SHA256			"CKM_SHA256"
157 #define	SUN_CKM_SHA256_HMAC		"CKM_SHA256_HMAC"
158 #define	SUN_CKM_SHA256_HMAC_GENERAL	"CKM_SHA256_HMAC_GENERAL"
159 #define	SUN_CKM_SHA384			"CKM_SHA384"
160 #define	SUN_CKM_SHA384_HMAC		"CKM_SHA384_HMAC"
161 #define	SUN_CKM_SHA384_HMAC_GENERAL	"CKM_SHA384_HMAC_GENERAL"
162 #define	SUN_CKM_SHA512			"CKM_SHA512"
163 #define	SUN_CKM_SHA512_HMAC		"CKM_SHA512_HMAC"
164 #define	SUN_CKM_SHA512_HMAC_GENERAL	"CKM_SHA512_HMAC_GENERAL"
165 #define	SUN_CKM_DES_CBC			"CKM_DES_CBC"
166 #define	SUN_CKM_DES3_CBC		"CKM_DES3_CBC"
167 #define	SUN_CKM_DES_ECB			"CKM_DES_ECB"
168 #define	SUN_CKM_DES3_ECB		"CKM_DES3_ECB"
169 #define	SUN_CKM_BLOWFISH_CBC		"CKM_BLOWFISH_CBC"
170 #define	SUN_CKM_BLOWFISH_ECB		"CKM_BLOWFISH_ECB"
171 #define	SUN_CKM_AES_CBC			"CKM_AES_CBC"
172 #define	SUN_CKM_AES_ECB			"CKM_AES_ECB"
173 #define	SUN_CKM_AES_CTR			"CKM_AES_CTR"
174 #define	SUN_CKM_AES_CCM			"CKM_AES_CCM"
175 #define	SUN_CKM_RC4			"CKM_RC4"
176 #define	SUN_CKM_RSA_PKCS		"CKM_RSA_PKCS"
177 #define	SUN_CKM_RSA_X_509		"CKM_RSA_X_509"
178 #define	SUN_CKM_MD5_RSA_PKCS		"CKM_MD5_RSA_PKCS"
179 #define	SUN_CKM_SHA1_RSA_PKCS		"CKM_SHA1_RSA_PKCS"
180 #define	SUN_CKM_SHA256_RSA_PKCS		"CKM_SHA256_RSA_PKCS"
181 #define	SUN_CKM_SHA384_RSA_PKCS		"CKM_SHA384_RSA_PKCS"
182 #define	SUN_CKM_SHA512_RSA_PKCS		"CKM_SHA512_RSA_PKCS"
183 
184 /* Shared operation context format for CKM_RC4 */
185 typedef struct {
186 	uchar_t arr[256];
187 	uchar_t i, j;
188 	uint64_t pad;		/* For 64-bit alignment */
189 } arcfour_state_t;
190 
191 
192 /* Data arguments of cryptographic operations */
193 
194 typedef enum crypto_data_format {
195 	CRYPTO_DATA_RAW = 1,
196 	CRYPTO_DATA_UIO,
197 	CRYPTO_DATA_MBLK
198 } crypto_data_format_t;
199 
200 typedef struct crypto_data {
201 	crypto_data_format_t	cd_format;	/* Format identifier	*/
202 	off_t			cd_offset;	/* Offset from the beginning */
203 	size_t			cd_length;	/* # of bytes in use */
204 	caddr_t			cd_miscdata;	/* ancillary data */
205 	union {
206 		/* Raw format */
207 		iovec_t cdu_raw;		/* Pointer and length	    */
208 
209 		/* uio scatter-gather format */
210 		uio_t	*cdu_uio;
211 
212 		/* mblk scatter-gather format */
213 		mblk_t	*cdu_mp;		/* The mblk chain */
214 
215 	} cdu;	/* Crypto Data Union */
216 } crypto_data_t;
217 
218 #define	cd_raw		cdu.cdu_raw
219 #define	cd_uio		cdu.cdu_uio
220 #define	cd_mp		cdu.cdu_mp
221 
222 typedef struct crypto_dual_data {
223 	crypto_data_t		dd_data;	/* The data */
224 	off_t			dd_offset2;	/* Used by dual operation */
225 	size_t			dd_len2;	/* # of bytes to take	*/
226 } crypto_dual_data_t;
227 
228 #define	dd_format	dd_data.cd_format
229 #define	dd_offset1	dd_data.cd_offset
230 #define	dd_len1		dd_data.cd_length
231 #define	dd_miscdata	dd_data.cd_miscdata
232 #define	dd_raw		dd_data.cd_raw
233 #define	dd_uio		dd_data.cd_uio
234 #define	dd_mp		dd_data.cd_mp
235 
236 /* The keys, and their contents */
237 
238 typedef enum {
239 	CRYPTO_KEY_RAW = 1,	/* ck_data is a cleartext key */
240 	CRYPTO_KEY_REFERENCE,	/* ck_obj_id is an opaque reference */
241 	CRYPTO_KEY_ATTR_LIST	/* ck_attrs is a list of object attributes */
242 } crypto_key_format_t;
243 
244 typedef uint64_t crypto_attr_type_t;
245 
246 /* Attribute types to use for passing a RSA public key or a private key. */
247 #define	SUN_CKA_MODULUS			0x00000120
248 #define	SUN_CKA_MODULUS_BITS		0x00000121
249 #define	SUN_CKA_PUBLIC_EXPONENT		0x00000122
250 #define	SUN_CKA_PRIVATE_EXPONENT	0x00000123
251 #define	SUN_CKA_PRIME_1			0x00000124
252 #define	SUN_CKA_PRIME_2			0x00000125
253 #define	SUN_CKA_EXPONENT_1		0x00000126
254 #define	SUN_CKA_EXPONENT_2		0x00000127
255 #define	SUN_CKA_COEFFICIENT		0x00000128
256 #define	SUN_CKA_PRIME			0x00000130
257 #define	SUN_CKA_SUBPRIME		0x00000131
258 #define	SUN_CKA_BASE			0x00000132
259 
260 typedef uint32_t	crypto_object_id_t;
261 
262 typedef struct crypto_object_attribute {
263 	crypto_attr_type_t	oa_type;	/* attribute type */
264 	caddr_t			oa_value;	/* attribute value */
265 	ssize_t			oa_value_len;	/* length of attribute value */
266 } crypto_object_attribute_t;
267 
268 typedef struct crypto_key {
269 	crypto_key_format_t	ck_format;	/* format identifier */
270 	union {
271 		/* for CRYPTO_KEY_RAW ck_format */
272 		struct {
273 			uint_t	cku_v_length;	/* # of bits in ck_data   */
274 			void	*cku_v_data;	/* ptr to key value */
275 		} cku_key_value;
276 
277 		/* for CRYPTO_KEY_REFERENCE ck_format */
278 		crypto_object_id_t cku_key_id;	/* reference to object key */
279 
280 		/* for CRYPTO_KEY_ATTR_LIST ck_format */
281 		struct {
282 			uint_t cku_a_count;	/* number of attributes */
283 			crypto_object_attribute_t *cku_a_oattr;
284 		} cku_key_attrs;
285 	} cku_data;				/* Crypto Key union */
286 } crypto_key_t;
287 
288 #ifdef  _SYSCALL32
289 
290 typedef struct crypto_object_attribute32 {
291 	uint64_t	oa_type;	/* attribute type */
292 	caddr32_t	oa_value;	/* attribute value */
293 	ssize32_t	oa_value_len;	/* length of attribute value */
294 } crypto_object_attribute32_t;
295 
296 typedef struct crypto_key32 {
297 	crypto_key_format_t	ck_format;	/* format identifier */
298 	union {
299 		/* for CRYPTO_KEY_RAW ck_format */
300 		struct {
301 			uint32_t cku_v_length;	/* # of bytes in ck_data */
302 			caddr32_t cku_v_data;	/* ptr to key value */
303 		} cku_key_value;
304 
305 		/* for CRYPTO_KEY_REFERENCE ck_format */
306 		crypto_object_id_t cku_key_id; /* reference to object key */
307 
308 		/* for CRYPTO_KEY_ATTR_LIST ck_format */
309 		struct {
310 			uint32_t cku_a_count;	/* number of attributes */
311 			caddr32_t cku_a_oattr;
312 		} cku_key_attrs;
313 	} cku_data;				/* Crypto Key union */
314 } crypto_key32_t;
315 
316 #endif  /* _SYSCALL32 */
317 
318 #define	ck_data		cku_data.cku_key_value.cku_v_data
319 #define	ck_length	cku_data.cku_key_value.cku_v_length
320 #define	ck_obj_id	cku_data.cku_key_id
321 #define	ck_count	cku_data.cku_key_attrs.cku_a_count
322 #define	ck_attrs	cku_data.cku_key_attrs.cku_a_oattr
323 
324 /*
325  * Raw key lengths are expressed in number of bits.
326  * The following macro returns the minimum number of
327  * bytes that can contain the specified number of bits.
328  */
329 #define	CRYPTO_BITS2BYTES(n) (((n) + 7) >> 3)
330 
331 /* Providers */
332 
333 typedef enum {
334 	CRYPTO_HW_PROVIDER = 0,
335 	CRYPTO_SW_PROVIDER,
336 	CRYPTO_LOGICAL_PROVIDER
337 } crypto_provider_type_t;
338 
339 typedef uint32_t 	crypto_provider_id_t;
340 #define	KCF_PROVID_INVALID	((uint32_t)-1)
341 
342 typedef struct crypto_provider_entry {
343 	crypto_provider_id_t	pe_provider_id;
344 	uint_t			pe_mechanism_count;
345 } crypto_provider_entry_t;
346 
347 typedef struct crypto_dev_list_entry {
348 	char			le_dev_name[MAXNAMELEN];
349 	uint_t			le_dev_instance;
350 	uint_t			le_mechanism_count;
351 } crypto_dev_list_entry_t;
352 
353 /* User type for authentication ioctls and SPI entry points */
354 
355 typedef enum crypto_user_type {
356 	CRYPTO_SO = 0,
357 	CRYPTO_USER
358 } crypto_user_type_t;
359 
360 /* Version for provider management ioctls and SPI entry points */
361 
362 typedef struct crypto_version {
363 	uchar_t	cv_major;
364 	uchar_t	cv_minor;
365 } crypto_version_t;
366 
367 /* session data structure opaque to the consumer */
368 typedef void *crypto_session_t;
369 
370 /* provider data structure opaque to the consumer */
371 typedef void *crypto_provider_t;
372 
373 /* Limits used by both consumers and providers */
374 #define	CRYPTO_EXT_SIZE_LABEL		32
375 #define	CRYPTO_EXT_SIZE_MANUF		32
376 #define	CRYPTO_EXT_SIZE_MODEL		16
377 #define	CRYPTO_EXT_SIZE_SERIAL		16
378 #define	CRYPTO_EXT_SIZE_TIME		16
379 
380 typedef struct crypto_provider_ext_info {
381 	uchar_t			ei_label[CRYPTO_EXT_SIZE_LABEL];
382 	uchar_t			ei_manufacturerID[CRYPTO_EXT_SIZE_MANUF];
383 	uchar_t			ei_model[CRYPTO_EXT_SIZE_MODEL];
384 	uchar_t			ei_serial_number[CRYPTO_EXT_SIZE_SERIAL];
385 	ulong_t			ei_flags;
386 	ulong_t			ei_max_session_count;
387 	ulong_t			ei_max_pin_len;
388 	ulong_t			ei_min_pin_len;
389 	ulong_t			ei_total_public_memory;
390 	ulong_t			ei_free_public_memory;
391 	ulong_t			ei_total_private_memory;
392 	ulong_t			ei_free_private_memory;
393 	crypto_version_t	ei_hardware_version;
394 	crypto_version_t	ei_firmware_version;
395 	uchar_t			ei_time[CRYPTO_EXT_SIZE_TIME];
396 } crypto_provider_ext_info_t;
397 
398 typedef uint_t		crypto_session_id_t;
399 
400 /*
401  * Common cryptographic status and error codes.
402  */
403 #define	CRYPTO_SUCCESS				0x00000000
404 #define	CRYPTO_CANCEL				0x00000001
405 #define	CRYPTO_HOST_MEMORY			0x00000002
406 #define	CRYPTO_GENERAL_ERROR			0x00000003
407 #define	CRYPTO_FAILED				0x00000004
408 #define	CRYPTO_ARGUMENTS_BAD			0x00000005
409 #define	CRYPTO_ATTRIBUTE_READ_ONLY		0x00000006
410 #define	CRYPTO_ATTRIBUTE_SENSITIVE		0x00000007
411 #define	CRYPTO_ATTRIBUTE_TYPE_INVALID		0x00000008
412 #define	CRYPTO_ATTRIBUTE_VALUE_INVALID		0x00000009
413 #define	CRYPTO_CANCELED				0x0000000A
414 #define	CRYPTO_DATA_INVALID			0x0000000B
415 #define	CRYPTO_DATA_LEN_RANGE			0x0000000C
416 #define	CRYPTO_DEVICE_ERROR			0x0000000D
417 #define	CRYPTO_DEVICE_MEMORY			0x0000000E
418 #define	CRYPTO_DEVICE_REMOVED			0x0000000F
419 #define	CRYPTO_ENCRYPTED_DATA_INVALID		0x00000010
420 #define	CRYPTO_ENCRYPTED_DATA_LEN_RANGE		0x00000011
421 #define	CRYPTO_KEY_HANDLE_INVALID		0x00000012
422 #define	CRYPTO_KEY_SIZE_RANGE			0x00000013
423 #define	CRYPTO_KEY_TYPE_INCONSISTENT		0x00000014
424 #define	CRYPTO_KEY_NOT_NEEDED			0x00000015
425 #define	CRYPTO_KEY_CHANGED			0x00000016
426 #define	CRYPTO_KEY_NEEDED			0x00000017
427 #define	CRYPTO_KEY_INDIGESTIBLE			0x00000018
428 #define	CRYPTO_KEY_FUNCTION_NOT_PERMITTED	0x00000019
429 #define	CRYPTO_KEY_NOT_WRAPPABLE		0x0000001A
430 #define	CRYPTO_KEY_UNEXTRACTABLE		0x0000001B
431 #define	CRYPTO_MECHANISM_INVALID		0x0000001C
432 #define	CRYPTO_MECHANISM_PARAM_INVALID		0x0000001D
433 #define	CRYPTO_OBJECT_HANDLE_INVALID		0x0000001E
434 #define	CRYPTO_OPERATION_IS_ACTIVE		0x0000001F
435 #define	CRYPTO_OPERATION_NOT_INITIALIZED	0x00000020
436 #define	CRYPTO_PIN_INCORRECT			0x00000021
437 #define	CRYPTO_PIN_INVALID			0x00000022
438 #define	CRYPTO_PIN_LEN_RANGE			0x00000023
439 #define	CRYPTO_PIN_EXPIRED			0x00000024
440 #define	CRYPTO_PIN_LOCKED			0x00000025
441 #define	CRYPTO_SESSION_CLOSED			0x00000026
442 #define	CRYPTO_SESSION_COUNT			0x00000027
443 #define	CRYPTO_SESSION_HANDLE_INVALID		0x00000028
444 #define	CRYPTO_SESSION_READ_ONLY		0x00000029
445 #define	CRYPTO_SESSION_EXISTS			0x0000002A
446 #define	CRYPTO_SESSION_READ_ONLY_EXISTS		0x0000002B
447 #define	CRYPTO_SESSION_READ_WRITE_SO_EXISTS	0x0000002C
448 #define	CRYPTO_SIGNATURE_INVALID		0x0000002D
449 #define	CRYPTO_SIGNATURE_LEN_RANGE		0x0000002E
450 #define	CRYPTO_TEMPLATE_INCOMPLETE		0x0000002F
451 #define	CRYPTO_TEMPLATE_INCONSISTENT		0x00000030
452 #define	CRYPTO_UNWRAPPING_KEY_HANDLE_INVALID	0x00000031
453 #define	CRYPTO_UNWRAPPING_KEY_SIZE_RANGE	0x00000032
454 #define	CRYPTO_UNWRAPPING_KEY_TYPE_INCONSISTENT	0x00000033
455 #define	CRYPTO_USER_ALREADY_LOGGED_IN		0x00000034
456 #define	CRYPTO_USER_NOT_LOGGED_IN		0x00000035
457 #define	CRYPTO_USER_PIN_NOT_INITIALIZED		0x00000036
458 #define	CRYPTO_USER_TYPE_INVALID		0x00000037
459 #define	CRYPTO_USER_ANOTHER_ALREADY_LOGGED_IN	0x00000038
460 #define	CRYPTO_USER_TOO_MANY_TYPES		0x00000039
461 #define	CRYPTO_WRAPPED_KEY_INVALID		0x0000003A
462 #define	CRYPTO_WRAPPED_KEY_LEN_RANGE		0x0000003B
463 #define	CRYPTO_WRAPPING_KEY_HANDLE_INVALID	0x0000003C
464 #define	CRYPTO_WRAPPING_KEY_SIZE_RANGE		0x0000003D
465 #define	CRYPTO_WRAPPING_KEY_TYPE_INCONSISTENT	0x0000003E
466 #define	CRYPTO_RANDOM_SEED_NOT_SUPPORTED	0x0000003F
467 #define	CRYPTO_RANDOM_NO_RNG			0x00000040
468 #define	CRYPTO_DOMAIN_PARAMS_INVALID		0x00000041
469 #define	CRYPTO_BUFFER_TOO_SMALL			0x00000042
470 #define	CRYPTO_INFORMATION_SENSITIVE		0x00000043
471 #define	CRYPTO_NOT_SUPPORTED			0x00000044
472 
473 #define	CRYPTO_QUEUED				0x00000045
474 #define	CRYPTO_BUFFER_TOO_BIG			0x00000046
475 #define	CRYPTO_INVALID_CONTEXT			0x00000047
476 #define	CRYPTO_INVALID_MAC			0x00000048
477 #define	CRYPTO_MECH_NOT_SUPPORTED		0x00000049
478 #define	CRYPTO_INCONSISTENT_ATTRIBUTE		0x0000004A
479 #define	CRYPTO_NO_PERMISSION			0x0000004B
480 #define	CRYPTO_INVALID_PROVIDER_ID		0x0000004C
481 #define	CRYPTO_VERSION_MISMATCH			0x0000004D
482 #define	CRYPTO_BUSY				0x0000004E
483 #define	CRYPTO_UNKNOWN_PROVIDER			0x0000004F
484 #define	CRYPTO_MODVERIFICATION_FAILED		0x00000050
485 #define	CRYPTO_OLD_CTX_TEMPLATE			0x00000051
486 #define	CRYPTO_WEAK_KEY				0x00000052
487 
488 /*
489  * Special values that can be used to indicate that information is unavailable
490  * or that there is not practical limit. These values can be used
491  * by fields of the SPI crypto_provider_ext_info(9S) structure.
492  * The value of CRYPTO_UNAVAILABLE_INFO should be the same as
493  * CK_UNAVAILABLE_INFO in the PKCS#11 spec.
494  */
495 #define	CRYPTO_UNAVAILABLE_INFO		((ulong_t)(-1))
496 #define	CRYPTO_EFFECTIVELY_INFINITE	0x0
497 
498 #ifdef __cplusplus
499 }
500 #endif
501 
502 #endif /* _SYS_CRYPTO_COMMON_H */
503