]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/corecrypto/cc_error.h
xnu-6153.141.1.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / cc_error.h
1 /*
2 * cc_error.h
3 * corecrypto
4 *
5 * Created on 11/14/2017
6 *
7 * Copyright (c) 2017 Apple Inc. All rights reserved.
8 *
9 */
10
11 #ifndef _CORECRYPTO_CC_ERROR_H_
12 #define _CORECRYPTO_CC_ERROR_H_
13
14 enum {
15 CCERR_OK = 0,
16
17 /* the default error code */
18 CCERR_INTERNAL = -1,
19
20 CCERR_INTEGRITY = -2,
21
22 CCERR_DEVICE = -3,
23 CCERR_INTERRUPTS = -4,
24 CCERR_CRYPTO_CONFIG = -5,
25 CCERR_PERMS = -6,
26 CCERR_PARAMETER = -7,
27 CCERR_MEMORY = -8,
28 CCERR_FILEDESC = -9,
29 CCERR_OUT_OF_ENTROPY = -10,
30 CCERR_ATFORK = -11,
31 CCERR_OVERFLOW = -12,
32
33 CCERR_MEMORY_ALLOC_FAIL = -13,
34
35 CCEC_GENERATE_KEY_DEFAULT_ERR = -14,
36 CCEC_GENERATE_KEY_TOO_MANY_TRIES = -15,
37 CCEC_GENERATE_KEY_MULT_FAIL = -16,
38 CCEC_GENERATE_KEY_AFF_FAIL = -17,
39 CCEC_GENERATE_KEY_CONSISTENCY = -18,
40 CCEC_GENERATE_NOT_ON_CURVE = -19,
41 CCEC_GENERATE_NOT_ENOUGH_ENTROPY = -20,
42 CCEC_GENERATE_NOT_SUPPORTED = -21,
43 CCEC_GENERATE_INVALID_INPUT = -22,
44
45 // Program error: buffer too small or encrypted message is too small
46 CCRSA_INVALID_INPUT = -23,
47 // Invalid crypto configuration: Hash length versus RSA key size
48 CCRSA_INVALID_CONFIG = -24,
49 CCRSA_ENCODING_ERROR = -25,
50 CCRSA_DECODING_ERROR = -26,
51
52 // The data is invalid (we won't say more for security)
53 CCRSA_PRIVATE_OP_ERROR = -27,
54 CCRSA_KEY_ERROR = -28,
55
56 // Key generation specific
57 CCRSA_KEYGEN_PRIME_NOT_FOUND = -29,
58 CCRSA_KEYGEN_PRIME_NEED_NEW_SEED = -30,
59 CCRSA_KEYGEN_PRIME_TOO_MANY_ITERATIONS = -31,
60 CCRSA_KEYGEN_PRIME_SEED_GENERATION_ERROR = -32,
61 CCRSA_KEYGEN_MODULUS_CRT_INV_ERROR = -33,
62 CCRSA_KEYGEN_NEXT_PRIME_ERROR = -34,
63 CCRSA_KEYGEN_SEED_X_ERROR = -35,
64 CCRSA_KEYGEN_SEED_r_ERROR = -36,
65 CCRSA_KEYGEN_KEYGEN_CONSISTENCY_FAIL = -37,
66 CCRSA_KEYGEN_R1R2_SIZE_ERROR = -38,
67 CCRSA_KEYGEN_PQ_DELTA_ERROR = -39,
68
69 CCRSA_FIPS_KEYGEN_DISABLED = -40,
70
71 CCZP_INV_ERROR = -41,
72 CCZP_INV_NO_INVERSE = -42,
73 CCZP_INV_INVALID_INPUT = -43,
74
75 CCZ_INVALID_INPUT_ERROR = -44,
76 CCZ_INVALID_RADIX_ERROR = -45,
77
78 CCDH_ERROR_DEFAULT = -46,
79 CCDH_GENERATE_KEY_TOO_MANY_TRIES = -47,
80 CCDH_NOT_SUPPORTED_CONFIGURATION = -48,
81 CCDH_SAFETY_CHECK = -49,
82 CCDH_PUBLIC_KEY_MISSING = -50,
83 CCDH_INVALID_DOMAIN_PARAMETER = -51,
84 CCDH_INVALID_INPUT = -52,
85 CCDH_DOMAIN_PARAMETER_MISMATCH = -53,
86 CCDH_GENERATE_KEY_CONSISTENCY = -54,
87
88 CCSRP_ERROR_DEFAULT = -55,
89 CCSRP_GENERATE_KEY_TOO_MANY_TRIES = -56,
90 CCSRP_NOT_SUPPORTED_CONFIGURATION = -57,
91 CCSRP_SAFETY_CHECK = -58,
92 CCSRP_PUBLIC_KEY_MISSING = -59,
93 CCSRP_INVALID_DOMAIN_PARAMETER = -60,
94
95 CCDRBG_STATUS_ERROR = -61,
96 CCDRBG_STATUS_NEED_RESEED = -62,
97 CCDRBG_STATUS_PARAM_ERROR = -63,
98 // If this value is returned, the caller must abort or panic the process for
99 // security reasons. for example in the case of catastrophic error in
100 // http://csrc.nist.gov/publications/drafts/800-90/sp800_90a_r1_draft.pdf
101 // ccdrbg calls abort() or panic(), if they are available in the system.
102 CCDRBG_STATUS_ABORT = -64,
103
104 CCKPRNG_NEED_ENTROPY = -65,
105 CCKPRNG_ABORT = -66,
106
107 CCMODE_INVALID_INPUT = -67,
108 CCMODE_INVALID_CALL_SEQUENCE = -68,
109 CCMODE_INTEGRITY_FAILURE = -69,
110 CCMODE_NOT_SUPPORTED = -70,
111 CCMODE_INTERNAL_ERROR = -71,
112
113 // Configuration or unexpected issue
114 CCPOST_GENERIC_FAILURE = -72,
115 CCPOST_LIBRARY_ERROR = -73,
116 CCPOST_INTEGRITY_ERROR = -74,
117 // Output of the algo is not as expected
118 CCPOST_KAT_FAILURE = -75,
119
120 CCKPRNG_SEEDFILE_OPEN = -76,
121 CCKPRNG_SEEDFILE_READ = -78,
122 CCKPRNG_SEEDFILE_WRITE = -79,
123 CCKPRNG_SEEDFILE_CHMOD = -80,
124 CCKPRNG_SEEDFILE_CHOWN = -81,
125 CCKPRNG_RANDOMDEV_OPEN = -82,
126 CCKPRNG_RANDOMDEV_WRITE = -83,
127 CCKPRNG_GETENTROPY = -84,
128
129 CCSAE_HUNTPECK_EXCEEDED_MAX_TRIALS = -85,
130
131 CCERR_CALL_SEQUENCE = -86,
132
133 CCVRF_POINT_DECODE_FAILURE = -87,
134 CCVRF_POINT_INVALID_PUBLIC_KEY = -88,
135 CCVRF_VERIFY_FAILURE = -89,
136
137 // Error codes for Authenticated Encryption Modes
138 CCMODE_TAG_LENGTH_REQUEST_TOO_LONG = -100,
139 CCMODE_TAG_LENGTH_TOO_SHORT = -101,
140 CCMODE_NONCE_EMPTY = -102,
141 CCMODE_AD_EMPTY = -103,
142 CCMODE_DECRYPTION_OR_VERIFICATION_ERR=-104,
143 };
144
145 #define CCDRBG_STATUS_OK CCERR_OK
146 #define CCKPRNG_OK CCERR_OK
147
148 #endif /* _CORECRYPTO_CC_ERROR_H_ */