blob: 5ad1e4747b498f99c9312b4cc85507397a22c971 [file] [log] [blame]
Adam Langley95c29f32014-06-20 12:00:00 -07001/* ssl/ssl_stat.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright 2005 Nokia. All rights reserved.
60 *
61 * The portions of the attached software ("Contribution") is developed by
62 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
63 * license.
64 *
65 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
66 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
67 * support (see RFC 4279) to OpenSSL.
68 *
69 * No patent licenses or other rights except those expressly stated in
70 * the OpenSSL open source license shall be deemed granted or received
71 * expressly, by implication, estoppel, or otherwise.
72 *
73 * No assurances are provided by Nokia that the Contribution does not
74 * infringe the patent or other intellectual property rights of any third
75 * party or that the license provides you with all the necessary rights
76 * to make use of the Contribution.
77 *
78 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
79 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
80 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
81 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
82 * OTHERWISE.
83 */
84
David Benjamin9e4e01e2015-09-15 01:48:04 -040085#include <openssl/ssl.h>
86
David Benjamin2ee94aa2015-04-07 22:38:30 -040087#include "internal.h"
Adam Langley95c29f32014-06-20 12:00:00 -070088
David Benjamin9e4e01e2015-09-15 01:48:04 -040089
Adam Langleyfcf25832014-12-18 17:42:32 -080090const char *SSL_state_string_long(const SSL *s) {
91 const char *str;
Adam Langley95c29f32014-06-20 12:00:00 -070092
Adam Langleyfcf25832014-12-18 17:42:32 -080093 switch (s->state) {
94 case SSL_ST_ACCEPT:
95 str = "before accept initialization";
96 break;
Adam Langley95c29f32014-06-20 12:00:00 -070097
Adam Langleyfcf25832014-12-18 17:42:32 -080098 case SSL_ST_CONNECT:
99 str = "before connect initialization";
100 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700101
Adam Langleyfcf25832014-12-18 17:42:32 -0800102 case SSL_ST_OK:
103 str = "SSL negotiation finished successfully";
104 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700105
Adam Langleyfcf25832014-12-18 17:42:32 -0800106 case SSL_ST_RENEGOTIATE:
107 str = "SSL renegotiate ciphers";
108 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700109
Adam Langleyfcf25832014-12-18 17:42:32 -0800110 /* SSLv3 additions */
111 case SSL3_ST_CW_CLNT_HELLO_A:
112 str = "SSLv3 write client hello A";
113 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700114
Adam Langleyfcf25832014-12-18 17:42:32 -0800115 case SSL3_ST_CW_CLNT_HELLO_B:
116 str = "SSLv3 write client hello B";
117 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700118
Adam Langleyfcf25832014-12-18 17:42:32 -0800119 case SSL3_ST_CR_SRVR_HELLO_A:
120 str = "SSLv3 read server hello A";
121 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700122
Adam Langleyfcf25832014-12-18 17:42:32 -0800123 case SSL3_ST_CR_SRVR_HELLO_B:
124 str = "SSLv3 read server hello B";
125 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700126
Adam Langleyfcf25832014-12-18 17:42:32 -0800127 case SSL3_ST_CR_CERT_A:
128 str = "SSLv3 read server certificate A";
129 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700130
Adam Langleyfcf25832014-12-18 17:42:32 -0800131 case SSL3_ST_CR_CERT_B:
132 str = "SSLv3 read server certificate B";
133 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700134
Adam Langleyfcf25832014-12-18 17:42:32 -0800135 case SSL3_ST_CR_KEY_EXCH_A:
136 str = "SSLv3 read server key exchange A";
137 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700138
Adam Langleyfcf25832014-12-18 17:42:32 -0800139 case SSL3_ST_CR_KEY_EXCH_B:
140 str = "SSLv3 read server key exchange B";
141 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700142
Adam Langleyfcf25832014-12-18 17:42:32 -0800143 case SSL3_ST_CR_CERT_REQ_A:
144 str = "SSLv3 read server certificate request A";
145 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700146
Adam Langleyfcf25832014-12-18 17:42:32 -0800147 case SSL3_ST_CR_CERT_REQ_B:
148 str = "SSLv3 read server certificate request B";
149 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700150
Adam Langleyfcf25832014-12-18 17:42:32 -0800151 case SSL3_ST_CR_SESSION_TICKET_A:
152 str = "SSLv3 read server session ticket A";
153 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700154
Adam Langleyfcf25832014-12-18 17:42:32 -0800155 case SSL3_ST_CR_SESSION_TICKET_B:
156 str = "SSLv3 read server session ticket B";
157 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700158
Adam Langleyfcf25832014-12-18 17:42:32 -0800159 case SSL3_ST_CR_SRVR_DONE_A:
160 str = "SSLv3 read server done A";
161 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700162
Adam Langleyfcf25832014-12-18 17:42:32 -0800163 case SSL3_ST_CR_SRVR_DONE_B:
164 str = "SSLv3 read server done B";
165 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700166
Adam Langleyfcf25832014-12-18 17:42:32 -0800167 case SSL3_ST_CW_CERT_A:
168 str = "SSLv3 write client certificate A";
169 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700170
Adam Langleyfcf25832014-12-18 17:42:32 -0800171 case SSL3_ST_CW_CERT_B:
172 str = "SSLv3 write client certificate B";
173 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700174
Adam Langleyfcf25832014-12-18 17:42:32 -0800175 case SSL3_ST_CW_CERT_C:
176 str = "SSLv3 write client certificate C";
177 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700178
Adam Langleyfcf25832014-12-18 17:42:32 -0800179 case SSL3_ST_CW_CERT_D:
180 str = "SSLv3 write client certificate D";
181 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700182
Adam Langleyfcf25832014-12-18 17:42:32 -0800183 case SSL3_ST_CW_KEY_EXCH_A:
184 str = "SSLv3 write client key exchange A";
185 break;
186
187 case SSL3_ST_CW_KEY_EXCH_B:
188 str = "SSLv3 write client key exchange B";
189 break;
190
191 case SSL3_ST_CW_CERT_VRFY_A:
192 str = "SSLv3 write certificate verify A";
193 break;
194
195 case SSL3_ST_CW_CERT_VRFY_B:
196 str = "SSLv3 write certificate verify B";
197 break;
198
199 case SSL3_ST_CW_CHANGE_A:
200 case SSL3_ST_SW_CHANGE_A:
201 str = "SSLv3 write change cipher spec A";
202 break;
203
204 case SSL3_ST_CW_CHANGE_B:
205 case SSL3_ST_SW_CHANGE_B:
206 str = "SSLv3 write change cipher spec B";
207 break;
208
209 case SSL3_ST_CW_FINISHED_A:
210 case SSL3_ST_SW_FINISHED_A:
211 str = "SSLv3 write finished A";
212 break;
213
214 case SSL3_ST_CW_FINISHED_B:
215 case SSL3_ST_SW_FINISHED_B:
216 str = "SSLv3 write finished B";
217 break;
218
219 case SSL3_ST_CR_CHANGE:
220 case SSL3_ST_SR_CHANGE:
221 str = "SSLv3 read change cipher spec";
222 break;
223
224 case SSL3_ST_CR_FINISHED_A:
225 case SSL3_ST_SR_FINISHED_A:
226 str = "SSLv3 read finished A";
227 break;
228
229 case SSL3_ST_CR_FINISHED_B:
230 case SSL3_ST_SR_FINISHED_B:
231 str = "SSLv3 read finished B";
232 break;
233
234 case SSL3_ST_CW_FLUSH:
235 case SSL3_ST_SW_FLUSH:
236 str = "SSLv3 flush data";
237 break;
238
239 case SSL3_ST_SR_CLNT_HELLO_A:
240 str = "SSLv3 read client hello A";
241 break;
242
243 case SSL3_ST_SR_CLNT_HELLO_B:
244 str = "SSLv3 read client hello B";
245 break;
246
247 case SSL3_ST_SR_CLNT_HELLO_C:
248 str = "SSLv3 read client hello C";
249 break;
250
251 case SSL3_ST_SR_CLNT_HELLO_D:
252 str = "SSLv3 read client hello D";
253 break;
254
255 case SSL3_ST_SW_HELLO_REQ_A:
256 str = "SSLv3 write hello request A";
257 break;
258
259 case SSL3_ST_SW_HELLO_REQ_B:
260 str = "SSLv3 write hello request B";
261 break;
262
263 case SSL3_ST_SW_HELLO_REQ_C:
264 str = "SSLv3 write hello request C";
265 break;
266
267 case SSL3_ST_SW_SRVR_HELLO_A:
268 str = "SSLv3 write server hello A";
269 break;
270
271 case SSL3_ST_SW_SRVR_HELLO_B:
272 str = "SSLv3 write server hello B";
273 break;
274
275 case SSL3_ST_SW_CERT_A:
276 str = "SSLv3 write certificate A";
277 break;
278
279 case SSL3_ST_SW_CERT_B:
280 str = "SSLv3 write certificate B";
281 break;
282
283 case SSL3_ST_SW_KEY_EXCH_A:
284 str = "SSLv3 write key exchange A";
285 break;
286
287 case SSL3_ST_SW_KEY_EXCH_B:
288 str = "SSLv3 write key exchange B";
289 break;
290
291 case SSL3_ST_SW_CERT_REQ_A:
292 str = "SSLv3 write certificate request A";
293 break;
294
295 case SSL3_ST_SW_CERT_REQ_B:
296 str = "SSLv3 write certificate request B";
297 break;
298
299 case SSL3_ST_SW_SESSION_TICKET_A:
300 str = "SSLv3 write session ticket A";
301 break;
302
303 case SSL3_ST_SW_SESSION_TICKET_B:
304 str = "SSLv3 write session ticket B";
305 break;
306
307 case SSL3_ST_SW_SRVR_DONE_A:
308 str = "SSLv3 write server done A";
309 break;
310
311 case SSL3_ST_SW_SRVR_DONE_B:
312 str = "SSLv3 write server done B";
313 break;
314
315 case SSL3_ST_SR_CERT_A:
316 str = "SSLv3 read client certificate A";
317 break;
318
319 case SSL3_ST_SR_CERT_B:
320 str = "SSLv3 read client certificate B";
321 break;
322
323 case SSL3_ST_SR_KEY_EXCH_A:
324 str = "SSLv3 read client key exchange A";
325 break;
326
327 case SSL3_ST_SR_KEY_EXCH_B:
328 str = "SSLv3 read client key exchange B";
329 break;
330
331 case SSL3_ST_SR_CERT_VRFY_A:
332 str = "SSLv3 read certificate verify A";
333 break;
334
335 case SSL3_ST_SR_CERT_VRFY_B:
336 str = "SSLv3 read certificate verify B";
337 break;
338
Adam Langleyfcf25832014-12-18 17:42:32 -0800339 /* DTLS */
340 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
341 str = "DTLS1 read hello verify request A";
342 break;
343
344 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
345 str = "DTLS1 read hello verify request B";
346 break;
347
Adam Langleyfcf25832014-12-18 17:42:32 -0800348 default:
349 str = "unknown state";
350 break;
351 }
352
353 return str;
354}
355
Adam Langleyfcf25832014-12-18 17:42:32 -0800356const char *SSL_state_string(const SSL *s) {
357 const char *str;
358
359 switch (s->state) {
360 case SSL_ST_ACCEPT:
361 str = "AINIT ";
362 break;
363
364 case SSL_ST_CONNECT:
365 str = "CINIT ";
366 break;
367
368 case SSL_ST_OK:
369 str = "SSLOK ";
370 break;
371
372 /* SSLv3 additions */
373 case SSL3_ST_SW_FLUSH:
374 case SSL3_ST_CW_FLUSH:
375 str = "3FLUSH";
376 break;
377
378 case SSL3_ST_CW_CLNT_HELLO_A:
379 str = "3WCH_A";
380 break;
381
382 case SSL3_ST_CW_CLNT_HELLO_B:
383 str = "3WCH_B";
384 break;
385
386 case SSL3_ST_CR_SRVR_HELLO_A:
387 str = "3RSH_A";
388 break;
389
390 case SSL3_ST_CR_SRVR_HELLO_B:
391 str = "3RSH_B";
392 break;
393
394 case SSL3_ST_CR_CERT_A:
395 str = "3RSC_A";
396 break;
397
398 case SSL3_ST_CR_CERT_B:
399 str = "3RSC_B";
400 break;
401
402 case SSL3_ST_CR_KEY_EXCH_A:
403 str = "3RSKEA";
404 break;
405
406 case SSL3_ST_CR_KEY_EXCH_B:
407 str = "3RSKEB";
408 break;
409
410 case SSL3_ST_CR_CERT_REQ_A:
411 str = "3RCR_A";
412 break;
413
414 case SSL3_ST_CR_CERT_REQ_B:
415 str = "3RCR_B";
416 break;
417
418 case SSL3_ST_CR_SRVR_DONE_A:
419 str = "3RSD_A";
420 break;
421
422 case SSL3_ST_CR_SRVR_DONE_B:
423 str = "3RSD_B";
424 break;
425
426 case SSL3_ST_CW_CERT_A:
427 str = "3WCC_A";
428 break;
429
430 case SSL3_ST_CW_CERT_B:
431 str = "3WCC_B";
432 break;
433
434 case SSL3_ST_CW_CERT_C:
435 str = "3WCC_C";
436 break;
437
438 case SSL3_ST_CW_CERT_D:
439 str = "3WCC_D";
440 break;
441
442 case SSL3_ST_CW_KEY_EXCH_A:
443 str = "3WCKEA";
444 break;
445
446 case SSL3_ST_CW_KEY_EXCH_B:
447 str = "3WCKEB";
448 break;
449
450 case SSL3_ST_CW_CERT_VRFY_A:
451 str = "3WCV_A";
452 break;
453
454 case SSL3_ST_CW_CERT_VRFY_B:
455 str = "3WCV_B";
456 break;
457
458 case SSL3_ST_SW_CHANGE_A:
459 case SSL3_ST_CW_CHANGE_A:
460 str = "3WCCSA";
461 break;
462
463 case SSL3_ST_SW_CHANGE_B:
464 case SSL3_ST_CW_CHANGE_B:
465 str = "3WCCSB";
466 break;
467
468 case SSL3_ST_SW_FINISHED_A:
469 case SSL3_ST_CW_FINISHED_A:
470 str = "3WFINA";
471 break;
472
473 case SSL3_ST_SW_FINISHED_B:
474 case SSL3_ST_CW_FINISHED_B:
475 str = "3WFINB";
476 break;
477
478 case SSL3_ST_CR_CHANGE:
479 case SSL3_ST_SR_CHANGE:
480 str = "3RCCS_";
481 break;
482
483 case SSL3_ST_SR_FINISHED_A:
484 case SSL3_ST_CR_FINISHED_A:
485 str = "3RFINA";
486 break;
487
488 case SSL3_ST_SR_FINISHED_B:
489 case SSL3_ST_CR_FINISHED_B:
490 str = "3RFINB";
491 break;
492
493 case SSL3_ST_SW_HELLO_REQ_A:
494 str = "3WHR_A";
495 break;
496
497 case SSL3_ST_SW_HELLO_REQ_B:
498 str = "3WHR_B";
499 break;
500
501 case SSL3_ST_SW_HELLO_REQ_C:
502 str = "3WHR_C";
503 break;
504
505 case SSL3_ST_SR_CLNT_HELLO_A:
506 str = "3RCH_A";
507 break;
508
509 case SSL3_ST_SR_CLNT_HELLO_B:
510 str = "3RCH_B";
511 break;
512
513 case SSL3_ST_SR_CLNT_HELLO_C:
514 str = "3RCH_C";
515 break;
516
517 case SSL3_ST_SR_CLNT_HELLO_D:
518 str = "3RCH_D";
519 break;
520
521 case SSL3_ST_SW_SRVR_HELLO_A:
522 str = "3WSH_A";
523 break;
524
525 case SSL3_ST_SW_SRVR_HELLO_B:
526 str = "3WSH_B";
527 break;
528
529 case SSL3_ST_SW_CERT_A:
530 str = "3WSC_A";
531 break;
532
533 case SSL3_ST_SW_CERT_B:
534 str = "3WSC_B";
535 break;
536
537 case SSL3_ST_SW_KEY_EXCH_A:
538 str = "3WSKEA";
539 break;
540
541 case SSL3_ST_SW_KEY_EXCH_B:
542 str = "3WSKEB";
543 break;
544
545 case SSL3_ST_SW_CERT_REQ_A:
546 str = "3WCR_A";
547 break;
548
549 case SSL3_ST_SW_CERT_REQ_B:
550 str = "3WCR_B";
551 break;
552
553 case SSL3_ST_SW_SRVR_DONE_A:
554 str = "3WSD_A";
555 break;
556
557 case SSL3_ST_SW_SRVR_DONE_B:
558 str = "3WSD_B";
559 break;
560
561 case SSL3_ST_SR_CERT_A:
562 str = "3RCC_A";
563 break;
564
565 case SSL3_ST_SR_CERT_B:
566 str = "3RCC_B";
567 break;
568
569 case SSL3_ST_SR_KEY_EXCH_A:
570 str = "3RCKEA";
571 break;
572
573 case SSL3_ST_SR_KEY_EXCH_B:
574 str = "3RCKEB";
575 break;
576
577 case SSL3_ST_SR_CERT_VRFY_A:
578 str = "3RCV_A";
579 break;
580
581 case SSL3_ST_SR_CERT_VRFY_B:
582 str = "3RCV_B";
583 break;
584
Adam Langleyfcf25832014-12-18 17:42:32 -0800585 /* DTLS */
586 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
587 str = "DRCHVA";
588 break;
589
590 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
591 str = "DRCHVB";
592 break;
593
Adam Langleyfcf25832014-12-18 17:42:32 -0800594 default:
595 str = "UNKWN ";
596 break;
597 }
598
599 return str;
600}
601
602const char *SSL_alert_type_string_long(int value) {
603 value >>= 8;
604 if (value == SSL3_AL_WARNING) {
605 return "warning";
606 } else if (value == SSL3_AL_FATAL) {
607 return "fatal";
608 }
609
610 return "unknown";
611}
612
613const char *SSL_alert_type_string(int value) {
614 value >>= 8;
615 if (value == SSL3_AL_WARNING) {
616 return "W";
617 } else if (value == SSL3_AL_FATAL) {
618 return "F";
619 }
620
621 return "U";
622}
623
624const char *SSL_alert_desc_string(int value) {
625 const char *str;
626
627 switch (value & 0xff) {
628 case SSL3_AD_CLOSE_NOTIFY:
629 str = "CN";
630 break;
631
632 case SSL3_AD_UNEXPECTED_MESSAGE:
633 str = "UM";
634 break;
635
636 case SSL3_AD_BAD_RECORD_MAC:
637 str = "BM";
638 break;
639
640 case SSL3_AD_DECOMPRESSION_FAILURE:
641 str = "DF";
642 break;
643
644 case SSL3_AD_HANDSHAKE_FAILURE:
645 str = "HF";
646 break;
647
648 case SSL3_AD_NO_CERTIFICATE:
649 str = "NC";
650 break;
651
652 case SSL3_AD_BAD_CERTIFICATE:
653 str = "BC";
654 break;
655
656 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
657 str = "UC";
658 break;
659
660 case SSL3_AD_CERTIFICATE_REVOKED:
661 str = "CR";
662 break;
663
664 case SSL3_AD_CERTIFICATE_EXPIRED:
665 str = "CE";
666 break;
667
668 case SSL3_AD_CERTIFICATE_UNKNOWN:
669 str = "CU";
670 break;
671
672 case SSL3_AD_ILLEGAL_PARAMETER:
673 str = "IP";
674 break;
675
676 case TLS1_AD_DECRYPTION_FAILED:
677 str = "DC";
678 break;
679
680 case TLS1_AD_RECORD_OVERFLOW:
681 str = "RO";
682 break;
683
684 case TLS1_AD_UNKNOWN_CA:
685 str = "CA";
686 break;
687
688 case TLS1_AD_ACCESS_DENIED:
689 str = "AD";
690 break;
691
692 case TLS1_AD_DECODE_ERROR:
693 str = "DE";
694 break;
695
696 case TLS1_AD_DECRYPT_ERROR:
697 str = "CY";
698 break;
699
700 case TLS1_AD_EXPORT_RESTRICTION:
701 str = "ER";
702 break;
703
704 case TLS1_AD_PROTOCOL_VERSION:
705 str = "PV";
706 break;
707
708 case TLS1_AD_INSUFFICIENT_SECURITY:
709 str = "IS";
710 break;
711
712 case TLS1_AD_INTERNAL_ERROR:
713 str = "IE";
714 break;
715
716 case TLS1_AD_USER_CANCELLED:
717 str = "US";
718 break;
719
720 case TLS1_AD_NO_RENEGOTIATION:
721 str = "NR";
722 break;
723
724 case TLS1_AD_UNSUPPORTED_EXTENSION:
725 str = "UE";
726 break;
727
728 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
729 str = "CO";
730 break;
731
732 case TLS1_AD_UNRECOGNIZED_NAME:
733 str = "UN";
734 break;
735
736 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
737 str = "BR";
738 break;
739
740 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
741 str = "BH";
742 break;
743
744 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
745 str = "UP";
746 break;
747
748 default:
749 str = "UK";
750 break;
751 }
752
753 return str;
754}
755
756const char *SSL_alert_desc_string_long(int value) {
757 const char *str;
758
759 switch (value & 0xff) {
760 case SSL3_AD_CLOSE_NOTIFY:
761 str = "close notify";
762 break;
763
764 case SSL3_AD_UNEXPECTED_MESSAGE:
765 str = "unexpected_message";
766 break;
767
768 case SSL3_AD_BAD_RECORD_MAC:
769 str = "bad record mac";
770 break;
771
772 case SSL3_AD_DECOMPRESSION_FAILURE:
773 str = "decompression failure";
774 break;
775
776 case SSL3_AD_HANDSHAKE_FAILURE:
777 str = "handshake failure";
778 break;
779
780 case SSL3_AD_NO_CERTIFICATE:
781 str = "no certificate";
782 break;
783
784 case SSL3_AD_BAD_CERTIFICATE:
785 str = "bad certificate";
786 break;
787
788 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
789 str = "unsupported certificate";
790 break;
791
792 case SSL3_AD_CERTIFICATE_REVOKED:
793 str = "certificate revoked";
794 break;
795
796 case SSL3_AD_CERTIFICATE_EXPIRED:
797 str = "certificate expired";
798 break;
799
800 case SSL3_AD_CERTIFICATE_UNKNOWN:
801 str = "certificate unknown";
802 break;
803
804 case SSL3_AD_ILLEGAL_PARAMETER:
805 str = "illegal parameter";
806 break;
807
808 case TLS1_AD_DECRYPTION_FAILED:
809 str = "decryption failed";
810 break;
811
812 case TLS1_AD_RECORD_OVERFLOW:
813 str = "record overflow";
814 break;
815
816 case TLS1_AD_UNKNOWN_CA:
817 str = "unknown CA";
818 break;
819
820 case TLS1_AD_ACCESS_DENIED:
821 str = "access denied";
822 break;
823
824 case TLS1_AD_DECODE_ERROR:
825 str = "decode error";
826 break;
827
828 case TLS1_AD_DECRYPT_ERROR:
829 str = "decrypt error";
830 break;
831
832 case TLS1_AD_EXPORT_RESTRICTION:
833 str = "export restriction";
834 break;
835
836 case TLS1_AD_PROTOCOL_VERSION:
837 str = "protocol version";
838 break;
839
840 case TLS1_AD_INSUFFICIENT_SECURITY:
841 str = "insufficient security";
842 break;
843
844 case TLS1_AD_INTERNAL_ERROR:
845 str = "internal error";
846 break;
847
848 case TLS1_AD_USER_CANCELLED:
849 str = "user canceled";
850 break;
851
852 case TLS1_AD_NO_RENEGOTIATION:
853 str = "no renegotiation";
854 break;
855
856 case TLS1_AD_UNSUPPORTED_EXTENSION:
857 str = "unsupported extension";
858 break;
859
860 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
861 str = "certificate unobtainable";
862 break;
863
864 case TLS1_AD_UNRECOGNIZED_NAME:
865 str = "unrecognized name";
866 break;
867
868 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
869 str = "bad certificate status response";
870 break;
871
872 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
873 str = "bad certificate hash value";
874 break;
875
876 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
877 str = "unknown PSK identity";
878 break;
879
880 default:
881 str = "unknown";
882 break;
883 }
884
885 return str;
886}