blob: f18c52889b59491593c1ba8f3d74f29509880d95 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*******************************************************************************
37 * Filename:
38 * ---------
39 * ssl_enums.h
40 *
41 * Project:
42 * --------
43 * MAUI
44 *
45 * Description:
46 * ------------
47 * This file contains enums of SSL API.
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 *==============================================================================
54 * HISTORY
55 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
56 *------------------------------------------------------------------------------
57 * removed!
58 *
59 * removed!
60 * removed!
61 * removed!
62 * removed!
63 *
64 * removed!
65 * removed!
66 * removed!
67 *
68 * removed!
69 * removed!
70 * removed!
71 *
72 * removed!
73 * removed!
74 * removed!
75 *
76 * removed!
77 * removed!
78 * removed!
79 *
80 * removed!
81 * removed!
82 * removed!
83 *
84 * removed!
85 * removed!
86 * removed!
87 *
88 * removed!
89 * removed!
90 * removed!
91 *
92 * removed!
93 * removed!
94 * removed!
95 *
96 * removed!
97 * removed!
98 * removed!
99 *
100 * removed!
101 * removed!
102 * removed!
103 *
104 * removed!
105 * removed!
106 * removed!
107 *
108 * removed!
109 * removed!
110 * removed!
111 *
112 *
113 *
114 *------------------------------------------------------------------------------
115 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
116 *==============================================================================
117 *******************************************************************************/
118#ifndef _SSL_ENUMS_H
119#define _SSL_ENUMS_H
120
121#if 0 /* XXX, CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
122/* under construction !*/
123/* under construction !*/
124/* under construction !*/
125/* under construction !*/
126/* under construction !*/
127/* under construction !*/
128/* under construction !*/
129/* under construction !*/
130/* under construction !*/
131/* under construction !*/
132/* under construction !*/
133/* under construction !*/
134/* under construction !*/
135/* under construction !*/
136/* under construction !*/
137/* under construction !*/
138/* under construction !*/
139/* under construction !*/
140/* under construction !*/
141/* under construction !*/
142/* under construction !*/
143/* under construction !*/
144/* under construction !*/
145/* under construction !*/
146/* under construction !*/
147/* under construction !*/
148/* under construction !*/
149/* under construction !*/
150/* under construction !*/
151/* under construction !*/
152/* under construction !*/
153/* under construction !*/
154/* under construction !*/
155/* under construction !*/
156/* under construction !*/
157/* under construction !*/
158/* under construction !*/
159/* under construction !*/
160/* under construction !*/
161/* under construction !*/
162/* under construction !*/
163/* under construction !*/
164/* under construction !*/
165/* under construction !*/
166/* under construction !*/
167/* under construction !*/
168/* under construction !*/
169/* under construction !*/
170/* under construction !*/
171/* under construction !*/
172/* under construction !*/
173/* under construction !*/
174/* under construction !*/
175/* under construction !*/
176/* under construction !*/
177/* under construction !*/
178/* under construction !*/
179/* under construction !*/
180/* under construction !*/
181/* under construction !*/
182/* under construction !*/
183/* under construction !*/
184/* under construction !*/
185/* under construction !*/
186/* under construction !*/
187/* under construction !*/
188/* under construction !*/
189/* under construction !*/
190/* under construction !*/
191/* under construction !*/
192/* under construction !*/
193/* under construction !*/
194/* under construction !*/
195/* under construction !*/
196/* under construction !*/
197/* under construction !*/
198#endif /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
199
200/***************************************************************************
201 * <GROUP Enums>
202 *
203 * Error code of SSL APIs.
204 ***************************************************************************/
205typedef enum {
206 SEC_ERROR_FS = -128, /* File system operation failed. */
207 SEC_ERROR_NULL_PTR = -127, /* No valid pointer to wrapper context. */
208
209 SEC_ERROR_LOCAL_IDENTITY_REQUESTED = -256, /* Server requested for client certificate. */
210 SEC_ERROR_NONE = 0x0000, /* No error. */
211 SEC_ERROR_PTR = 0x0001, /* Null pointer. */
212 SEC_ERROR_PARAM = 0x0002, /* Illegal parameter. */
213 SEC_ERROR_BUFFER_SIZE = 0x0003, /* Buffer too small. */
214 SEC_ERROR_WOULDBLOCK = -0x0004, /* I/O is blocking. */
215 //SEC_ERROR_WOULDBLOCK = 0x0004,
216 SEC_ERROR_TIMEOUT = 0x0005, /* Timeout. */
217 SEC_ERROR_BAD_LEN = 0x0006, /* Bad length. */
218 SEC_ERROR_NOT_FOUND = 0x0007, /* Object not found. */
219 SEC_ERROR_BAD_CTX = 0x0008, /* Bad context. */
220 SEC_ERROR_BAD_IDX = 0x0009, /* Bad index. */
221 SEC_ERROR_RANDOM = 0x000A, /* Entropy generation. */
222 SEC_ERROR_MEM_UNDERRUN = 0x000B, /* Memory no enough. */
223 SEC_ERROR_MEM_OVERRUN = 0x000C, /* Memory overrun. */
224 SEC_ERROR_MEM_FREED = 0x000D, /* CIC_ERR_MEM_WAS_FREED */
225 SEC_ERROR_MEM_NOT_OURS = 0x000E, /* Duplicate free. */
226 SEC_ERROR_MEM_ZERO = 0x000F, /* Freeing unallocated memory. */
227
228 SEC_ERROR_BAD_DER_ENCODING = 0x0218, /* Bad DER encoding. */
229 SEC_ERROR_INCOMPLETE_ID = 0x1001, /* The identity doesn't contain both a private key and a certificate */
230 SEC_ERROR_SSL_BAD_SIDE = 0x1002, /* Incorrect connection side. */
231 SEC_ERROR_SSL_OVERFLOW = 0x1003, /* A record exceeds the size of the read/write buffer. */
232 SEC_ERROR_SSL_UNEXP_MSG = 0x1004, /* Received an unexpected messasge. */
233 SEC_ERROR_SSL_BAD_MAC = 0x1005, /* The record MAC is incorrect. */
234 SEC_ERROR_SSL_DECRYPT = 0x1006, /* Decrypting message failed. */
235 SEC_ERROR_SSL_UNKNOWN_REC = 0x1007, /* Unknown record type. */
236 SEC_ERROR_SSL_NEGOTIATION = 0x1008, /* Renegotiation failed. */
237 SEC_ERROR_SSL_IO = -0x1009, /* I/O error. */
238 SEC_ERROR_SSL_FATAL_ALERT = 0x100A, /* Fatal alert happened. */
239 SEC_ERROR_SSL_PROTOCOL = 0x100B, /* SSL protocol error. */
240 SEC_ERROR_SSL_RESUME_SESS = 0x100C, /* Peer is resuming a session with different parameters. */
241 SEC_ERROR_SSL_BAD_FIN_MSG = 0x100D, /* Received bad "Finished" message. */
242 SEC_ERROR_SSL_GRACE_CLOSED = 0x100E, /* SSL connection is closed with graceful manner. */
243 SEC_ERROR_SSL_CLOSED = 0x100F, /* SSL connection is closed. */
244 SEC_ERROR_SSL_BAD_CERT = 0x1011, /* Bad certificate. */
245 SEC_ERROR_SSL_SESS_NOT_FOUND= 0x1013, /* Session was not found in session DB. */
246 SEC_ERROR_SSL_PROTOCOL_VER = 0x1019, /* Bad protocol version. */
247 SEC_ERROR_SSL_NO_CERT = 0x101E, /* Peer sends no certificate */
248 SEC_ERROR_SSL_NO_MATCHING_CERTS = 0x101F, /* The certificate is not signed by trusted CA. */
249 SEC_ERROR_SSL_CERT_VALIDATE_FAILED = 0x1020, /* User's validation callback returns error. */
250 SEC_ERROR_SSL_NULL_CB = 0x1022, /* Passed NULL callback. */
251 SEC_ERROR_SSL_ENTROPY = 0x1024, /* The entropy fail to generate enough seeds. */
252 SEC_ERROR_SSL_BAD_CONTEXT = 0x102F, /* Incorrect SSL context. */
253 SEC_ERROR_SSL_HSHK_REQUIRED = 0x1030, /* Handshake required for the operation. */
254 SEC_ERROR_SSL_HSHK_REQUESTED= 0x1031, /* Handshake request by peer. */
255 SEC_ERROR_SSL_RENEGOTIATE_REFUSED = 0x1032,/* Rehandshake refused by peer. */
256 SEC_ERROR_SSL_HSHK_COMPLETED = 0x1033,/* Handshake already completed. */
257 SEC_ERROR_SSL_READ_REQUIRED = 0x1035, /* There is application data to be read before handshake. */
258 SEC_ERROR_SSL_UNSUPP_PUBKEY = 0x1036, /* Unsupported public key type. */
259 SEC_ERROR_SSL_BAD_REC_LEN = 0x1037, /* Bad record length. */
260 SEC_ERROR_SSL_NEEDS_CIPHER = 0x1038, /* No cipher suites provided. */
261 SEC_ERROR_SSL_NEEDS_PRNG = 0x103B, /* No PRNG suite is installed. */
262 SEC_ERROR_SSL_CERT_CHAIN_WARN = 0x103C, /* There are warnings in the validation. */
263 SEC_ERROR_SSL_TRUSTED_EXPIRED = 0x103D,/* The certificate is expired. */
264 SEC_ERROR_SSL_NO_TRUSTED_ISSUER = 0x1046,/* No trusted issuer was found while verifing certificate. */
265 SEC_ERROR_SSL_INVALID_CERT_CHAIN = 0x1053,/* The certificate chain is invalid. */
266 SEC_ERROR_SSL_COMPRESS_CALLBACK = 0x1056,/* The compression callback returned an error. */
267 SEC_ERROR_SSL_COMPRESS_EX_MAX_LEN = 0x1057,/* The decompressed output is greater than 2^14 bytes. */
268 SEC_ERROR_SSL_INTERNAL_TP_VALIDATE= 0x106B,/* Unexpected error in certificate chain validation. */
269
270 SEC_ERROR_BAD_ENCODING = 0x0221, /* Bad encoding. */
271 SEC_ERROR_BAD_PEM = 0x0222, /* Bad PEM encoding. */
272 SEC_ERROR_NOT_IMPL = 0x0FFE, /* Feature not implemneted. */
273 SEC_ERROR_INTERNAL = 0x0FFF, /* SSL library internal error. */
274 SEC_ERROR_MEM = 0xF001, /* Memory error. */
275 SEC_ERROR_UNKNOWN = 0xFFFF /* Other errors. */
276} ssl_error_enum;
277
278
279
280/***************************************************************************
281 * <GROUP Enums>
282 *
283 * SSL alert levels, Ref. RFC 4346, Section 7.2.
284 ***************************************************************************/
285typedef enum {
286 SSL_AL_LEVEL_WARNING = 1, /* Warning alert. */
287 SSL_AL_LEVEL_FATAL = 2, /* Fatal alert, application MUST terminate the connection immediately. */
288 SSL_AL_LEVEL_MAX = 255
289} ssl_alert_level;
290
291
292
293/***************************************************************************
294 * <GROUP Enums>
295 *
296 * SSL alert descriptions, Ref. RFC 4346, Section 7.2.2.
297 ***************************************************************************/
298typedef enum {
299 SSL_AL_DESC_CLOSE_NOTIFY = 0, /* Peer shuts down the connection. */
300 SSL_AL_DESC_UNEXPECTED_MESSAGE = 10, /* Received an unexped mesage, always a fatal. */
301 SSL_AL_DESC_BAD_RECORD_MAC = 20, /* Bad MAC, always a fatal */
302 SSL_AL_DESC_DECRYPTION_FAILED = 21, /* Decryption failed, always a fatal. */
303 SSL_AL_DESC_RECORD_OVERFLOW = 22, /* Record size exceeds the limitation, always a fatal. */
304 SSL_AL_DESC_DECOMPRESSION_FAILURE = 30, /* Deccompression failed, always a fatal. */
305 SSL_AL_DESC_HANDSHAKE_FAILURE = 40, /* Handshake failed, fatal. */
306 SSL_AL_DESC_NO_CERTIFICATE_reserved = 41, /* Response to a certification request if no appropriate certificate is available, SSLv3 only. */
307 SSL_AL_DESC_BAD_CERTIFICATE = 42, /* A certificate was corrupt, signatures that did not verify correctly. */
308 SSL_AL_DESC_UNSUPPORTED_CERTIFICATE = 43, /* Unsupported certificate type. */
309 SSL_AL_DESC_CERTIFICATE_REVOKED = 44, /* Received a revoked certificate from peer. */
310 SSL_AL_DESC_CERTIFICATE_EXPIRED = 45, /* A certificate has expired or not yet valid */
311 SSL_AL_DESC_CERTIFICATE_UNKNOWN = 46, /* Some unspecificate issue in processing the certificate. */
312 SSL_AL_DESC_ILLEGAL_PARAMETER = 47, /* Illegal parameter in the message, always a fatal. */
313 SSL_AL_DESC_UNKNOWN_CA = 48, /* The certificate chain cannot be verified successfully due to untrusted CA, always a fatal. */
314 SSL_AL_DESC_ACCESS_DENIED = 49, /* sender decided not to proceed with negotiation when access control was applied, always a fatal. */
315 SSL_AL_DESC_DECODE_ERROR = 50, /* The field in a message is incorrect, always a fatal. */
316 SSL_AL_DESC_DECRYPT_ERROR = 51, /* a handshake cryptographic operation failed, including verify a signature, decrypt a key exchange, or validate a finished mesasge */
317 SSL_AL_DESC_EXPORT_RESTRICTION_reserved = 60, /* A negotiation not in compliance with export restrictions was detected. */
318 SSL_AL_DESC_PROTOCOL_VERSION = 70, /* The protocol version proposed by client is not supported by server side, always a fatal. */
319 SSL_AL_DESC_INSUFFICIENT_SECURITY = 71, /* The server requires cphers more secure than those supported by the client, always a fatal. */
320 SSL_AL_DESC_INTERNAL_ERROR = 80, /* An internal error unrelated to the peer, always a fatal. */
321 SSL_AL_DESC_USER_CANCELED = 90, /* The handshake is canceled for some reason unrelated to a protocol failure, generally a warning. */
322 SSL_AL_DESC_NO_RENEGOTIATION = 100, /* When peer suggest to renegotiate again but local rejects it, always a warning */
323 SSL_AL_DESC_MAX = 255
324} ssl_alert_desc;
325
326
327
328/***************************************************************************
329 * <GROUP Enums>
330 *
331 * Inicating encoding of certificates passed to SSL APIs.
332 ***************************************************************************/
333typedef enum {
334 SEC_SSL_FILETYPE_PEM, /* PEM encoding */
335 SEC_SSL_FILETYPE_ASN1 /* DER encoding */
336} ssl_filetype_enum;
337
338
339#if 0 /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
340/* under construction !*/
341#endif /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
342
343/***************************************************************************
344 * <GROUP Enums>
345 *
346 * Client authentication modes to be used in the SSL context,
347 * Ref. sec_ssl_ctx_set_client_auth_modes().
348 ***************************************************************************/
349typedef enum {
350 RSA_SIGN_CLIENTSIDE = 0, /* RSA client side */
351 RSA_SIGN_SERVERSIDE = 1, /* RSA server side */
352 DSS_SIGN_CLIENTSIDE = 2, /* DSS(DSA) cient side */
353 DSS_SIGN_SERVERSIDE = 3, /* DSS(DSA) server side */
354 CLIENT_AUTH_MODE_END = 0xff,
355 SERVER_AUTH_MODE_END = CLIENT_AUTH_MODE_END,
356 SEC_AUTH_MODE_END = CLIENT_AUTH_MODE_END
357} ssl_auth_mode_enum;
358
359
360#if 0 /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
361/* under construction !*/
362/* under construction !*/
363#endif /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
364
365/***************************************************************************
366 * <GROUP Enums>
367 *
368 * Supported ciphersuites to be specified in sec_ssl_ctx_set_cipher_list().
369 ***************************************************************************/
370typedef enum {
371 /* SSLv2, SSLv3, TLSv1 cipher suites */
372 NULL_MD5 = 0, /* 0x0001, TLS_RSA_WITH_NULL_MD5 */
373 EXP_RC4_MD5 = 1, /* 0x0003, TLS_RSA_EXPORT_WITH_RC4_40_MD5 */
374 RC4_MD5 = 2, /* 0x0004, TLS_RSA_WITH_RC4_128_MD5 */
375 RC4_SHA = 3, /* 0x0005, TLS_RSA_WITH_RC4_128_SHA, TLS Profile MUST */
376 EXP_DES_CBC_SHA = 4, /* 0x0008, TLS_RSA_EXPORT_WITH_DES40_CBC_SHA */
377 DES_CBC_SHA = 5, /* 0x0009, TLS_RSA_WITH_DES_CBC_SHA */
378 DES_CBC3_SHA = 6, /* 0x000A, TLS_RSA_WITH_3DES_EDE_CBC_SHA, TLS Profile MUST */
379 EXP_EDH_DSS_DES_CBC_SHA = 7, /* 0x0011, TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA */
380 EDH_DSS_CBC_SHA = 8, /* 0x0012, TLS_DHE_DSS_WITH_DES_CBC_SHA */
381 EDH_DSS_DES_CBC3_SHA = 9, /* 0x0013, TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA */
382 EXP_EDH_RSA_DES_CBC_SHA = 10, /* 0x0014, TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA */
383 EDH_RSA_DES_CBC_SHA = 11, /* 0x0015, TLS_DHE_RSA_WITH_DES_CBC_SHA */
384 EDH_RSA_DES_CBC3_SHA = 12, /* 0x0016, TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA */
385 EXP_ADH_RC4_MD5 = 13, /* 0x0017, TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 */
386 ADH_RC4_MD5 = 14, /* 0x0018, TLS_DH_anon_WITH_RC4_128_MD5 */
387 EXP_ADH_DES_CBC_SHA = 15, /* 0x0019, TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA */
388 ADH_DES_CBC_SHA = 16, /* 0x001A, TLS_DH_anon_WITH_DES_CBC_SHA */
389 ADH_DES_CBC3_SHA = 17, /* 0x001B, TLS_DH_anon_WITH_3DES_EDE_CBC_SHA */
390
391 /* AES ciphersuites from RFC 3268, extending TLS v1.0 */
392 AES128_SHA = 18, /* 0x002F, TLS_RSA_WITH_AES_128_CBC_SHA */
393 AES256_SHA = 19, /* 0x0035, TLS_RSA_WITH_AES_256_CBC_SHA */
394
395 /* Additional Extport 1024 and other ciphersuites */
396 EXP1024_DES_CBC_SHA = 20, /* 0x0062, TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA */
397 EXP1024_RC4_SHA = 21, /* 0x0064, TLS_RSA_EXPORT1024_WITH_RC4_56_SHA */
398 DHE_DSS_RC4_SHA = 22, /* 0x0066, TLS_DHE_DSS_WITH_RC4_128_SHA */
399
400 /* ECDH */
401 ECDH_SECT163K1_RC4_SHA = 23, /* 0xC002 in RFC 4492, TLS_ECDH_ECDSA_WITH_RC4_128_SHA */
402 ECDH_SECT163K1_NULL_SHA = 24, /* 0xC001 in RFC 4492, TLS_ECDH_ECDSA_WITH_NULL_SHA */
403
404 /* PSK */
405 PSK_AES128_SHA = 25, /* 0x008C in RFC 4279, TLS_PSK_WITH_AES_128_CBC_SHA */
406 PSK_DES_CBC3_SHA = 26, /* 0x008B in RFC 4279, TLS_PSK_WITH_3DES_EDE_CBC_SHA */
407#ifdef __OPENSSL_TLS12__//Start TLS related ciphersuites
408 ECDHE_ECDSA_AES128_GCM_SHA256=27,
409 ECDHE_RSA_AES128_GCM_SHA256=28,
410 ECDHE_ECDSA_AES128_SHA256=29,
411 ECDHE_RSA_AES128_SHA256=30,
412 ECDHE_ECDSA_AES128_SHA=31,
413 ECDHE_RSA_AES128_SHA=32,
414 AES128_GCM_SHA256=33,
415 AES128_SHA256=34,
416 ECDHE_RSA_AES256_SHA=35,
417 ECDHE_ECDSA_AES256_SHA=36,
418 RSA_AES256_GCM_SHA384=37,
419#endif //END of TLS related ciphersuites
420 SEC_TOTAL_CIPHER_NUM
421} sec_cipher_enum;
422
423
424/***************************************************************************
425 * <GROUP Enums>
426 *
427 * SSL protocol versions, Ref. sec_cipher_info_struct().
428 ***************************************************************************/
429typedef enum
430{
431 SSL_VERSION_UNKNOWN = 0,
432 SSL_VERSION_SSLV2, /* SSLv2 */
433 SSL_VERSION_SSLV3, /* SSLv3 */
434 SSL_VERSION_TLSV1, /* TLSv1 */
435 SSL_VERSION_DTLSV1 /* DTLSv1 */
436} sec_proto_ver_enum;
437
438
439/***************************************************************************
440 * <GROUP Enums>
441 *
442 * SSL encryption algorithms, Ref. sec_cipher_info_struct().
443 ***************************************************************************/
444typedef enum
445{
446 SEC_ENC_ALGO_UNKNOWN,
447 SEC_ENC_ALGO_NULL, /* NULL */
448
449 SEC_ENC_ALGO_DES_40, /* DES 40 */
450 SEC_ENC_ALGO_DES, /* DES(56) */
451 SEC_ENC_ALGO_3DES, /* 3DES */
452
453 SEC_ENC_ALGO_RC5, /* RC5 */
454 SEC_ENC_ALGO_RC5_56, /* RC5_56 */
455
456 SEC_ENC_ALGO_AES_128, /* AES_128 */
457 SEC_ENC_ALGO_AES_192, /* AES_192, new for OpenSSL */
458 SEC_ENC_ALGO_AES_256, /* AES_256 */
459
460 SEC_ENC_ALGO_ARC4_40, /* RC4_40 */
461 SEC_ENC_ALGO_ARC4_56, /* RC4_56, new for OpenSSL */
462 SEC_ENC_ALGO_ARC4_64, /* RC4_64, new for OpenSSL */
463 SEC_ENC_ALGO_ARC4_128, /* RC4_128 */
464
465 SEC_ENC_ALGO_ARC2_40, /* RC2_40 */
466 SEC_ENC_ALGO_ARC2_56, /* RC2_56, new for OpenSSL */
467 SEC_ENC_ALGO_ARC2_64, /* RC4_64 */
468 SEC_ENC_ALGO_ARC2_128 /* RC2_128 */
469} sec_bulk_enc_algo_enum;
470
471
472
473/***************************************************************************
474 * <GROUP Enums>
475 *
476 * SSL key exchange algorithms, Ref. sec_cipher_info_struct().
477 ***************************************************************************/
478typedef enum
479{
480 SEC_KEY_ALGO_UNKNOWN,
481 SEC_KEY_ALGO_RSA, /* RSA */
482 SEC_KEY_ALGO_RSA_EXPORT, /* RSA_EXPORT */
483 SEC_KEY_ALGO_DH, /* DH */
484 SEC_KEY_ALGO_DH_EXPORT, /* DH_EXPORT */
485 SEC_KEY_ALGO_DHE, /* DH */
486 SEC_KEY_ALGO_DHE_EXPORT, /* DH_EXPORT */
487 SEC_KEY_ALGO_ECDH, /* ECDH */
488 SEC_KEY_ALGO_ECDHE, /* ECDHE */
489 SEC_KEY_ALGO_ECMQV, /* ECMQV */
490 SEC_KEY_ALGO_DSA, /* DSA */
491 SEC_KEY_ALGO_PSK, /* PSK */
492 SEC_KEY_ALGO_DHE_PSK, /* DHE_PSK */
493 SEC_KEY_ALGO_RSA_PSK, /* RSA_PSK */
494 SEC_KEY_ALGO_MAX
495} sec_key_xchg_algo_enum;
496
497
498
499/***************************************************************************
500 * <GROUP Enums>
501 *
502 * SSL server authentication algorithms, Ref. sec_cipher_info_struct().
503 ***************************************************************************/
504typedef enum
505{
506 SEC_AUTH_ALGO_UNKNOWN,
507 SEC_AUTH_ALGO_ANON, /* ANON */
508 SEC_AUTH_ALGO_RSA, /* RSA */
509 SEC_AUTH_ALGO_DSS, /* DSS */
510 SEC_AUTH_ALGO_ECDSA, /* ECDSA */
511 SEC_AUTH_ALGO_PSK /* PSK */
512} sec_auth_algo_enum;
513
514
515
516/***************************************************************************
517 * <GROUP Enums>
518 *
519 * SSL message digest algorithms, Ref. sec_cipher_info_struct().
520 ***************************************************************************/
521typedef enum
522{
523 SEC_HASH_UNKNOWN,
524 SEC_HASH_MD2, /* MD2 */
525 SEC_HASH_MD4, /* MD4 */
526 SEC_HASH_MD5, /* MD5 */
527 SEC_HASH_SHA1, /* SHA1 */
528 SEC_HASH_SHA224, /* SHA224 */
529 SEC_HASH_SHA256, /* SHA256 */
530 SEC_HASH_SHA384, /* SHA384 */
531 SEC_HASH_SHA512 /* SHA512 */
532} sec_hash_algo_enum;
533
534
535
536/***************************************************************************
537 * <GROUP Enums>
538 *
539 * Random number generator, Ref. sec_ssl_ctx_set_prng().
540 ***************************************************************************/
541typedef enum {
542 SEC_SSL_ANSIPRNG /* ANSI PRNG */
543} sec_ssl_prng_generator;
544
545
546
547/***************************************************************************
548 * <GROUP Enums>
549 *
550 * Ciphersuites, combination of authentication, key exchange, encryption,
551 * and hash algorithms.
552 ***************************************************************************/
553typedef enum {
554 SEC_CIPHER_NULL_WITH_NULL_NULL = 0x0000, /* (NULL, NULL, NULL)*/
555
556 SEC_CIPHER_RSA_WITH_NULL_MD5 = 0x0001, /* (RSA, NULL, MD5) */
557 SEC_CIPHER_RSA_WITH_NULL_SHA = 0x0002, /* (RSA, NULL, SHA) */
558 SEC_CIPHER_RSA_EXPORT_WITH_RC4_40_MD5 = 0x0003, /* (RSA_EXPORT, RC4_40), MD5, TLS 1.0 */
559 SEC_CIPHER_RSA_WITH_RC4_128_MD5 = 0x0004, /* (RSA, RC4_128, MD5) */
560 SEC_CIPHER_RSA_WITH_RC4_128_SHA = 0x0005, /* (RSA, RC4_128, SHA) */
561 SEC_CIPHER_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x0006, /* (RSA_EXPORT, RC2_CBC_40, MD5), TLS 1.0 */
562 SEC_CIPHER_RSA_WITH_IDEA_CBC_SHA = 0x0007, /* (RSA, IDEA_CBC, SHA) */
563 SEC_CIPHER_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0008, /* (RSA_EXPORT, DES40_CBC, SHA), TLS 1.0 */
564 SEC_CIPHER_RSA_WITH_DES_CBC_SHA = 0x0009, /* (RSA, DES_CBC, SHA) */
565 SEC_CIPHER_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A, /* (RSA, 3DES_EDE_CBC, SHA) */
566
567 SEC_CIPHER_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x000B, /* (DH_DSS_EXPORT, DES40_CBC, SHA), TLS 1.0 */
568 SEC_CIPHER_DH_DSS_WITH_DES_CBC_SHA = 0x000C, /* (DH_DSS, DES_CBC, SHA) */
569 SEC_CIPHER_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x000D, /* (DH_DSS, 3DES_EDE_CBC, SHA) */
570 SEC_CIPHER_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x000E, /* (DH_RSA_EXPORT, DES40_CBC, SHA), TLS 1.0 */
571 SEC_CIPHER_DH_RSA_WITH_DES_CBC_SHA = 0x000F, /* (DH_RSA, DES_CBC, SHA) */
572 SEC_CIPHER_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x0010, /* (DH_RSA, 3DES_EDE_CBC, SHA) */
573 SEC_CIPHER_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0011, /* (DHE_DSS_EXPORT, DES40_CBC, SHA), TLS 1.0 */
574 SEC_CIPHER_DHE_DSS_WITH_DES_CBC_SHA = 0x0012, /* (DHE_DSS, DES_CBCi, SHA) */
575 SEC_CIPHER_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x0013, /* (DHE_DSS, 3DES_EDE_CBC, SHA) */
576 SEC_CIPHER_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0014, /* (DHE_RSA_EXPORT, DES40_CBC, SHA), TLS 1.0 */
577 SEC_CIPHER_DHE_RSA_WITH_DES_CBC_SHA = 0x0015, /* (DHE_RSA, DES_CBCi, SHA) */
578 SEC_CIPHER_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016, /* (DHE_RSA, 3DES_EDE_CBC, SHA) */
579
580 SEC_CIPHER_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x0017, /* (DH_anon_EXPORT, RC4_40, MD5), TLS 1.0 */
581 SEC_CIPHER_DH_anon_WITH_RC4_128_MD5 = 0x0018, /* (DH_anon, RC4_128, MD5) */
582 SEC_CIPHER_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x0019, /* (DH_anon, DES40_CBC, SHA), TLS 1.0 */
583 SEC_CIPHER_DH_anon_WITH_DES_CBC_SHA = 0x001A, /* (DH_anon, DES_CBC, SHA) */
584 SEC_CIPHER_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x001B, /* (DH_anon, DES_CBC, SHA) */
585
586 SEC_CIPHER_KRB5_WITH_DES_CBC_SHA = 0x001E, /* (Kerberos, DES_CBC, SHA) */
587 SEC_CIPHER_KRB5_WITH_3DES_EDE_CBC_SHA = 0x001F, /* (Kerberos, 3DES_EDE_CBC, SHA) */
588 SEC_CIPHER_KRB5_WITH_RC4_128_SHA = 0x0020, /* (Kerberos, RC4_128, SHA) */
589 SEC_CIPHER_KRB5_WITH_IDEA_CBC_SHA = 0x0021, /* (Kerberos, IDEA_CBC, SHA) */
590 SEC_CIPHER_KRB5_WITH_DES_CBC_MD5 = 0x0022, /* (Kerberos, DES_CBC, MD5) */
591 SEC_CIPHER_KRB5_WITH_3DES_EDE_CBC_MD5 = 0x0023, /* (Kerberos, 3DES_EDE_CBC, MD5) */
592 SEC_CIPHER_KRB5_WITH_RC4_128_MD5 = 0x0024, /* (Kerberos, RC4_128, MD5) */
593 SEC_CIPHER_KRB5_WITH_IDEA_CBC_MD5 = 0x0025, /* (Kerberos, IDEA_CBC, MD5) */
594
595 SEC_CIPHER_KRB5_EXPORT_WITH_DES_CBC_40_SHA = 0x0026, /* (Kerberos, DES_CBC_40, SHA), MUST NOT */
596 SEC_CIPHER_KRB5_EXPORT_WITH_RC2_CBC_40_SHA = 0x0027, /* (Kerberos, RC2_CBC_40, SHA), MUST NOT */
597 SEC_CIPHER_KRB5_EXPORT_WITH_RC4_40_SHA = 0x0028, /* (Kerberos, RC4_40, SHA), MUST NOT */
598 SEC_CIPHER_KRB5_EXPORT_WITH_DES_CBC_40_MD5 = 0x0029, /* (Kerberos, DES_DBC_40, MD5), MUST NOT */
599 SEC_CIPHER_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 = 0x002A, /* (Kerberos, RC2_CBC_40, MD5), MUST NOT */
600 SEC_CIPHER_KRB5_EXPORT_WITH_RC4_40_MD5 = 0x002B, /* (Kerberos, RC4_40, MD5), MUST NOT */
601
602 SEC_CIPHER_RSA_WITH_AES_128_CBC_SHA = 0x002F, /* (RSA, AES_128_CBC, SHA) */
603 SEC_CIPHER_DH_DSS_WITH_AES_128_CBC_SHA = 0x0030, /* (DH_DSS, AES_128_CBC, SHA) */
604 SEC_CIPHER_DH_RSA_WITH_AES_128_CBC_SHA = 0x0031, /* (DH_RSA, AES_128_CBC, SHA) */
605 SEC_CIPHER_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032, /* (DHE_DSS, AES_128_CBC, SHA) */
606 SEC_CIPHER_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033, /* (DHE_RSA, AES_128_CBC, SHA) */
607 SEC_CIPHER_DH_anon_WITH_AES_128_CBC_SHA = 0x0034, /* (DH_anon, AES_128_CBC, SHA) */
608 SEC_CIPHER_RSA_WITH_AES_256_CBC_SHA = 0x0035, /* (RSA, AES_256_CBC, SHA) */
609 SEC_CIPHER_DH_DSS_WITH_AES_256_CBC_SHA = 0x0036, /* (DH_DSS, AES_256_CBC, SHA) */
610 SEC_CIPHER_DH_RSA_WITH_AES_256_CBC_SHA = 0x0037, /* (DHE_RSA, AES_256_CBC, SHA) */
611 SEC_CIPHER_DHE_DSS_WITH_AES_256_CBC_SHA = 0x0038, /* (DHE_RSA, AES_256_CBC, SHA) */
612 SEC_CIPHER_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039, /* (DH_anon, AES_256_CBC, SHA) */
613 SEC_CIPHER_DH_anon_WITH_AES_256_CBC_SHA = 0x003A, /* (DH_anon, AES_256_CBC, SHA) */
614#ifdef __OPENSSL_TLS12__//Start TLS related ciphersuites
615 SEC_CIPHER_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256= 0x003B,
616 SEC_CIPHER_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0x003C,
617 SEC_CIPHER_ECDHE_ECDSA_WITH_AES_128_SHA256 = 0x003D,
618 SEC_CIPHER_ECDHE_RSA_WITH_AES_128_SHA256 = 0x003E,
619 SEC_CIPHER_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0x003F,
620 SEC_CIPHER_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0x004A,
621 SEC_CIPHER_RSA_WITH_AES_128_GCM_SHA256 = 0x004B,
622 SEC_CIPHER_RSA_WITH_AES_128_SHA256 = 0x004C,
623 SEC_CIPHER_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0x004D,
624 SEC_CIPHER_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0x004E,
625#endif //END of TLS related ciphersuites
626 SEC_CIPHER_UNKNOWN = 0xFFFF
627} sec_ciphersuites_enum;
628
629
630
631#if 0 /* XXX, CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
632/* under construction !*/
633/* under construction !*/
634/* under construction !*/
635/* under construction !*/
636/* under construction !*/
637/* under construction !*/
638/* under construction !*/
639/* under construction !*/
640/* under construction !*/
641/* under construction !*/
642/* under construction !*/
643/* under construction !*/
644/* under construction !*/
645/* under construction !*/
646/* under construction !*/
647/* under construction !*/
648/* under construction !*/
649/* under construction !*/
650/* under construction !*/
651/* under construction !*/
652/* under construction !*/
653/* under construction !*/
654/* under construction !*/
655/* under construction !*/
656/* under construction !*/
657/* under construction !*/
658/* under construction !*/
659/* under construction !*/
660/* under construction !*/
661/* under construction !*/
662/* under construction !*/
663/* under construction !*/
664/* under construction !*/
665/* under construction !*/
666/* under construction !*/
667/* under construction !*/
668/* under construction !*/
669/* under construction !*/
670/* under construction !*/
671/* under construction !*/
672/* under construction !*/
673/* under construction !*/
674/* under construction !*/
675/* under construction !*/
676/* under construction !*/
677/* under construction !*/
678/* under construction !*/
679/* under construction !*/
680/* under construction !*/
681/* under construction !*/
682/* under construction !*/
683/* under construction !*/
684/* under construction !*/
685/* under construction !*/
686/* under construction !*/
687#endif /* CODING NOTE DO NOT SHOW IN DOM DOCUMENTS! */
688
689/***************************************************************************
690 * <GROUP Enums>
691 *
692 * Warnings of the certificate chain after validation
693 ***************************************************************************/
694typedef enum {
695 SEC_CERT_WARN_NONE = 0x00000000, /* Validation successfully. */
696 SEC_CERT_WARN_CHAIN = 0x00000001, /* The server responded with a chain of certificates rather than a single certificate. Don't care. */
697 SEC_CERT_WARN_BCONST_NOT_CRITICAL = 0x00000002, /* Basic Constraints field is present but marked as non-critical. */
698
699 SEC_CERT_WARN_UNKNOWN_CRITICAL_EXT = 0x00000008, /* Unknown critical extension in the certificate. */
700 SEC_CERT_WARN_VALIDITY = 0x00000010, /* A certificate was expired, or not yet invalid. */
701 SEC_CERT_WARN_NO_KEY_USAGE = 0x00000020, /* There is no key usage in one of the certificate in the chain. */
702 SEC_CERT_WARN_KEY_MISUSE = 0x00000040, /* One of the certificates in the chain is used not according to its key usage field. */
703 SEC_CERT_WARN_BCONST_FAIL = 0x00000100, /* One of the CA certificates in the chain does not have the CA bit set in its basic constraints extension */
704 SEC_CERT_WARN_NO_TRUSTED_CERTS = 0x00000200, /* There were no trusted certificates for this chain. */
705 SEC_CERT_WARN_INVALID_SIGNATURE = 0x00000400, /* Invalid signature. */
706 SEC_CERT_WARN_INTERNAL = 0x00000800, /* An error occured while processing a cert. */
707 SEC_CERT_WARN_TRUSTED_KEY_MISUSE = 0x00010000, /* Trusted certificate is a server certificate, not a CA certificate. */
708 SEC_CERT_WARN_TRUSTED_EXPIRED = 0x00020000, /* The chosen trusted cert has expired. */
709 SEC_CERT_WARN_CORRUPTED_CERT = 0x00040000, /* Certificate is corrupted. */
710 SEC_CERT_WARN_TRUSTED_NO_KEY_USAGE = 0x00080000, /* Trusted certificate cannot might be not a CA certificate. */
711 SEC_CERT_WARN_NO_CERT_HASH = 0x00100000, /* Hash is not present in the certificate. */
712
713 SEC_CERT_WARN_BAD_CERT = 0x00200000, /* The certificate cannot be decode successfully. */
714 SEC_CERT_WARN_BAD_CRL = 0x00400000, /* Error in CRL fields. */
715 SEC_CERT_WARN_CRL_EXPIRY = 0x00800000, /* The CRL has invalid date. */
716 SEC_CERT_WARN_CERT_PURPOSE = 0x01000000, /* The certificate cannot be used for the specified purpose. */
717 SEC_CERT_WARN_INVALID_KEY_USAGE = 0x02000000, /* Key usage does not include CRL signing. */
718 SEC_CERT_WARN_UNRECOGINZED_CRL_EXT = 0x04000000, /* Unhandled critical CRL extension. */
719 SEC_CERT_WARN_PROXY_CERT = 0x08000000, /* Error in validating proxy certificate. */
720 SEC_CERT_WARN_INVALID_EXT = 0x10000000, /* Invalid or inconsistent certificate extension. */
721 SEC_CERT_WARN_POLICY = 0x20000000, /* No explicit policy. */
722
723 SEC_CERT_WARN_BAD_DOMAIN = 0x40000000, /* Checking domain name failed. */
724
725 SEC_CERT_WARN_BCONST_FAIL_NC = 0x00000102, /* SEC_CERT_WARN_BCONST_FAIL | SEC_CERT_WARN_BCONST_NOT_CRITICAL.
726 Error in checking basic constraints */
727
728 SEC_CERT_WARN_WEAK_SECURITY_MASK = 0x00000021, /* SEC_CERT_WARN_NO_KEY_USAGE | SEC_CERT_WARN_CHAIN.
729 Low security level could expose the connection under attack. */
730
731 SEC_CERT_WARN_MISCONFIG_MASK = 0x001B0112, /* SEC_CERT_WARN_NO_CERT_HASH | SEC_CERT_WARN_TRUSTED_NO_KEY_USAGE |
732 SEC_CERT_WARN_TRUSTED_EXPIRED | SEC_CERT_WARN_TRUSTED_KEY_MISUSE |
733 SEC_CERT_WARN_BCONST_FAIL | SEC_CERT_WARN_VALIDITY |
734 SEC_CERT_WARN_BCONST_NOT_CRITICAL. Probably a misconfiguration. */
735
736 SEC_CERT_WARN_ATTACK_MASK = 0x00000148, /* SEC_CERT_WARN_BCONST_FAIL | SEC_CERT_WARN_KEY_MISUSE |
737 SEC_CERT_WARN_UNKNOWN_CRITICAL_EXT. Probably a attack. */
738
739 SEC_CERT_WARN_AUTH_FAILED_MASK = 0x00040E00 /* SEC_CERT_WARN_CORRUPTED_CERT | SEC_CERT_WARN_NO_TRUSTED_CERTS |
740 SEC_CERT_WARN_INVALID_SIGNATURE | SEC_CERT_WARN_INTERNAL.
741 Authentication failed. */
742} sec_cert_warn_enum;
743
744
745#endif /* !_SSL_ENUMS_H */