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