5869 Need AES CMAC support in KCF+PKCS11
[unleashed.git] / usr / src / uts / common / sys / crypto / common.h
blobc20ff8239b52fcdf50aa8cad74d88f6f878d90c8
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright 2013 Saso Kiselkov. All rights reserved.
28 #ifndef _SYS_CRYPTO_COMMON_H
29 #define _SYS_CRYPTO_COMMON_H
32 * Header file for the common data structures of the cryptographic framework
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
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>
46 /* Cryptographic Mechanisms */
48 #define CRYPTO_MAX_MECH_NAME 32
49 typedef char crypto_mech_name_t[CRYPTO_MAX_MECH_NAME];
51 typedef uint64_t crypto_mech_type_t;
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;
59 #ifdef _SYSCALL32
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;
67 #endif /* _SYSCALL32 */
69 #ifdef _KERNEL
70 /* CK_AES_CTR_PARAMS provides parameters to the CKM_AES_CTR mechanism */
71 typedef struct CK_AES_CTR_PARAMS {
72 ulong_t ulCounterBits;
73 uint8_t cb[16];
74 } CK_AES_CTR_PARAMS;
75 #endif
77 /* CK_AES_CCM_PARAMS provides parameters to the CKM_AES_CCM mechanism */
78 typedef struct CK_AES_CCM_PARAMS {
79 ulong_t ulMACSize;
80 ulong_t ulNonceSize;
81 ulong_t ulAuthDataSize;
82 ulong_t ulDataSize; /* used for plaintext or ciphertext */
83 uchar_t *nonce;
84 uchar_t *authData;
85 } CK_AES_CCM_PARAMS;
87 /* CK_AES_GCM_PARAMS provides parameters to the CKM_AES_GCM mechanism */
88 typedef struct CK_AES_GCM_PARAMS {
89 uchar_t *pIv;
90 ulong_t ulIvLen;
91 ulong_t ulIvBits;
92 uchar_t *pAAD;
93 ulong_t ulAADLen;
94 ulong_t ulTagBits;
95 } CK_AES_GCM_PARAMS;
97 /* CK_AES_GMAC_PARAMS provides parameters to the CKM_AES_GMAC mechanism */
98 typedef struct CK_AES_GMAC_PARAMS {
99 uchar_t *pIv;
100 uchar_t *pAAD;
101 ulong_t ulAADLen;
102 } CK_AES_GMAC_PARAMS;
104 #ifdef _KERNEL
106 * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
107 * CKM_ECDH1_KEY_DERIVE mechanism
109 typedef struct CK_ECDH1_DERIVE_PARAMS {
110 ulong_t kdf;
111 ulong_t ulSharedDataLen;
112 uchar_t *pSharedData;
113 ulong_t ulPublicDataLen;
114 uchar_t *pPublicData;
115 } CK_ECDH1_DERIVE_PARAMS;
116 #endif
118 #ifdef _KERNEL
119 #ifdef _SYSCALL32
121 /* needed for 32-bit applications running on 64-bit kernels */
122 typedef struct CK_AES_CTR_PARAMS32 {
123 uint32_t ulCounterBits;
124 uint8_t cb[16];
125 } CK_AES_CTR_PARAMS32;
127 /* needed for 32-bit applications running on 64-bit kernels */
128 typedef struct CK_AES_CCM_PARAMS32 {
129 uint32_t ulMACSize;
130 uint32_t ulNonceSize;
131 uint32_t ulAuthDataSize;
132 uint32_t ulDataSize;
133 caddr32_t nonce;
134 caddr32_t authData;
135 } CK_AES_CCM_PARAMS32;
137 /* needed for 32-bit applications running on 64-bit kernels */
138 typedef struct CK_AES_GCM_PARAMS32 {
139 caddr32_t pIv;
140 uint32_t ulIvLen;
141 uint32_t ulIvBits;
142 caddr32_t pAAD;
143 uint32_t ulAADLen;
144 uint32_t ulTagBits;
145 } CK_AES_GCM_PARAMS32;
147 /* needed for 32-bit applications running on 64-bit kernels */
148 typedef struct CK_AES_GMAC_PARAMS32 {
149 caddr32_t pIv;
150 caddr32_t pAAD;
151 uint32_t ulAADLen;
152 } CK_AES_GMAC_PARAMS32;
154 typedef struct CK_ECDH1_DERIVE_PARAMS32 {
155 uint32_t kdf;
156 uint32_t ulSharedDataLen;
157 caddr32_t pSharedData;
158 uint32_t ulPublicDataLen;
159 caddr32_t pPublicData;
160 } CK_ECDH1_DERIVE_PARAMS32;
162 #endif /* _SYSCALL32 */
163 #endif /* _KERNEL */
166 * The measurement unit bit flag for a mechanism's minimum or maximum key size.
167 * The unit are mechanism dependent. It can be in bits or in bytes.
169 typedef uint32_t crypto_keysize_unit_t;
172 * The following bit flags are valid in cm_mech_flags field in
173 * the crypto_mech_info_t structure of the SPI.
175 * Only the first two bit flags are valid in mi_keysize_unit
176 * field in the crypto_mechanism_info_t structure of the API.
178 #define CRYPTO_KEYSIZE_UNIT_IN_BITS 0x00000001
179 #define CRYPTO_KEYSIZE_UNIT_IN_BYTES 0x00000002
180 #define CRYPTO_CAN_SHARE_OPSTATE 0x00000004 /* supports sharing */
183 /* Mechanisms supported out-of-the-box */
184 #define SUN_CKM_MD4 "CKM_MD4"
185 #define SUN_CKM_MD5 "CKM_MD5"
186 #define SUN_CKM_MD5_HMAC "CKM_MD5_HMAC"
187 #define SUN_CKM_MD5_HMAC_GENERAL "CKM_MD5_HMAC_GENERAL"
188 #define SUN_CKM_SHA1 "CKM_SHA_1"
189 #define SUN_CKM_SHA1_HMAC "CKM_SHA_1_HMAC"
190 #define SUN_CKM_SHA1_HMAC_GENERAL "CKM_SHA_1_HMAC_GENERAL"
191 #define SUN_CKM_SHA256 "CKM_SHA256"
192 #define SUN_CKM_SHA256_HMAC "CKM_SHA256_HMAC"
193 #define SUN_CKM_SHA256_HMAC_GENERAL "CKM_SHA256_HMAC_GENERAL"
194 #define SUN_CKM_SHA384 "CKM_SHA384"
195 #define SUN_CKM_SHA384_HMAC "CKM_SHA384_HMAC"
196 #define SUN_CKM_SHA384_HMAC_GENERAL "CKM_SHA384_HMAC_GENERAL"
197 #define SUN_CKM_SHA512 "CKM_SHA512"
198 #define SUN_CKM_SHA512_HMAC "CKM_SHA512_HMAC"
199 #define SUN_CKM_SHA512_HMAC_GENERAL "CKM_SHA512_HMAC_GENERAL"
200 #define SUN_CKM_SHA512_224 "CKM_SHA512_224"
201 #define SUN_CKM_SHA512_256 "CKM_SHA512_256"
202 #define SUN_CKM_DES_CBC "CKM_DES_CBC"
203 #define SUN_CKM_DES3_CBC "CKM_DES3_CBC"
204 #define SUN_CKM_DES_ECB "CKM_DES_ECB"
205 #define SUN_CKM_DES3_ECB "CKM_DES3_ECB"
206 #define SUN_CKM_BLOWFISH_CBC "CKM_BLOWFISH_CBC"
207 #define SUN_CKM_BLOWFISH_ECB "CKM_BLOWFISH_ECB"
208 #define SUN_CKM_AES_CBC "CKM_AES_CBC"
209 #define SUN_CKM_AES_CMAC "CKM_AES_CMAC"
210 #define SUN_CKM_AES_ECB "CKM_AES_ECB"
211 #define SUN_CKM_AES_CTR "CKM_AES_CTR"
212 #define SUN_CKM_AES_CCM "CKM_AES_CCM"
213 #define SUN_CKM_AES_GCM "CKM_AES_GCM"
214 #define SUN_CKM_AES_GMAC "CKM_AES_GMAC"
215 #define SUN_CKM_AES_CFB128 "CKM_AES_CFB128"
216 #define SUN_CKM_RC4 "CKM_RC4"
217 #define SUN_CKM_RSA_PKCS "CKM_RSA_PKCS"
218 #define SUN_CKM_RSA_X_509 "CKM_RSA_X_509"
219 #define SUN_CKM_MD5_RSA_PKCS "CKM_MD5_RSA_PKCS"
220 #define SUN_CKM_SHA1_RSA_PKCS "CKM_SHA1_RSA_PKCS"
221 #define SUN_CKM_SHA256_RSA_PKCS "CKM_SHA256_RSA_PKCS"
222 #define SUN_CKM_SHA384_RSA_PKCS "CKM_SHA384_RSA_PKCS"
223 #define SUN_CKM_SHA512_RSA_PKCS "CKM_SHA512_RSA_PKCS"
224 #define SUN_CKM_EC_KEY_PAIR_GEN "CKM_EC_KEY_PAIR_GEN"
225 #define SUN_CKM_ECDH1_DERIVE "CKM_ECDH1_DERIVE"
226 #define SUN_CKM_ECDSA_SHA1 "CKM_ECDSA_SHA1"
227 #define SUN_CKM_ECDSA "CKM_ECDSA"
229 /* Shared operation context format for CKM_RC4 */
230 typedef struct {
231 #if defined(__amd64)
232 uint32_t i, j;
233 uint32_t arr[256];
234 uint32_t flag;
235 #else
236 uchar_t arr[256];
237 uchar_t i, j;
238 #endif /* __amd64 */
239 uint64_t pad; /* For 64-bit alignment */
240 } arcfour_state_t;
242 /* Data arguments of cryptographic operations */
244 typedef enum crypto_data_format {
245 CRYPTO_DATA_RAW = 1,
246 CRYPTO_DATA_UIO,
247 CRYPTO_DATA_MBLK
248 } crypto_data_format_t;
250 typedef struct crypto_data {
251 crypto_data_format_t cd_format; /* Format identifier */
252 off_t cd_offset; /* Offset from the beginning */
253 size_t cd_length; /* # of bytes in use */
254 caddr_t cd_miscdata; /* ancillary data */
255 union {
256 /* Raw format */
257 iovec_t cdu_raw; /* Pointer and length */
259 /* uio scatter-gather format */
260 uio_t *cdu_uio;
262 /* mblk scatter-gather format */
263 mblk_t *cdu_mp; /* The mblk chain */
265 } cdu; /* Crypto Data Union */
266 } crypto_data_t;
268 #define cd_raw cdu.cdu_raw
269 #define cd_uio cdu.cdu_uio
270 #define cd_mp cdu.cdu_mp
272 typedef struct crypto_dual_data {
273 crypto_data_t dd_data; /* The data */
274 off_t dd_offset2; /* Used by dual operation */
275 size_t dd_len2; /* # of bytes to take */
276 } crypto_dual_data_t;
278 #define dd_format dd_data.cd_format
279 #define dd_offset1 dd_data.cd_offset
280 #define dd_len1 dd_data.cd_length
281 #define dd_miscdata dd_data.cd_miscdata
282 #define dd_raw dd_data.cd_raw
283 #define dd_uio dd_data.cd_uio
284 #define dd_mp dd_data.cd_mp
286 /* The keys, and their contents */
288 typedef enum {
289 CRYPTO_KEY_RAW = 1, /* ck_data is a cleartext key */
290 CRYPTO_KEY_REFERENCE, /* ck_obj_id is an opaque reference */
291 CRYPTO_KEY_ATTR_LIST /* ck_attrs is a list of object attributes */
292 } crypto_key_format_t;
294 typedef uint64_t crypto_attr_type_t;
296 /* Attribute types to use for passing a RSA public key or a private key. */
297 #define SUN_CKA_MODULUS 0x00000120
298 #define SUN_CKA_MODULUS_BITS 0x00000121
299 #define SUN_CKA_PUBLIC_EXPONENT 0x00000122
300 #define SUN_CKA_PRIVATE_EXPONENT 0x00000123
301 #define SUN_CKA_PRIME_1 0x00000124
302 #define SUN_CKA_PRIME_2 0x00000125
303 #define SUN_CKA_EXPONENT_1 0x00000126
304 #define SUN_CKA_EXPONENT_2 0x00000127
305 #define SUN_CKA_COEFFICIENT 0x00000128
306 #define SUN_CKA_PRIME 0x00000130
307 #define SUN_CKA_SUBPRIME 0x00000131
308 #define SUN_CKA_BASE 0x00000132
310 #define CKK_EC 0x00000003UL
311 #define CKK_GENERIC_SECRET 0x00000010UL
312 #define CKK_RC4 0x00000012UL
313 #define CKK_AES 0x0000001FUL
314 #define CKK_DES 0x00000013UL
315 #define CKK_DES2 0x00000014UL
316 #define CKK_DES3 0x00000015UL
318 #define CKO_PUBLIC_KEY 0x00000002UL
319 #define CKO_PRIVATE_KEY 0x00000003UL
320 #define CKA_CLASS 0x00000000UL
321 #define CKA_VALUE 0x00000011UL
322 #define CKA_KEY_TYPE 0x00000100UL
323 #define CKA_VALUE_LEN 0x00000161UL
324 #define CKA_EC_PARAMS 0x00000180UL
325 #define CKA_EC_POINT 0x00000181UL
327 typedef uint32_t crypto_object_id_t;
329 typedef struct crypto_object_attribute {
330 crypto_attr_type_t oa_type; /* attribute type */
331 caddr_t oa_value; /* attribute value */
332 ssize_t oa_value_len; /* length of attribute value */
333 } crypto_object_attribute_t;
335 typedef struct crypto_key {
336 crypto_key_format_t ck_format; /* format identifier */
337 union {
338 /* for CRYPTO_KEY_RAW ck_format */
339 struct {
340 uint_t cku_v_length; /* # of bits in ck_data */
341 void *cku_v_data; /* ptr to key value */
342 } cku_key_value;
344 /* for CRYPTO_KEY_REFERENCE ck_format */
345 crypto_object_id_t cku_key_id; /* reference to object key */
347 /* for CRYPTO_KEY_ATTR_LIST ck_format */
348 struct {
349 uint_t cku_a_count; /* number of attributes */
350 crypto_object_attribute_t *cku_a_oattr;
351 } cku_key_attrs;
352 } cku_data; /* Crypto Key union */
353 } crypto_key_t;
355 #ifdef _SYSCALL32
357 typedef struct crypto_object_attribute32 {
358 uint64_t oa_type; /* attribute type */
359 caddr32_t oa_value; /* attribute value */
360 ssize32_t oa_value_len; /* length of attribute value */
361 } crypto_object_attribute32_t;
363 typedef struct crypto_key32 {
364 crypto_key_format_t ck_format; /* format identifier */
365 union {
366 /* for CRYPTO_KEY_RAW ck_format */
367 struct {
368 uint32_t cku_v_length; /* # of bytes in ck_data */
369 caddr32_t cku_v_data; /* ptr to key value */
370 } cku_key_value;
372 /* for CRYPTO_KEY_REFERENCE ck_format */
373 crypto_object_id_t cku_key_id; /* reference to object key */
375 /* for CRYPTO_KEY_ATTR_LIST ck_format */
376 struct {
377 uint32_t cku_a_count; /* number of attributes */
378 caddr32_t cku_a_oattr;
379 } cku_key_attrs;
380 } cku_data; /* Crypto Key union */
381 } crypto_key32_t;
383 #endif /* _SYSCALL32 */
385 #define ck_data cku_data.cku_key_value.cku_v_data
386 #define ck_length cku_data.cku_key_value.cku_v_length
387 #define ck_obj_id cku_data.cku_key_id
388 #define ck_count cku_data.cku_key_attrs.cku_a_count
389 #define ck_attrs cku_data.cku_key_attrs.cku_a_oattr
392 * Raw key lengths are expressed in number of bits.
393 * The following macro returns the minimum number of
394 * bytes that can contain the specified number of bits.
395 * Round up without overflowing the integer type.
397 #define CRYPTO_BITS2BYTES(n) ((n) == 0 ? 0 : (((n) - 1) >> 3) + 1)
398 #define CRYPTO_BYTES2BITS(n) ((n) << 3)
400 /* Providers */
402 typedef enum {
403 CRYPTO_HW_PROVIDER = 0,
404 CRYPTO_SW_PROVIDER,
405 CRYPTO_LOGICAL_PROVIDER
406 } crypto_provider_type_t;
408 typedef uint32_t crypto_provider_id_t;
409 #define KCF_PROVID_INVALID ((uint32_t)-1)
411 typedef struct crypto_provider_entry {
412 crypto_provider_id_t pe_provider_id;
413 uint_t pe_mechanism_count;
414 } crypto_provider_entry_t;
416 typedef struct crypto_dev_list_entry {
417 char le_dev_name[MAXNAMELEN];
418 uint_t le_dev_instance;
419 uint_t le_mechanism_count;
420 } crypto_dev_list_entry_t;
422 /* User type for authentication ioctls and SPI entry points */
424 typedef enum crypto_user_type {
425 CRYPTO_SO = 0,
426 CRYPTO_USER
427 } crypto_user_type_t;
429 /* Version for provider management ioctls and SPI entry points */
431 typedef struct crypto_version {
432 uchar_t cv_major;
433 uchar_t cv_minor;
434 } crypto_version_t;
436 /* session data structure opaque to the consumer */
437 typedef void *crypto_session_t;
439 /* provider data structure opaque to the consumer */
440 typedef void *crypto_provider_t;
442 /* Limits used by both consumers and providers */
443 #define CRYPTO_EXT_SIZE_LABEL 32
444 #define CRYPTO_EXT_SIZE_MANUF 32
445 #define CRYPTO_EXT_SIZE_MODEL 16
446 #define CRYPTO_EXT_SIZE_SERIAL 16
447 #define CRYPTO_EXT_SIZE_TIME 16
449 typedef struct crypto_provider_ext_info {
450 uchar_t ei_label[CRYPTO_EXT_SIZE_LABEL];
451 uchar_t ei_manufacturerID[CRYPTO_EXT_SIZE_MANUF];
452 uchar_t ei_model[CRYPTO_EXT_SIZE_MODEL];
453 uchar_t ei_serial_number[CRYPTO_EXT_SIZE_SERIAL];
454 ulong_t ei_flags;
455 ulong_t ei_max_session_count;
456 ulong_t ei_max_pin_len;
457 ulong_t ei_min_pin_len;
458 ulong_t ei_total_public_memory;
459 ulong_t ei_free_public_memory;
460 ulong_t ei_total_private_memory;
461 ulong_t ei_free_private_memory;
462 crypto_version_t ei_hardware_version;
463 crypto_version_t ei_firmware_version;
464 uchar_t ei_time[CRYPTO_EXT_SIZE_TIME];
465 int ei_hash_max_input_len;
466 int ei_hmac_max_input_len;
467 } crypto_provider_ext_info_t;
469 typedef uint_t crypto_session_id_t;
471 typedef enum cmd_type {
472 COPY_FROM_DATA,
473 COPY_TO_DATA,
474 COMPARE_TO_DATA,
475 MD5_DIGEST_DATA,
476 SHA1_DIGEST_DATA,
477 SHA2_DIGEST_DATA,
478 GHASH_DATA
479 } cmd_type_t;
481 #define CRYPTO_DO_UPDATE 0x01
482 #define CRYPTO_DO_FINAL 0x02
483 #define CRYPTO_DO_MD5 0x04
484 #define CRYPTO_DO_SHA1 0x08
485 #define CRYPTO_DO_SIGN 0x10
486 #define CRYPTO_DO_VERIFY 0x20
487 #define CRYPTO_DO_SHA2 0x40
489 #define PROVIDER_OWNS_KEY_SCHEDULE 0x00000001
492 * Common cryptographic status and error codes.
494 #define CRYPTO_SUCCESS 0x00000000
495 #define CRYPTO_CANCEL 0x00000001
496 #define CRYPTO_HOST_MEMORY 0x00000002
497 #define CRYPTO_GENERAL_ERROR 0x00000003
498 #define CRYPTO_FAILED 0x00000004
499 #define CRYPTO_ARGUMENTS_BAD 0x00000005
500 #define CRYPTO_ATTRIBUTE_READ_ONLY 0x00000006
501 #define CRYPTO_ATTRIBUTE_SENSITIVE 0x00000007
502 #define CRYPTO_ATTRIBUTE_TYPE_INVALID 0x00000008
503 #define CRYPTO_ATTRIBUTE_VALUE_INVALID 0x00000009
504 #define CRYPTO_CANCELED 0x0000000A
505 #define CRYPTO_DATA_INVALID 0x0000000B
506 #define CRYPTO_DATA_LEN_RANGE 0x0000000C
507 #define CRYPTO_DEVICE_ERROR 0x0000000D
508 #define CRYPTO_DEVICE_MEMORY 0x0000000E
509 #define CRYPTO_DEVICE_REMOVED 0x0000000F
510 #define CRYPTO_ENCRYPTED_DATA_INVALID 0x00000010
511 #define CRYPTO_ENCRYPTED_DATA_LEN_RANGE 0x00000011
512 #define CRYPTO_KEY_HANDLE_INVALID 0x00000012
513 #define CRYPTO_KEY_SIZE_RANGE 0x00000013
514 #define CRYPTO_KEY_TYPE_INCONSISTENT 0x00000014
515 #define CRYPTO_KEY_NOT_NEEDED 0x00000015
516 #define CRYPTO_KEY_CHANGED 0x00000016
517 #define CRYPTO_KEY_NEEDED 0x00000017
518 #define CRYPTO_KEY_INDIGESTIBLE 0x00000018
519 #define CRYPTO_KEY_FUNCTION_NOT_PERMITTED 0x00000019
520 #define CRYPTO_KEY_NOT_WRAPPABLE 0x0000001A
521 #define CRYPTO_KEY_UNEXTRACTABLE 0x0000001B
522 #define CRYPTO_MECHANISM_INVALID 0x0000001C
523 #define CRYPTO_MECHANISM_PARAM_INVALID 0x0000001D
524 #define CRYPTO_OBJECT_HANDLE_INVALID 0x0000001E
525 #define CRYPTO_OPERATION_IS_ACTIVE 0x0000001F
526 #define CRYPTO_OPERATION_NOT_INITIALIZED 0x00000020
527 #define CRYPTO_PIN_INCORRECT 0x00000021
528 #define CRYPTO_PIN_INVALID 0x00000022
529 #define CRYPTO_PIN_LEN_RANGE 0x00000023
530 #define CRYPTO_PIN_EXPIRED 0x00000024
531 #define CRYPTO_PIN_LOCKED 0x00000025
532 #define CRYPTO_SESSION_CLOSED 0x00000026
533 #define CRYPTO_SESSION_COUNT 0x00000027
534 #define CRYPTO_SESSION_HANDLE_INVALID 0x00000028
535 #define CRYPTO_SESSION_READ_ONLY 0x00000029
536 #define CRYPTO_SESSION_EXISTS 0x0000002A
537 #define CRYPTO_SESSION_READ_ONLY_EXISTS 0x0000002B
538 #define CRYPTO_SESSION_READ_WRITE_SO_EXISTS 0x0000002C
539 #define CRYPTO_SIGNATURE_INVALID 0x0000002D
540 #define CRYPTO_SIGNATURE_LEN_RANGE 0x0000002E
541 #define CRYPTO_TEMPLATE_INCOMPLETE 0x0000002F
542 #define CRYPTO_TEMPLATE_INCONSISTENT 0x00000030
543 #define CRYPTO_UNWRAPPING_KEY_HANDLE_INVALID 0x00000031
544 #define CRYPTO_UNWRAPPING_KEY_SIZE_RANGE 0x00000032
545 #define CRYPTO_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x00000033
546 #define CRYPTO_USER_ALREADY_LOGGED_IN 0x00000034
547 #define CRYPTO_USER_NOT_LOGGED_IN 0x00000035
548 #define CRYPTO_USER_PIN_NOT_INITIALIZED 0x00000036
549 #define CRYPTO_USER_TYPE_INVALID 0x00000037
550 #define CRYPTO_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000038
551 #define CRYPTO_USER_TOO_MANY_TYPES 0x00000039
552 #define CRYPTO_WRAPPED_KEY_INVALID 0x0000003A
553 #define CRYPTO_WRAPPED_KEY_LEN_RANGE 0x0000003B
554 #define CRYPTO_WRAPPING_KEY_HANDLE_INVALID 0x0000003C
555 #define CRYPTO_WRAPPING_KEY_SIZE_RANGE 0x0000003D
556 #define CRYPTO_WRAPPING_KEY_TYPE_INCONSISTENT 0x0000003E
557 #define CRYPTO_RANDOM_SEED_NOT_SUPPORTED 0x0000003F
558 #define CRYPTO_RANDOM_NO_RNG 0x00000040
559 #define CRYPTO_DOMAIN_PARAMS_INVALID 0x00000041
560 #define CRYPTO_BUFFER_TOO_SMALL 0x00000042
561 #define CRYPTO_INFORMATION_SENSITIVE 0x00000043
562 #define CRYPTO_NOT_SUPPORTED 0x00000044
564 #define CRYPTO_QUEUED 0x00000045
565 #define CRYPTO_BUFFER_TOO_BIG 0x00000046
566 #define CRYPTO_INVALID_CONTEXT 0x00000047
567 #define CRYPTO_INVALID_MAC 0x00000048
568 #define CRYPTO_MECH_NOT_SUPPORTED 0x00000049
569 #define CRYPTO_INCONSISTENT_ATTRIBUTE 0x0000004A
570 #define CRYPTO_NO_PERMISSION 0x0000004B
571 #define CRYPTO_INVALID_PROVIDER_ID 0x0000004C
572 #define CRYPTO_VERSION_MISMATCH 0x0000004D
573 #define CRYPTO_BUSY 0x0000004E
574 #define CRYPTO_UNKNOWN_PROVIDER 0x0000004F
575 #define CRYPTO_MODVERIFICATION_FAILED 0x00000050
576 #define CRYPTO_OLD_CTX_TEMPLATE 0x00000051
577 #define CRYPTO_WEAK_KEY 0x00000052
578 #define CRYPTO_FIPS140_ERROR 0x00000053
580 * Don't forget to update CRYPTO_LAST_ERROR and the error_number_table[]
581 * in kernelUtil.c when new error code is added.
583 #define CRYPTO_LAST_ERROR 0x00000053
586 * Special values that can be used to indicate that information is unavailable
587 * or that there is not practical limit. These values can be used
588 * by fields of the SPI crypto_provider_ext_info(9S) structure.
589 * The value of CRYPTO_UNAVAILABLE_INFO should be the same as
590 * CK_UNAVAILABLE_INFO in the PKCS#11 spec.
592 #define CRYPTO_UNAVAILABLE_INFO ((ulong_t)(-1))
593 #define CRYPTO_EFFECTIVELY_INFINITE 0x0
595 #ifdef __cplusplus
597 #endif
599 #endif /* _SYS_CRYPTO_COMMON_H */