blob: d5feb5d8225cb5b408c706199b3f3039fe90eefa [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
85#include <stdio.h>
David Benjamin2ee94aa2015-04-07 22:38:30 -040086#include "internal.h"
Adam Langley95c29f32014-06-20 12:00:00 -070087
Adam Langleyfcf25832014-12-18 17:42:32 -080088const char *SSL_state_string_long(const SSL *s) {
89 const char *str;
Adam Langley95c29f32014-06-20 12:00:00 -070090
Adam Langleyfcf25832014-12-18 17:42:32 -080091 switch (s->state) {
92 case SSL_ST_ACCEPT:
93 str = "before accept initialization";
94 break;
Adam Langley95c29f32014-06-20 12:00:00 -070095
Adam Langleyfcf25832014-12-18 17:42:32 -080096 case SSL_ST_CONNECT:
97 str = "before connect initialization";
98 break;
Adam Langley95c29f32014-06-20 12:00:00 -070099
Adam Langleyfcf25832014-12-18 17:42:32 -0800100 case SSL_ST_OK:
101 str = "SSL negotiation finished successfully";
102 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700103
Adam Langleyfcf25832014-12-18 17:42:32 -0800104 case SSL_ST_RENEGOTIATE:
105 str = "SSL renegotiate ciphers";
106 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700107
Adam Langleyfcf25832014-12-18 17:42:32 -0800108 /* SSLv3 additions */
109 case SSL3_ST_CW_CLNT_HELLO_A:
110 str = "SSLv3 write client hello A";
111 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700112
Adam Langleyfcf25832014-12-18 17:42:32 -0800113 case SSL3_ST_CW_CLNT_HELLO_B:
114 str = "SSLv3 write client hello B";
115 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700116
Adam Langleyfcf25832014-12-18 17:42:32 -0800117 case SSL3_ST_CR_SRVR_HELLO_A:
118 str = "SSLv3 read server hello A";
119 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700120
Adam Langleyfcf25832014-12-18 17:42:32 -0800121 case SSL3_ST_CR_SRVR_HELLO_B:
122 str = "SSLv3 read server hello B";
123 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700124
Adam Langleyfcf25832014-12-18 17:42:32 -0800125 case SSL3_ST_CR_CERT_A:
126 str = "SSLv3 read server certificate A";
127 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700128
Adam Langleyfcf25832014-12-18 17:42:32 -0800129 case SSL3_ST_CR_CERT_B:
130 str = "SSLv3 read server certificate B";
131 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700132
Adam Langleyfcf25832014-12-18 17:42:32 -0800133 case SSL3_ST_CR_KEY_EXCH_A:
134 str = "SSLv3 read server key exchange A";
135 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700136
Adam Langleyfcf25832014-12-18 17:42:32 -0800137 case SSL3_ST_CR_KEY_EXCH_B:
138 str = "SSLv3 read server key exchange B";
139 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700140
Adam Langleyfcf25832014-12-18 17:42:32 -0800141 case SSL3_ST_CR_CERT_REQ_A:
142 str = "SSLv3 read server certificate request A";
143 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700144
Adam Langleyfcf25832014-12-18 17:42:32 -0800145 case SSL3_ST_CR_CERT_REQ_B:
146 str = "SSLv3 read server certificate request B";
147 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700148
Adam Langleyfcf25832014-12-18 17:42:32 -0800149 case SSL3_ST_CR_SESSION_TICKET_A:
150 str = "SSLv3 read server session ticket A";
151 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700152
Adam Langleyfcf25832014-12-18 17:42:32 -0800153 case SSL3_ST_CR_SESSION_TICKET_B:
154 str = "SSLv3 read server session ticket B";
155 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700156
Adam Langleyfcf25832014-12-18 17:42:32 -0800157 case SSL3_ST_CR_SRVR_DONE_A:
158 str = "SSLv3 read server done A";
159 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700160
Adam Langleyfcf25832014-12-18 17:42:32 -0800161 case SSL3_ST_CR_SRVR_DONE_B:
162 str = "SSLv3 read server done B";
163 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700164
Adam Langleyfcf25832014-12-18 17:42:32 -0800165 case SSL3_ST_CW_CERT_A:
166 str = "SSLv3 write client certificate A";
167 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700168
Adam Langleyfcf25832014-12-18 17:42:32 -0800169 case SSL3_ST_CW_CERT_B:
170 str = "SSLv3 write client certificate B";
171 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700172
Adam Langleyfcf25832014-12-18 17:42:32 -0800173 case SSL3_ST_CW_CERT_C:
174 str = "SSLv3 write client certificate C";
175 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700176
Adam Langleyfcf25832014-12-18 17:42:32 -0800177 case SSL3_ST_CW_CERT_D:
178 str = "SSLv3 write client certificate D";
179 break;
Adam Langley95c29f32014-06-20 12:00:00 -0700180
Adam Langleyfcf25832014-12-18 17:42:32 -0800181 case SSL3_ST_CW_KEY_EXCH_A:
182 str = "SSLv3 write client key exchange A";
183 break;
184
185 case SSL3_ST_CW_KEY_EXCH_B:
186 str = "SSLv3 write client key exchange B";
187 break;
188
189 case SSL3_ST_CW_CERT_VRFY_A:
190 str = "SSLv3 write certificate verify A";
191 break;
192
193 case SSL3_ST_CW_CERT_VRFY_B:
194 str = "SSLv3 write certificate verify B";
195 break;
196
197 case SSL3_ST_CW_CHANGE_A:
198 case SSL3_ST_SW_CHANGE_A:
199 str = "SSLv3 write change cipher spec A";
200 break;
201
202 case SSL3_ST_CW_CHANGE_B:
203 case SSL3_ST_SW_CHANGE_B:
204 str = "SSLv3 write change cipher spec B";
205 break;
206
207 case SSL3_ST_CW_FINISHED_A:
208 case SSL3_ST_SW_FINISHED_A:
209 str = "SSLv3 write finished A";
210 break;
211
212 case SSL3_ST_CW_FINISHED_B:
213 case SSL3_ST_SW_FINISHED_B:
214 str = "SSLv3 write finished B";
215 break;
216
217 case SSL3_ST_CR_CHANGE:
218 case SSL3_ST_SR_CHANGE:
219 str = "SSLv3 read change cipher spec";
220 break;
221
222 case SSL3_ST_CR_FINISHED_A:
223 case SSL3_ST_SR_FINISHED_A:
224 str = "SSLv3 read finished A";
225 break;
226
227 case SSL3_ST_CR_FINISHED_B:
228 case SSL3_ST_SR_FINISHED_B:
229 str = "SSLv3 read finished B";
230 break;
231
232 case SSL3_ST_CW_FLUSH:
233 case SSL3_ST_SW_FLUSH:
234 str = "SSLv3 flush data";
235 break;
236
237 case SSL3_ST_SR_CLNT_HELLO_A:
238 str = "SSLv3 read client hello A";
239 break;
240
241 case SSL3_ST_SR_CLNT_HELLO_B:
242 str = "SSLv3 read client hello B";
243 break;
244
245 case SSL3_ST_SR_CLNT_HELLO_C:
246 str = "SSLv3 read client hello C";
247 break;
248
249 case SSL3_ST_SR_CLNT_HELLO_D:
250 str = "SSLv3 read client hello D";
251 break;
252
253 case SSL3_ST_SW_HELLO_REQ_A:
254 str = "SSLv3 write hello request A";
255 break;
256
257 case SSL3_ST_SW_HELLO_REQ_B:
258 str = "SSLv3 write hello request B";
259 break;
260
261 case SSL3_ST_SW_HELLO_REQ_C:
262 str = "SSLv3 write hello request C";
263 break;
264
265 case SSL3_ST_SW_SRVR_HELLO_A:
266 str = "SSLv3 write server hello A";
267 break;
268
269 case SSL3_ST_SW_SRVR_HELLO_B:
270 str = "SSLv3 write server hello B";
271 break;
272
273 case SSL3_ST_SW_CERT_A:
274 str = "SSLv3 write certificate A";
275 break;
276
277 case SSL3_ST_SW_CERT_B:
278 str = "SSLv3 write certificate B";
279 break;
280
281 case SSL3_ST_SW_KEY_EXCH_A:
282 str = "SSLv3 write key exchange A";
283 break;
284
285 case SSL3_ST_SW_KEY_EXCH_B:
286 str = "SSLv3 write key exchange B";
287 break;
288
289 case SSL3_ST_SW_CERT_REQ_A:
290 str = "SSLv3 write certificate request A";
291 break;
292
293 case SSL3_ST_SW_CERT_REQ_B:
294 str = "SSLv3 write certificate request B";
295 break;
296
297 case SSL3_ST_SW_SESSION_TICKET_A:
298 str = "SSLv3 write session ticket A";
299 break;
300
301 case SSL3_ST_SW_SESSION_TICKET_B:
302 str = "SSLv3 write session ticket B";
303 break;
304
305 case SSL3_ST_SW_SRVR_DONE_A:
306 str = "SSLv3 write server done A";
307 break;
308
309 case SSL3_ST_SW_SRVR_DONE_B:
310 str = "SSLv3 write server done B";
311 break;
312
313 case SSL3_ST_SR_CERT_A:
314 str = "SSLv3 read client certificate A";
315 break;
316
317 case SSL3_ST_SR_CERT_B:
318 str = "SSLv3 read client certificate B";
319 break;
320
321 case SSL3_ST_SR_KEY_EXCH_A:
322 str = "SSLv3 read client key exchange A";
323 break;
324
325 case SSL3_ST_SR_KEY_EXCH_B:
326 str = "SSLv3 read client key exchange B";
327 break;
328
329 case SSL3_ST_SR_CERT_VRFY_A:
330 str = "SSLv3 read certificate verify A";
331 break;
332
333 case SSL3_ST_SR_CERT_VRFY_B:
334 str = "SSLv3 read certificate verify B";
335 break;
336
Adam Langleyfcf25832014-12-18 17:42:32 -0800337 /* DTLS */
338 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
339 str = "DTLS1 read hello verify request A";
340 break;
341
342 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
343 str = "DTLS1 read hello verify request B";
344 break;
345
Adam Langleyfcf25832014-12-18 17:42:32 -0800346 default:
347 str = "unknown state";
348 break;
349 }
350
351 return str;
352}
353
Adam Langleyfcf25832014-12-18 17:42:32 -0800354const char *SSL_state_string(const SSL *s) {
355 const char *str;
356
357 switch (s->state) {
358 case SSL_ST_ACCEPT:
359 str = "AINIT ";
360 break;
361
362 case SSL_ST_CONNECT:
363 str = "CINIT ";
364 break;
365
366 case SSL_ST_OK:
367 str = "SSLOK ";
368 break;
369
370 /* SSLv3 additions */
371 case SSL3_ST_SW_FLUSH:
372 case SSL3_ST_CW_FLUSH:
373 str = "3FLUSH";
374 break;
375
376 case SSL3_ST_CW_CLNT_HELLO_A:
377 str = "3WCH_A";
378 break;
379
380 case SSL3_ST_CW_CLNT_HELLO_B:
381 str = "3WCH_B";
382 break;
383
384 case SSL3_ST_CR_SRVR_HELLO_A:
385 str = "3RSH_A";
386 break;
387
388 case SSL3_ST_CR_SRVR_HELLO_B:
389 str = "3RSH_B";
390 break;
391
392 case SSL3_ST_CR_CERT_A:
393 str = "3RSC_A";
394 break;
395
396 case SSL3_ST_CR_CERT_B:
397 str = "3RSC_B";
398 break;
399
400 case SSL3_ST_CR_KEY_EXCH_A:
401 str = "3RSKEA";
402 break;
403
404 case SSL3_ST_CR_KEY_EXCH_B:
405 str = "3RSKEB";
406 break;
407
408 case SSL3_ST_CR_CERT_REQ_A:
409 str = "3RCR_A";
410 break;
411
412 case SSL3_ST_CR_CERT_REQ_B:
413 str = "3RCR_B";
414 break;
415
416 case SSL3_ST_CR_SRVR_DONE_A:
417 str = "3RSD_A";
418 break;
419
420 case SSL3_ST_CR_SRVR_DONE_B:
421 str = "3RSD_B";
422 break;
423
424 case SSL3_ST_CW_CERT_A:
425 str = "3WCC_A";
426 break;
427
428 case SSL3_ST_CW_CERT_B:
429 str = "3WCC_B";
430 break;
431
432 case SSL3_ST_CW_CERT_C:
433 str = "3WCC_C";
434 break;
435
436 case SSL3_ST_CW_CERT_D:
437 str = "3WCC_D";
438 break;
439
440 case SSL3_ST_CW_KEY_EXCH_A:
441 str = "3WCKEA";
442 break;
443
444 case SSL3_ST_CW_KEY_EXCH_B:
445 str = "3WCKEB";
446 break;
447
448 case SSL3_ST_CW_CERT_VRFY_A:
449 str = "3WCV_A";
450 break;
451
452 case SSL3_ST_CW_CERT_VRFY_B:
453 str = "3WCV_B";
454 break;
455
456 case SSL3_ST_SW_CHANGE_A:
457 case SSL3_ST_CW_CHANGE_A:
458 str = "3WCCSA";
459 break;
460
461 case SSL3_ST_SW_CHANGE_B:
462 case SSL3_ST_CW_CHANGE_B:
463 str = "3WCCSB";
464 break;
465
466 case SSL3_ST_SW_FINISHED_A:
467 case SSL3_ST_CW_FINISHED_A:
468 str = "3WFINA";
469 break;
470
471 case SSL3_ST_SW_FINISHED_B:
472 case SSL3_ST_CW_FINISHED_B:
473 str = "3WFINB";
474 break;
475
476 case SSL3_ST_CR_CHANGE:
477 case SSL3_ST_SR_CHANGE:
478 str = "3RCCS_";
479 break;
480
481 case SSL3_ST_SR_FINISHED_A:
482 case SSL3_ST_CR_FINISHED_A:
483 str = "3RFINA";
484 break;
485
486 case SSL3_ST_SR_FINISHED_B:
487 case SSL3_ST_CR_FINISHED_B:
488 str = "3RFINB";
489 break;
490
491 case SSL3_ST_SW_HELLO_REQ_A:
492 str = "3WHR_A";
493 break;
494
495 case SSL3_ST_SW_HELLO_REQ_B:
496 str = "3WHR_B";
497 break;
498
499 case SSL3_ST_SW_HELLO_REQ_C:
500 str = "3WHR_C";
501 break;
502
503 case SSL3_ST_SR_CLNT_HELLO_A:
504 str = "3RCH_A";
505 break;
506
507 case SSL3_ST_SR_CLNT_HELLO_B:
508 str = "3RCH_B";
509 break;
510
511 case SSL3_ST_SR_CLNT_HELLO_C:
512 str = "3RCH_C";
513 break;
514
515 case SSL3_ST_SR_CLNT_HELLO_D:
516 str = "3RCH_D";
517 break;
518
519 case SSL3_ST_SW_SRVR_HELLO_A:
520 str = "3WSH_A";
521 break;
522
523 case SSL3_ST_SW_SRVR_HELLO_B:
524 str = "3WSH_B";
525 break;
526
527 case SSL3_ST_SW_CERT_A:
528 str = "3WSC_A";
529 break;
530
531 case SSL3_ST_SW_CERT_B:
532 str = "3WSC_B";
533 break;
534
535 case SSL3_ST_SW_KEY_EXCH_A:
536 str = "3WSKEA";
537 break;
538
539 case SSL3_ST_SW_KEY_EXCH_B:
540 str = "3WSKEB";
541 break;
542
543 case SSL3_ST_SW_CERT_REQ_A:
544 str = "3WCR_A";
545 break;
546
547 case SSL3_ST_SW_CERT_REQ_B:
548 str = "3WCR_B";
549 break;
550
551 case SSL3_ST_SW_SRVR_DONE_A:
552 str = "3WSD_A";
553 break;
554
555 case SSL3_ST_SW_SRVR_DONE_B:
556 str = "3WSD_B";
557 break;
558
559 case SSL3_ST_SR_CERT_A:
560 str = "3RCC_A";
561 break;
562
563 case SSL3_ST_SR_CERT_B:
564 str = "3RCC_B";
565 break;
566
567 case SSL3_ST_SR_KEY_EXCH_A:
568 str = "3RCKEA";
569 break;
570
571 case SSL3_ST_SR_KEY_EXCH_B:
572 str = "3RCKEB";
573 break;
574
575 case SSL3_ST_SR_CERT_VRFY_A:
576 str = "3RCV_A";
577 break;
578
579 case SSL3_ST_SR_CERT_VRFY_B:
580 str = "3RCV_B";
581 break;
582
Adam Langleyfcf25832014-12-18 17:42:32 -0800583 /* DTLS */
584 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
585 str = "DRCHVA";
586 break;
587
588 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
589 str = "DRCHVB";
590 break;
591
Adam Langleyfcf25832014-12-18 17:42:32 -0800592 default:
593 str = "UNKWN ";
594 break;
595 }
596
597 return str;
598}
599
600const char *SSL_alert_type_string_long(int value) {
601 value >>= 8;
602 if (value == SSL3_AL_WARNING) {
603 return "warning";
604 } else if (value == SSL3_AL_FATAL) {
605 return "fatal";
606 }
607
608 return "unknown";
609}
610
611const char *SSL_alert_type_string(int value) {
612 value >>= 8;
613 if (value == SSL3_AL_WARNING) {
614 return "W";
615 } else if (value == SSL3_AL_FATAL) {
616 return "F";
617 }
618
619 return "U";
620}
621
622const char *SSL_alert_desc_string(int value) {
623 const char *str;
624
625 switch (value & 0xff) {
626 case SSL3_AD_CLOSE_NOTIFY:
627 str = "CN";
628 break;
629
630 case SSL3_AD_UNEXPECTED_MESSAGE:
631 str = "UM";
632 break;
633
634 case SSL3_AD_BAD_RECORD_MAC:
635 str = "BM";
636 break;
637
638 case SSL3_AD_DECOMPRESSION_FAILURE:
639 str = "DF";
640 break;
641
642 case SSL3_AD_HANDSHAKE_FAILURE:
643 str = "HF";
644 break;
645
646 case SSL3_AD_NO_CERTIFICATE:
647 str = "NC";
648 break;
649
650 case SSL3_AD_BAD_CERTIFICATE:
651 str = "BC";
652 break;
653
654 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
655 str = "UC";
656 break;
657
658 case SSL3_AD_CERTIFICATE_REVOKED:
659 str = "CR";
660 break;
661
662 case SSL3_AD_CERTIFICATE_EXPIRED:
663 str = "CE";
664 break;
665
666 case SSL3_AD_CERTIFICATE_UNKNOWN:
667 str = "CU";
668 break;
669
670 case SSL3_AD_ILLEGAL_PARAMETER:
671 str = "IP";
672 break;
673
674 case TLS1_AD_DECRYPTION_FAILED:
675 str = "DC";
676 break;
677
678 case TLS1_AD_RECORD_OVERFLOW:
679 str = "RO";
680 break;
681
682 case TLS1_AD_UNKNOWN_CA:
683 str = "CA";
684 break;
685
686 case TLS1_AD_ACCESS_DENIED:
687 str = "AD";
688 break;
689
690 case TLS1_AD_DECODE_ERROR:
691 str = "DE";
692 break;
693
694 case TLS1_AD_DECRYPT_ERROR:
695 str = "CY";
696 break;
697
698 case TLS1_AD_EXPORT_RESTRICTION:
699 str = "ER";
700 break;
701
702 case TLS1_AD_PROTOCOL_VERSION:
703 str = "PV";
704 break;
705
706 case TLS1_AD_INSUFFICIENT_SECURITY:
707 str = "IS";
708 break;
709
710 case TLS1_AD_INTERNAL_ERROR:
711 str = "IE";
712 break;
713
714 case TLS1_AD_USER_CANCELLED:
715 str = "US";
716 break;
717
718 case TLS1_AD_NO_RENEGOTIATION:
719 str = "NR";
720 break;
721
722 case TLS1_AD_UNSUPPORTED_EXTENSION:
723 str = "UE";
724 break;
725
726 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
727 str = "CO";
728 break;
729
730 case TLS1_AD_UNRECOGNIZED_NAME:
731 str = "UN";
732 break;
733
734 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
735 str = "BR";
736 break;
737
738 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
739 str = "BH";
740 break;
741
742 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
743 str = "UP";
744 break;
745
746 default:
747 str = "UK";
748 break;
749 }
750
751 return str;
752}
753
754const char *SSL_alert_desc_string_long(int value) {
755 const char *str;
756
757 switch (value & 0xff) {
758 case SSL3_AD_CLOSE_NOTIFY:
759 str = "close notify";
760 break;
761
762 case SSL3_AD_UNEXPECTED_MESSAGE:
763 str = "unexpected_message";
764 break;
765
766 case SSL3_AD_BAD_RECORD_MAC:
767 str = "bad record mac";
768 break;
769
770 case SSL3_AD_DECOMPRESSION_FAILURE:
771 str = "decompression failure";
772 break;
773
774 case SSL3_AD_HANDSHAKE_FAILURE:
775 str = "handshake failure";
776 break;
777
778 case SSL3_AD_NO_CERTIFICATE:
779 str = "no certificate";
780 break;
781
782 case SSL3_AD_BAD_CERTIFICATE:
783 str = "bad certificate";
784 break;
785
786 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
787 str = "unsupported certificate";
788 break;
789
790 case SSL3_AD_CERTIFICATE_REVOKED:
791 str = "certificate revoked";
792 break;
793
794 case SSL3_AD_CERTIFICATE_EXPIRED:
795 str = "certificate expired";
796 break;
797
798 case SSL3_AD_CERTIFICATE_UNKNOWN:
799 str = "certificate unknown";
800 break;
801
802 case SSL3_AD_ILLEGAL_PARAMETER:
803 str = "illegal parameter";
804 break;
805
806 case TLS1_AD_DECRYPTION_FAILED:
807 str = "decryption failed";
808 break;
809
810 case TLS1_AD_RECORD_OVERFLOW:
811 str = "record overflow";
812 break;
813
814 case TLS1_AD_UNKNOWN_CA:
815 str = "unknown CA";
816 break;
817
818 case TLS1_AD_ACCESS_DENIED:
819 str = "access denied";
820 break;
821
822 case TLS1_AD_DECODE_ERROR:
823 str = "decode error";
824 break;
825
826 case TLS1_AD_DECRYPT_ERROR:
827 str = "decrypt error";
828 break;
829
830 case TLS1_AD_EXPORT_RESTRICTION:
831 str = "export restriction";
832 break;
833
834 case TLS1_AD_PROTOCOL_VERSION:
835 str = "protocol version";
836 break;
837
838 case TLS1_AD_INSUFFICIENT_SECURITY:
839 str = "insufficient security";
840 break;
841
842 case TLS1_AD_INTERNAL_ERROR:
843 str = "internal error";
844 break;
845
846 case TLS1_AD_USER_CANCELLED:
847 str = "user canceled";
848 break;
849
850 case TLS1_AD_NO_RENEGOTIATION:
851 str = "no renegotiation";
852 break;
853
854 case TLS1_AD_UNSUPPORTED_EXTENSION:
855 str = "unsupported extension";
856 break;
857
858 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
859 str = "certificate unobtainable";
860 break;
861
862 case TLS1_AD_UNRECOGNIZED_NAME:
863 str = "unrecognized name";
864 break;
865
866 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
867 str = "bad certificate status response";
868 break;
869
870 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
871 str = "bad certificate hash value";
872 break;
873
874 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
875 str = "unknown PSK identity";
876 break;
877
878 default:
879 str = "unknown";
880 break;
881 }
882
883 return str;
884}