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