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