1*27b03b36SApple OSS Distributions /* Copyright (c) (2017,2018,2019,2020) Apple Inc. All rights reserved. 2*27b03b36SApple OSS Distributions * 3*27b03b36SApple OSS Distributions * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which 4*27b03b36SApple OSS Distributions * is contained in the License.txt file distributed with corecrypto) and only to 5*27b03b36SApple OSS Distributions * people who accept that license. IMPORTANT: Any license rights granted to you by 6*27b03b36SApple OSS Distributions * Apple Inc. (if any) are limited to internal use within your organization only on 7*27b03b36SApple OSS Distributions * devices and computers you own or control, for the sole purpose of verifying the 8*27b03b36SApple OSS Distributions * security characteristics and correct functioning of the Apple Software. You may 9*27b03b36SApple OSS Distributions * not, directly or indirectly, redistribute the Apple Software or any portions thereof. 10*27b03b36SApple OSS Distributions */ 11*27b03b36SApple OSS Distributions 12*27b03b36SApple OSS Distributions #ifndef _CORECRYPTO_CC_ERROR_H_ 13*27b03b36SApple OSS Distributions #define _CORECRYPTO_CC_ERROR_H_ 14*27b03b36SApple OSS Distributions 15*27b03b36SApple OSS Distributions enum { 16*27b03b36SApple OSS Distributions CCERR_OK = 0, 17*27b03b36SApple OSS Distributions 18*27b03b36SApple OSS Distributions /* the default error code */ 19*27b03b36SApple OSS Distributions CCERR_INTERNAL = -1, 20*27b03b36SApple OSS Distributions 21*27b03b36SApple OSS Distributions CCERR_INTEGRITY = -2, 22*27b03b36SApple OSS Distributions 23*27b03b36SApple OSS Distributions CCERR_DEVICE = -3, 24*27b03b36SApple OSS Distributions CCERR_INTERRUPTS = -4, 25*27b03b36SApple OSS Distributions CCERR_CRYPTO_CONFIG = -5, 26*27b03b36SApple OSS Distributions CCERR_PERMS = -6, 27*27b03b36SApple OSS Distributions CCERR_PARAMETER = -7, 28*27b03b36SApple OSS Distributions CCERR_MEMORY = -8, 29*27b03b36SApple OSS Distributions CCERR_FILEDESC = -9, 30*27b03b36SApple OSS Distributions CCERR_OUT_OF_ENTROPY = -10, 31*27b03b36SApple OSS Distributions CCERR_ATFORK = -11, 32*27b03b36SApple OSS Distributions CCERR_OVERFLOW = -12, 33*27b03b36SApple OSS Distributions 34*27b03b36SApple OSS Distributions CCERR_MEMORY_ALLOC_FAIL = -13, 35*27b03b36SApple OSS Distributions 36*27b03b36SApple OSS Distributions CCEC_GENERATE_KEY_DEFAULT_ERR = -14, 37*27b03b36SApple OSS Distributions CCEC_GENERATE_KEY_TOO_MANY_TRIES = -15, 38*27b03b36SApple OSS Distributions CCEC_GENERATE_KEY_MULT_FAIL = -16, 39*27b03b36SApple OSS Distributions CCEC_GENERATE_KEY_AFF_FAIL = -17, 40*27b03b36SApple OSS Distributions CCEC_GENERATE_KEY_CONSISTENCY = -18, 41*27b03b36SApple OSS Distributions CCEC_GENERATE_NOT_ON_CURVE = -19, 42*27b03b36SApple OSS Distributions CCEC_GENERATE_NOT_ENOUGH_ENTROPY = -20, 43*27b03b36SApple OSS Distributions CCEC_GENERATE_NOT_SUPPORTED = -21, 44*27b03b36SApple OSS Distributions CCEC_GENERATE_INVALID_INPUT = -22, 45*27b03b36SApple OSS Distributions 46*27b03b36SApple OSS Distributions // Program error: buffer too small or encrypted message is too small 47*27b03b36SApple OSS Distributions CCRSA_INVALID_INPUT = -23, 48*27b03b36SApple OSS Distributions // Invalid crypto configuration: Hash length versus RSA key size 49*27b03b36SApple OSS Distributions CCRSA_INVALID_CONFIG = -24, 50*27b03b36SApple OSS Distributions CCRSA_ENCODING_ERROR = -25, 51*27b03b36SApple OSS Distributions CCRSA_DECODING_ERROR = -26, 52*27b03b36SApple OSS Distributions 53*27b03b36SApple OSS Distributions // The data is invalid (we won't say more for security) 54*27b03b36SApple OSS Distributions CCRSA_PRIVATE_OP_ERROR = -27, 55*27b03b36SApple OSS Distributions CCRSA_KEY_ERROR = -28, 56*27b03b36SApple OSS Distributions 57*27b03b36SApple OSS Distributions // Key generation specific 58*27b03b36SApple OSS Distributions CCRSA_KEYGEN_PRIME_NOT_FOUND = -29, 59*27b03b36SApple OSS Distributions CCRSA_KEYGEN_PRIME_NEED_NEW_SEED = -30, 60*27b03b36SApple OSS Distributions CCRSA_KEYGEN_PRIME_TOO_MANY_ITERATIONS = -31, 61*27b03b36SApple OSS Distributions CCRSA_KEYGEN_PRIME_SEED_GENERATION_ERROR = -32, 62*27b03b36SApple OSS Distributions CCRSA_KEYGEN_MODULUS_CRT_INV_ERROR = -33, 63*27b03b36SApple OSS Distributions CCRSA_KEYGEN_NEXT_PRIME_ERROR = -34, 64*27b03b36SApple OSS Distributions CCRSA_KEYGEN_SEED_X_ERROR = -35, 65*27b03b36SApple OSS Distributions CCRSA_KEYGEN_SEED_r_ERROR = -36, 66*27b03b36SApple OSS Distributions CCRSA_KEYGEN_KEYGEN_CONSISTENCY_FAIL = -37, 67*27b03b36SApple OSS Distributions CCRSA_KEYGEN_R1R2_SIZE_ERROR = -38, 68*27b03b36SApple OSS Distributions CCRSA_KEYGEN_PQ_DELTA_ERROR = -39, 69*27b03b36SApple OSS Distributions 70*27b03b36SApple OSS Distributions CCRSA_FIPS_KEYGEN_DISABLED = -40, 71*27b03b36SApple OSS Distributions 72*27b03b36SApple OSS Distributions CCZP_INV_ERROR = -41, 73*27b03b36SApple OSS Distributions CCZP_INV_NO_INVERSE = -42, 74*27b03b36SApple OSS Distributions CCZP_INV_INVALID_INPUT = -43, 75*27b03b36SApple OSS Distributions 76*27b03b36SApple OSS Distributions CCZ_INVALID_INPUT_ERROR = -44, 77*27b03b36SApple OSS Distributions CCZ_INVALID_RADIX_ERROR = -45, 78*27b03b36SApple OSS Distributions 79*27b03b36SApple OSS Distributions CCDH_ERROR_DEFAULT = -46, 80*27b03b36SApple OSS Distributions CCDH_GENERATE_KEY_TOO_MANY_TRIES = -47, 81*27b03b36SApple OSS Distributions CCDH_NOT_SUPPORTED_CONFIGURATION = -48, 82*27b03b36SApple OSS Distributions CCDH_SAFETY_CHECK = -49, 83*27b03b36SApple OSS Distributions CCDH_PUBLIC_KEY_MISSING = -50, 84*27b03b36SApple OSS Distributions CCDH_INVALID_DOMAIN_PARAMETER = -51, 85*27b03b36SApple OSS Distributions CCDH_INVALID_INPUT = -52, 86*27b03b36SApple OSS Distributions CCDH_DOMAIN_PARAMETER_MISMATCH = -53, 87*27b03b36SApple OSS Distributions CCDH_GENERATE_KEY_CONSISTENCY = -54, 88*27b03b36SApple OSS Distributions 89*27b03b36SApple OSS Distributions CCSRP_ERROR_DEFAULT = -55, 90*27b03b36SApple OSS Distributions CCSRP_GENERATE_KEY_TOO_MANY_TRIES = -56, 91*27b03b36SApple OSS Distributions CCSRP_NOT_SUPPORTED_CONFIGURATION = -57, 92*27b03b36SApple OSS Distributions CCSRP_SAFETY_CHECK = -58, 93*27b03b36SApple OSS Distributions CCSRP_PUBLIC_KEY_MISSING = -59, 94*27b03b36SApple OSS Distributions CCSRP_INVALID_DOMAIN_PARAMETER = -60, 95*27b03b36SApple OSS Distributions 96*27b03b36SApple OSS Distributions CCDRBG_STATUS_ERROR = -61, 97*27b03b36SApple OSS Distributions CCDRBG_STATUS_NEED_RESEED = -62, 98*27b03b36SApple OSS Distributions CCDRBG_STATUS_PARAM_ERROR = -63, 99*27b03b36SApple OSS Distributions // If this value is returned, the caller must abort or panic the process for 100*27b03b36SApple OSS Distributions // security reasons. for example in the case of catastrophic error in 101*27b03b36SApple OSS Distributions // http://csrc.nist.gov/publications/drafts/800-90/sp800_90a_r1_draft.pdf 102*27b03b36SApple OSS Distributions // ccdrbg calls abort() or panic(), if they are available in the system. 103*27b03b36SApple OSS Distributions CCDRBG_STATUS_ABORT = -64, 104*27b03b36SApple OSS Distributions 105*27b03b36SApple OSS Distributions CCKPRNG_NEED_ENTROPY = -65, 106*27b03b36SApple OSS Distributions CCKPRNG_ABORT = -66, 107*27b03b36SApple OSS Distributions 108*27b03b36SApple OSS Distributions CCMODE_INVALID_INPUT = -67, 109*27b03b36SApple OSS Distributions CCMODE_INVALID_CALL_SEQUENCE = -68, 110*27b03b36SApple OSS Distributions CCMODE_INTEGRITY_FAILURE = -69, 111*27b03b36SApple OSS Distributions CCMODE_NOT_SUPPORTED = -70, 112*27b03b36SApple OSS Distributions CCMODE_INTERNAL_ERROR = -71, 113*27b03b36SApple OSS Distributions 114*27b03b36SApple OSS Distributions // Configuration or unexpected issue 115*27b03b36SApple OSS Distributions CCPOST_GENERIC_FAILURE = -72, 116*27b03b36SApple OSS Distributions CCPOST_LIBRARY_ERROR = -73, 117*27b03b36SApple OSS Distributions CCPOST_INTEGRITY_ERROR = -74, 118*27b03b36SApple OSS Distributions // Output of the algo is not as expected 119*27b03b36SApple OSS Distributions CCPOST_KAT_FAILURE = -75, 120*27b03b36SApple OSS Distributions 121*27b03b36SApple OSS Distributions CCKPRNG_SEEDFILE_OPEN = -76, 122*27b03b36SApple OSS Distributions CCKPRNG_SEEDFILE_READ = -78, 123*27b03b36SApple OSS Distributions CCKPRNG_SEEDFILE_WRITE = -79, 124*27b03b36SApple OSS Distributions CCKPRNG_SEEDFILE_CHMOD = -80, 125*27b03b36SApple OSS Distributions CCKPRNG_SEEDFILE_CHOWN = -81, 126*27b03b36SApple OSS Distributions CCKPRNG_RANDOMDEV_OPEN = -82, 127*27b03b36SApple OSS Distributions CCKPRNG_RANDOMDEV_WRITE = -83, 128*27b03b36SApple OSS Distributions CCKPRNG_GETENTROPY = -84, 129*27b03b36SApple OSS Distributions 130*27b03b36SApple OSS Distributions CCSAE_HUNTPECK_EXCEEDED_MAX_TRIALS = -85, 131*27b03b36SApple OSS Distributions 132*27b03b36SApple OSS Distributions CCERR_CALL_SEQUENCE = -86, 133*27b03b36SApple OSS Distributions 134*27b03b36SApple OSS Distributions CCVRF_POINT_DECODE_FAILURE = -87, 135*27b03b36SApple OSS Distributions CCVRF_POINT_INVALID_PUBLIC_KEY = -88, 136*27b03b36SApple OSS Distributions CCVRF_VERIFY_FAILURE = -89, 137*27b03b36SApple OSS Distributions 138*27b03b36SApple OSS Distributions // Error codes for Authenticated Encryption Modes 139*27b03b36SApple OSS Distributions CCMODE_TAG_LENGTH_REQUEST_TOO_LONG = -100, 140*27b03b36SApple OSS Distributions CCMODE_TAG_LENGTH_TOO_SHORT = -101, 141*27b03b36SApple OSS Distributions CCMODE_NONCE_EMPTY = -102, 142*27b03b36SApple OSS Distributions CCMODE_AD_EMPTY = -103, 143*27b03b36SApple OSS Distributions CCMODE_DECRYPTION_OR_VERIFICATION_ERR=-104, 144*27b03b36SApple OSS Distributions CCMODE_BUFFER_OUT_IN_OVERLAP = -105, 145*27b03b36SApple OSS Distributions 146*27b03b36SApple OSS Distributions // Error codes for Secret Sharing 147*27b03b36SApple OSS Distributions CCSS_ELEMENT_TOO_LARGE_FOR_FIELD = -120, 148*27b03b36SApple OSS Distributions CCSS_NOT_ENOUGH_SHARES = -121, 149*27b03b36SApple OSS Distributions CCSS_TOO_MANY_SHARES = -122, 150*27b03b36SApple OSS Distributions CCSS_IMPROPER_DEGREE = -123, 151*27b03b36SApple OSS Distributions CCSS_TWO_SHARES_FOR_SAME_X = -124, 152*27b03b36SApple OSS Distributions CCSS_THRESHOLD_NOT_LARGE_ENOUGH = -125, 153*27b03b36SApple OSS Distributions CCSS_SHARE_BAG_FULL = -126, 154*27b03b36SApple OSS Distributions CCSS_SHARE_ALREADY_PRESENT_IN_SHARE_BAG = -127, 155*27b03b36SApple OSS Distributions CCSS_THRESHOLD_LARGER_OR_EQUAL_TO_FIELD = -128, 156*27b03b36SApple OSS Distributions CCSS_TOO_MANY_SHARES_REQUESTED = -129, 157*27b03b36SApple OSS Distributions CCSS_FIELD_MISMATCH = -130, 158*27b03b36SApple OSS Distributions CCSS_INDEX_OUT_OF_RANGE = -131, 159*27b03b36SApple OSS Distributions 160*27b03b36SApple OSS Distributions CCSAE_NOT_ENOUGH_COMMIT_PARTIAL_CALLS = -132, 161*27b03b36SApple OSS Distributions CCSAE_GENERATE_COMMIT_CALL_AGAIN = -133, 162*27b03b36SApple OSS Distributions 163*27b03b36SApple OSS Distributions CCERR_VALID_SIGNATURE = CCERR_OK, 164*27b03b36SApple OSS Distributions CCERR_INVALID_SIGNATURE = -146, 165*27b03b36SApple OSS Distributions 166*27b03b36SApple OSS Distributions CCERR_IOSERVICE_GETMATCHING = -147, 167*27b03b36SApple OSS Distributions CCERR_IOSERVICE_OPEN = -148, 168*27b03b36SApple OSS Distributions CCERR_IOCONNECT_CALL = -149, 169*27b03b36SApple OSS Distributions }; 170*27b03b36SApple OSS Distributions 171*27b03b36SApple OSS Distributions #define CCDRBG_STATUS_OK CCERR_OK 172*27b03b36SApple OSS Distributions #define CCKPRNG_OK CCERR_OK 173*27b03b36SApple OSS Distributions 174*27b03b36SApple OSS Distributions #endif /* _CORECRYPTO_CC_ERROR_H_ */ 175