Home | History | Annotate | Download | only in ssl
      1 /*
      2  * Enumeration of all SSL-specific error codes.
      3  *
      4  * This Source Code Form is subject to the terms of the Mozilla Public
      5  * License, v. 2.0. If a copy of the MPL was not distributed with this
      6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 #ifndef __SSL_ERR_H_
      8 #define __SSL_ERR_H_
      9 
     10 
     11 #define SSL_ERROR_BASE				(-0x3000)
     12 #define SSL_ERROR_LIMIT				(SSL_ERROR_BASE + 1000)
     13 
     14 #define IS_SSL_ERROR(code) \
     15     (((code) >= SSL_ERROR_BASE) && ((code) < SSL_ERROR_LIMIT))
     16 
     17 #ifndef NO_SECURITY_ERROR_ENUM
     18 typedef enum {
     19 SSL_ERROR_EXPORT_ONLY_SERVER 		= (SSL_ERROR_BASE +  0),
     20 SSL_ERROR_US_ONLY_SERVER 		= (SSL_ERROR_BASE +  1),
     21 SSL_ERROR_NO_CYPHER_OVERLAP 		= (SSL_ERROR_BASE +  2),
     22 /*
     23  * Received an alert reporting what we did wrong.  (more alerts below)
     24  */
     25 SSL_ERROR_NO_CERTIFICATE /*_ALERT */	= (SSL_ERROR_BASE +  3),
     26 SSL_ERROR_BAD_CERTIFICATE            	= (SSL_ERROR_BASE +  4),
     27 SSL_ERROR_UNUSED_5			= (SSL_ERROR_BASE +  5),
     28 					/* error 5 is obsolete */
     29 SSL_ERROR_BAD_CLIENT 			= (SSL_ERROR_BASE +  6),
     30 SSL_ERROR_BAD_SERVER 			= (SSL_ERROR_BASE +  7),
     31 SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE	= (SSL_ERROR_BASE +  8),
     32 SSL_ERROR_UNSUPPORTED_VERSION 		= (SSL_ERROR_BASE +  9),
     33 SSL_ERROR_UNUSED_10			= (SSL_ERROR_BASE + 10),
     34 					/* error 10 is obsolete */
     35 SSL_ERROR_WRONG_CERTIFICATE		= (SSL_ERROR_BASE + 11),
     36 SSL_ERROR_BAD_CERT_DOMAIN 		= (SSL_ERROR_BASE + 12),
     37 SSL_ERROR_POST_WARNING 			= (SSL_ERROR_BASE + 13),
     38 SSL_ERROR_SSL2_DISABLED 		= (SSL_ERROR_BASE + 14),
     39 SSL_ERROR_BAD_MAC_READ 			= (SSL_ERROR_BASE + 15),
     40 /*
     41  * Received an alert reporting what we did wrong.
     42  * (two more alerts above, and many more below)
     43  */
     44 SSL_ERROR_BAD_MAC_ALERT 		= (SSL_ERROR_BASE + 16),
     45 SSL_ERROR_BAD_CERT_ALERT                = (SSL_ERROR_BASE + 17),
     46 SSL_ERROR_REVOKED_CERT_ALERT 		= (SSL_ERROR_BASE + 18),
     47 SSL_ERROR_EXPIRED_CERT_ALERT 		= (SSL_ERROR_BASE + 19),
     48 
     49 SSL_ERROR_SSL_DISABLED 			= (SSL_ERROR_BASE + 20),
     50 SSL_ERROR_FORTEZZA_PQG 			= (SSL_ERROR_BASE + 21),
     51 SSL_ERROR_UNKNOWN_CIPHER_SUITE		= (SSL_ERROR_BASE + 22),
     52 SSL_ERROR_NO_CIPHERS_SUPPORTED		= (SSL_ERROR_BASE + 23),
     53 SSL_ERROR_BAD_BLOCK_PADDING		= (SSL_ERROR_BASE + 24),
     54 SSL_ERROR_RX_RECORD_TOO_LONG		= (SSL_ERROR_BASE + 25),
     55 SSL_ERROR_TX_RECORD_TOO_LONG		= (SSL_ERROR_BASE + 26),
     56 /*
     57  * Received a malformed (too long or short) SSL handshake.
     58  */
     59 SSL_ERROR_RX_MALFORMED_HELLO_REQUEST	= (SSL_ERROR_BASE + 27),
     60 SSL_ERROR_RX_MALFORMED_CLIENT_HELLO	= (SSL_ERROR_BASE + 28),
     61 SSL_ERROR_RX_MALFORMED_SERVER_HELLO	= (SSL_ERROR_BASE + 29),
     62 SSL_ERROR_RX_MALFORMED_CERTIFICATE	= (SSL_ERROR_BASE + 30),
     63 SSL_ERROR_RX_MALFORMED_SERVER_KEY_EXCH	= (SSL_ERROR_BASE + 31),
     64 SSL_ERROR_RX_MALFORMED_CERT_REQUEST	= (SSL_ERROR_BASE + 32),
     65 SSL_ERROR_RX_MALFORMED_HELLO_DONE	= (SSL_ERROR_BASE + 33),
     66 SSL_ERROR_RX_MALFORMED_CERT_VERIFY	= (SSL_ERROR_BASE + 34),
     67 SSL_ERROR_RX_MALFORMED_CLIENT_KEY_EXCH	= (SSL_ERROR_BASE + 35),
     68 SSL_ERROR_RX_MALFORMED_FINISHED 	= (SSL_ERROR_BASE + 36),
     69 /*
     70  * Received a malformed (too long or short) SSL record.
     71  */
     72 SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER 	= (SSL_ERROR_BASE + 37),
     73 SSL_ERROR_RX_MALFORMED_ALERT	 	= (SSL_ERROR_BASE + 38),
     74 SSL_ERROR_RX_MALFORMED_HANDSHAKE 	= (SSL_ERROR_BASE + 39),
     75 SSL_ERROR_RX_MALFORMED_APPLICATION_DATA	= (SSL_ERROR_BASE + 40),
     76 /*
     77  * Received an SSL handshake that was inappropriate for the state we're in.
     78  * E.g. Server received message from server, or wrong state in state machine.
     79  */
     80 SSL_ERROR_RX_UNEXPECTED_HELLO_REQUEST	= (SSL_ERROR_BASE + 41),
     81 SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO	= (SSL_ERROR_BASE + 42),
     82 SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO	= (SSL_ERROR_BASE + 43),
     83 SSL_ERROR_RX_UNEXPECTED_CERTIFICATE	= (SSL_ERROR_BASE + 44),
     84 SSL_ERROR_RX_UNEXPECTED_SERVER_KEY_EXCH	= (SSL_ERROR_BASE + 45),
     85 SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST	= (SSL_ERROR_BASE + 46),
     86 SSL_ERROR_RX_UNEXPECTED_HELLO_DONE	= (SSL_ERROR_BASE + 47),
     87 SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY	= (SSL_ERROR_BASE + 48),
     88 SSL_ERROR_RX_UNEXPECTED_CLIENT_KEY_EXCH	= (SSL_ERROR_BASE + 49),
     89 SSL_ERROR_RX_UNEXPECTED_FINISHED 	= (SSL_ERROR_BASE + 50),
     90 /*
     91  * Received an SSL record that was inappropriate for the state we're in.
     92  */
     93 SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER 	= (SSL_ERROR_BASE + 51),
     94 SSL_ERROR_RX_UNEXPECTED_ALERT	 	= (SSL_ERROR_BASE + 52),
     95 SSL_ERROR_RX_UNEXPECTED_HANDSHAKE 	= (SSL_ERROR_BASE + 53),
     96 SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA= (SSL_ERROR_BASE + 54),
     97 /*
     98  * Received record/message with unknown discriminant.
     99  */
    100 SSL_ERROR_RX_UNKNOWN_RECORD_TYPE	= (SSL_ERROR_BASE + 55),
    101 SSL_ERROR_RX_UNKNOWN_HANDSHAKE 		= (SSL_ERROR_BASE + 56),
    102 SSL_ERROR_RX_UNKNOWN_ALERT 		= (SSL_ERROR_BASE + 57),
    103 /*
    104  * Received an alert reporting what we did wrong.  (more alerts above)
    105  */
    106 SSL_ERROR_CLOSE_NOTIFY_ALERT 		= (SSL_ERROR_BASE + 58),
    107 SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT 	= (SSL_ERROR_BASE + 59),
    108 SSL_ERROR_DECOMPRESSION_FAILURE_ALERT 	= (SSL_ERROR_BASE + 60),
    109 SSL_ERROR_HANDSHAKE_FAILURE_ALERT 	= (SSL_ERROR_BASE + 61),
    110 SSL_ERROR_ILLEGAL_PARAMETER_ALERT 	= (SSL_ERROR_BASE + 62),
    111 SSL_ERROR_UNSUPPORTED_CERT_ALERT 	= (SSL_ERROR_BASE + 63),
    112 SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT 	= (SSL_ERROR_BASE + 64),
    113 
    114 SSL_ERROR_GENERATE_RANDOM_FAILURE	= (SSL_ERROR_BASE + 65),
    115 SSL_ERROR_SIGN_HASHES_FAILURE		= (SSL_ERROR_BASE + 66),
    116 SSL_ERROR_EXTRACT_PUBLIC_KEY_FAILURE	= (SSL_ERROR_BASE + 67),
    117 SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE	= (SSL_ERROR_BASE + 68),
    118 SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE	= (SSL_ERROR_BASE + 69),
    119 
    120 SSL_ERROR_ENCRYPTION_FAILURE		= (SSL_ERROR_BASE + 70),
    121 SSL_ERROR_DECRYPTION_FAILURE		= (SSL_ERROR_BASE + 71), /* don't use */
    122 SSL_ERROR_SOCKET_WRITE_FAILURE		= (SSL_ERROR_BASE + 72),
    123 
    124 SSL_ERROR_MD5_DIGEST_FAILURE		= (SSL_ERROR_BASE + 73),
    125 SSL_ERROR_SHA_DIGEST_FAILURE		= (SSL_ERROR_BASE + 74),
    126 SSL_ERROR_MAC_COMPUTATION_FAILURE	= (SSL_ERROR_BASE + 75),
    127 SSL_ERROR_SYM_KEY_CONTEXT_FAILURE	= (SSL_ERROR_BASE + 76),
    128 SSL_ERROR_SYM_KEY_UNWRAP_FAILURE	= (SSL_ERROR_BASE + 77),
    129 SSL_ERROR_PUB_KEY_SIZE_LIMIT_EXCEEDED	= (SSL_ERROR_BASE + 78),
    130 SSL_ERROR_IV_PARAM_FAILURE		= (SSL_ERROR_BASE + 79),
    131 SSL_ERROR_INIT_CIPHER_SUITE_FAILURE	= (SSL_ERROR_BASE + 80),
    132 SSL_ERROR_SESSION_KEY_GEN_FAILURE	= (SSL_ERROR_BASE + 81),
    133 SSL_ERROR_NO_SERVER_KEY_FOR_ALG		= (SSL_ERROR_BASE + 82),
    134 SSL_ERROR_TOKEN_INSERTION_REMOVAL	= (SSL_ERROR_BASE + 83),
    135 SSL_ERROR_TOKEN_SLOT_NOT_FOUND		= (SSL_ERROR_BASE + 84),
    136 SSL_ERROR_NO_COMPRESSION_OVERLAP	= (SSL_ERROR_BASE + 85),
    137 SSL_ERROR_HANDSHAKE_NOT_COMPLETED	= (SSL_ERROR_BASE + 86),
    138 SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE	= (SSL_ERROR_BASE + 87),
    139 SSL_ERROR_CERT_KEA_MISMATCH		= (SSL_ERROR_BASE + 88),
    140 /* SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA became obsolete in NSS 3.14. */
    141 SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA	= (SSL_ERROR_BASE + 89),
    142 SSL_ERROR_SESSION_NOT_FOUND		= (SSL_ERROR_BASE + 90),
    143 
    144 SSL_ERROR_DECRYPTION_FAILED_ALERT	= (SSL_ERROR_BASE + 91),
    145 SSL_ERROR_RECORD_OVERFLOW_ALERT		= (SSL_ERROR_BASE + 92),
    146 SSL_ERROR_UNKNOWN_CA_ALERT		= (SSL_ERROR_BASE + 93),
    147 SSL_ERROR_ACCESS_DENIED_ALERT		= (SSL_ERROR_BASE + 94),
    148 SSL_ERROR_DECODE_ERROR_ALERT		= (SSL_ERROR_BASE + 95),
    149 SSL_ERROR_DECRYPT_ERROR_ALERT		= (SSL_ERROR_BASE + 96),
    150 SSL_ERROR_EXPORT_RESTRICTION_ALERT	= (SSL_ERROR_BASE + 97),
    151 SSL_ERROR_PROTOCOL_VERSION_ALERT	= (SSL_ERROR_BASE + 98),
    152 SSL_ERROR_INSUFFICIENT_SECURITY_ALERT	= (SSL_ERROR_BASE + 99),
    153 SSL_ERROR_INTERNAL_ERROR_ALERT		= (SSL_ERROR_BASE + 100),
    154 SSL_ERROR_USER_CANCELED_ALERT		= (SSL_ERROR_BASE + 101),
    155 SSL_ERROR_NO_RENEGOTIATION_ALERT	= (SSL_ERROR_BASE + 102),
    156 
    157 SSL_ERROR_SERVER_CACHE_NOT_CONFIGURED	= (SSL_ERROR_BASE + 103),
    158 
    159 SSL_ERROR_UNSUPPORTED_EXTENSION_ALERT		= (SSL_ERROR_BASE + 104),
    160 SSL_ERROR_CERTIFICATE_UNOBTAINABLE_ALERT	= (SSL_ERROR_BASE + 105),
    161 SSL_ERROR_UNRECOGNIZED_NAME_ALERT		= (SSL_ERROR_BASE + 106),
    162 SSL_ERROR_BAD_CERT_STATUS_RESPONSE_ALERT	= (SSL_ERROR_BASE + 107),
    163 SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT		= (SSL_ERROR_BASE + 108),
    164 
    165 SSL_ERROR_RX_UNEXPECTED_NEW_SESSION_TICKET = (SSL_ERROR_BASE + 109),
    166 SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET  = (SSL_ERROR_BASE + 110),
    167 
    168 SSL_ERROR_DECOMPRESSION_FAILURE		= (SSL_ERROR_BASE + 111),
    169 SSL_ERROR_RENEGOTIATION_NOT_ALLOWED     = (SSL_ERROR_BASE + 112),
    170 SSL_ERROR_UNSAFE_NEGOTIATION            = (SSL_ERROR_BASE + 113),
    171 
    172 SSL_ERROR_RX_UNEXPECTED_UNCOMPRESSED_RECORD	= (SSL_ERROR_BASE + 114),
    173 
    174 SSL_ERROR_WEAK_SERVER_EPHEMERAL_DH_KEY  = (SSL_ERROR_BASE + 115),
    175 
    176 SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID	= (SSL_ERROR_BASE + 116),
    177 
    178 SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SSL2 = (SSL_ERROR_BASE + 117),
    179 SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_SERVERS = (SSL_ERROR_BASE + 118),
    180 SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_CLIENTS = (SSL_ERROR_BASE + 119),
    181 
    182 SSL_ERROR_INVALID_VERSION_RANGE		= (SSL_ERROR_BASE + 120),
    183 SSL_ERROR_CIPHER_DISALLOWED_FOR_VERSION	= (SSL_ERROR_BASE + 121),
    184 
    185 SSL_ERROR_RX_MALFORMED_HELLO_VERIFY_REQUEST = (SSL_ERROR_BASE + 122),
    186 SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST = (SSL_ERROR_BASE + 123),
    187 
    188 SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION = (SSL_ERROR_BASE + 124),
    189 
    190 SSL_ERROR_RX_UNEXPECTED_CERT_STATUS     = (SSL_ERROR_BASE + 125),
    191 
    192 SSL_ERROR_UNSUPPORTED_HASH_ALGORITHM = (SSL_ERROR_BASE + 126),
    193 SSL_ERROR_DIGEST_FAILURE = (SSL_ERROR_BASE + 127),
    194 SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM = (SSL_ERROR_BASE + 128),
    195 
    196 SSL_ERROR_BAD_CHANNEL_ID_DATA = (SSL_ERROR_BASE + 129),
    197 SSL_ERROR_INVALID_CHANNEL_ID_KEY = (SSL_ERROR_BASE + 130),
    198 SSL_ERROR_GET_CHANNEL_ID_FAILED = (SSL_ERROR_BASE + 131),
    199 
    200 SSL_ERROR_END_OF_LIST	/* let the c compiler determine the value of this. */
    201 } SSLErrorCodes;
    202 #endif /* NO_SECURITY_ERROR_ENUM */
    203 
    204 #endif /* __SSL_ERR_H_ */
    205