blob: 31cce4dcac9f0ff35858931d5935cb3d2380ac85 [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 Benjamin9e766d72017-02-10 23:14:17 -050086#include <assert.h>
87
David Benjamin2ee94aa2015-04-07 22:38:30 -040088#include "internal.h"
Adam Langley95c29f32014-06-20 12:00:00 -070089
David Benjamin9e4e01e2015-09-15 01:48:04 -040090
David Benjamin9e766d72017-02-10 23:14:17 -050091static int ssl_state(const SSL *ssl) {
92 if (ssl->s3->hs == NULL) {
93 assert(ssl->s3->initial_handshake_complete);
94 return SSL_ST_OK;
95 }
96
97 return ssl->s3->hs->state;
98}
99
David Benjaminb86847c2015-10-17 13:05:27 -0400100const char *SSL_state_string_long(const SSL *ssl) {
David Benjamin9e766d72017-02-10 23:14:17 -0500101 switch (ssl_state(ssl)) {
Adam Langleyfcf25832014-12-18 17:42:32 -0800102 case SSL_ST_ACCEPT:
David Benjaminb86847c2015-10-17 13:05:27 -0400103 return "before accept initialization";
Adam Langley95c29f32014-06-20 12:00:00 -0700104
Adam Langleyfcf25832014-12-18 17:42:32 -0800105 case SSL_ST_CONNECT:
David Benjaminb86847c2015-10-17 13:05:27 -0400106 return "before connect initialization";
Adam Langley95c29f32014-06-20 12:00:00 -0700107
Adam Langleyfcf25832014-12-18 17:42:32 -0800108 case SSL_ST_OK:
David Benjaminb86847c2015-10-17 13:05:27 -0400109 return "SSL negotiation finished successfully";
Adam Langley95c29f32014-06-20 12:00:00 -0700110
Adam Langleyfcf25832014-12-18 17:42:32 -0800111 case SSL_ST_RENEGOTIATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400112 return "SSL renegotiate ciphers";
Adam Langley95c29f32014-06-20 12:00:00 -0700113
Adam Langleyfcf25832014-12-18 17:42:32 -0800114 /* SSLv3 additions */
115 case SSL3_ST_CW_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400116 return "SSLv3 write client hello A";
Adam Langley95c29f32014-06-20 12:00:00 -0700117
Adam Langleyfcf25832014-12-18 17:42:32 -0800118 case SSL3_ST_CR_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400119 return "SSLv3 read server hello A";
Adam Langley95c29f32014-06-20 12:00:00 -0700120
Adam Langleyfcf25832014-12-18 17:42:32 -0800121 case SSL3_ST_CR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400122 return "SSLv3 read server certificate A";
Adam Langley95c29f32014-06-20 12:00:00 -0700123
Adam Langleyfcf25832014-12-18 17:42:32 -0800124 case SSL3_ST_CR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400125 return "SSLv3 read server key exchange A";
Adam Langley95c29f32014-06-20 12:00:00 -0700126
Adam Langleyfcf25832014-12-18 17:42:32 -0800127 case SSL3_ST_CR_CERT_REQ_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400128 return "SSLv3 read server certificate request A";
Adam Langley95c29f32014-06-20 12:00:00 -0700129
Adam Langleyfcf25832014-12-18 17:42:32 -0800130 case SSL3_ST_CR_SESSION_TICKET_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400131 return "SSLv3 read server session ticket A";
Adam Langley95c29f32014-06-20 12:00:00 -0700132
Adam Langleyfcf25832014-12-18 17:42:32 -0800133 case SSL3_ST_CR_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400134 return "SSLv3 read server done A";
Adam Langley95c29f32014-06-20 12:00:00 -0700135
Adam Langleyfcf25832014-12-18 17:42:32 -0800136 case SSL3_ST_CW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400137 return "SSLv3 write client certificate A";
Adam Langley95c29f32014-06-20 12:00:00 -0700138
Adam Langleyfcf25832014-12-18 17:42:32 -0800139 case SSL3_ST_CW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400140 return "SSLv3 write client key exchange A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800141
Adam Langleyfcf25832014-12-18 17:42:32 -0800142 case SSL3_ST_CW_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400143 return "SSLv3 write certificate verify A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800144
David Benjamin352d0a92016-06-28 11:22:02 -0400145 case SSL3_ST_CW_CHANGE:
David Benjamin352d0a92016-06-28 11:22:02 -0400146 return "SSLv3 write change cipher spec";
Adam Langleyfcf25832014-12-18 17:42:32 -0800147
148 case SSL3_ST_CW_FINISHED_A:
149 case SSL3_ST_SW_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400150 return "SSLv3 write finished A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800151
Adam Langleyfcf25832014-12-18 17:42:32 -0800152 case SSL3_ST_CR_CHANGE:
153 case SSL3_ST_SR_CHANGE:
David Benjaminb86847c2015-10-17 13:05:27 -0400154 return "SSLv3 read change cipher spec";
Adam Langleyfcf25832014-12-18 17:42:32 -0800155
156 case SSL3_ST_CR_FINISHED_A:
157 case SSL3_ST_SR_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400158 return "SSLv3 read finished A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800159
Adam Langleyfcf25832014-12-18 17:42:32 -0800160 case SSL3_ST_CW_FLUSH:
161 case SSL3_ST_SW_FLUSH:
David Benjaminb86847c2015-10-17 13:05:27 -0400162 return "SSLv3 flush data";
Adam Langleyfcf25832014-12-18 17:42:32 -0800163
164 case SSL3_ST_SR_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400165 return "SSLv3 read client hello A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800166
167 case SSL3_ST_SR_CLNT_HELLO_B:
David Benjaminb86847c2015-10-17 13:05:27 -0400168 return "SSLv3 read client hello B";
Adam Langleyfcf25832014-12-18 17:42:32 -0800169
170 case SSL3_ST_SR_CLNT_HELLO_C:
David Benjaminb86847c2015-10-17 13:05:27 -0400171 return "SSLv3 read client hello C";
Adam Langleyfcf25832014-12-18 17:42:32 -0800172
Adam Langleyfcf25832014-12-18 17:42:32 -0800173 case SSL3_ST_SW_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400174 return "SSLv3 write server hello A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800175
Adam Langleyfcf25832014-12-18 17:42:32 -0800176 case SSL3_ST_SW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400177 return "SSLv3 write certificate A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800178
Adam Langleyfcf25832014-12-18 17:42:32 -0800179 case SSL3_ST_SW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400180 return "SSLv3 write key exchange A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800181
Adam Langleyfcf25832014-12-18 17:42:32 -0800182 case SSL3_ST_SW_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400183 return "SSLv3 write server done A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800184
Adam Langleyfcf25832014-12-18 17:42:32 -0800185 case SSL3_ST_SR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400186 return "SSLv3 read client certificate A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800187
Adam Langleyfcf25832014-12-18 17:42:32 -0800188 case SSL3_ST_SR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400189 return "SSLv3 read client key exchange A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800190
Adam Langleyfcf25832014-12-18 17:42:32 -0800191 case SSL3_ST_SR_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400192 return "SSLv3 read certificate verify A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800193
Adam Langleyfcf25832014-12-18 17:42:32 -0800194 /* DTLS */
195 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400196 return "DTLS1 read hello verify request A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800197
David Benjaminf60bcfb2017-08-18 15:23:44 -0400198 case SSL_ST_TLS13:
199 return ssl->server ? tls13_server_handshake_state(ssl->s3->hs)
200 : tls13_client_handshake_state(ssl->s3->hs);
201
Adam Langleyfcf25832014-12-18 17:42:32 -0800202 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400203 return "unknown state";
Adam Langleyfcf25832014-12-18 17:42:32 -0800204 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800205}
206
David Benjaminb86847c2015-10-17 13:05:27 -0400207const char *SSL_state_string(const SSL *ssl) {
David Benjamin9e766d72017-02-10 23:14:17 -0500208 switch (ssl_state(ssl)) {
Adam Langleyfcf25832014-12-18 17:42:32 -0800209 case SSL_ST_ACCEPT:
David Benjaminb86847c2015-10-17 13:05:27 -0400210 return "AINIT ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800211
212 case SSL_ST_CONNECT:
David Benjaminb86847c2015-10-17 13:05:27 -0400213 return "CINIT ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800214
215 case SSL_ST_OK:
David Benjaminb86847c2015-10-17 13:05:27 -0400216 return "SSLOK ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800217
218 /* SSLv3 additions */
219 case SSL3_ST_SW_FLUSH:
220 case SSL3_ST_CW_FLUSH:
David Benjaminb86847c2015-10-17 13:05:27 -0400221 return "3FLUSH";
Adam Langleyfcf25832014-12-18 17:42:32 -0800222
223 case SSL3_ST_CW_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400224 return "3WCH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800225
Adam Langleyfcf25832014-12-18 17:42:32 -0800226 case SSL3_ST_CR_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400227 return "3RSH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800228
Adam Langleyfcf25832014-12-18 17:42:32 -0800229 case SSL3_ST_CR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400230 return "3RSC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800231
Adam Langleyfcf25832014-12-18 17:42:32 -0800232 case SSL3_ST_CR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400233 return "3RSKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800234
Adam Langleyfcf25832014-12-18 17:42:32 -0800235 case SSL3_ST_CR_CERT_REQ_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400236 return "3RCR_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800237
Adam Langleyfcf25832014-12-18 17:42:32 -0800238 case SSL3_ST_CR_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400239 return "3RSD_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800240
Adam Langleyfcf25832014-12-18 17:42:32 -0800241 case SSL3_ST_CW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400242 return "3WCC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800243
Adam Langleyfcf25832014-12-18 17:42:32 -0800244 case SSL3_ST_CW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400245 return "3WCKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800246
Adam Langleyfcf25832014-12-18 17:42:32 -0800247 case SSL3_ST_CW_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400248 return "3WCV_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800249
David Benjamin352d0a92016-06-28 11:22:02 -0400250 case SSL3_ST_CW_CHANGE:
251 return "3WCCS_";
Adam Langleyfcf25832014-12-18 17:42:32 -0800252
253 case SSL3_ST_SW_FINISHED_A:
254 case SSL3_ST_CW_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400255 return "3WFINA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800256
Adam Langleyfcf25832014-12-18 17:42:32 -0800257 case SSL3_ST_CR_CHANGE:
258 case SSL3_ST_SR_CHANGE:
David Benjaminb86847c2015-10-17 13:05:27 -0400259 return "3RCCS_";
Adam Langleyfcf25832014-12-18 17:42:32 -0800260
261 case SSL3_ST_SR_FINISHED_A:
262 case SSL3_ST_CR_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400263 return "3RFINA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800264
Adam Langleyfcf25832014-12-18 17:42:32 -0800265 case SSL3_ST_SR_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400266 return "3RCH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800267
268 case SSL3_ST_SR_CLNT_HELLO_B:
David Benjaminb86847c2015-10-17 13:05:27 -0400269 return "3RCH_B";
Adam Langleyfcf25832014-12-18 17:42:32 -0800270
271 case SSL3_ST_SR_CLNT_HELLO_C:
David Benjaminb86847c2015-10-17 13:05:27 -0400272 return "3RCH_C";
Adam Langleyfcf25832014-12-18 17:42:32 -0800273
Adam Langleyfcf25832014-12-18 17:42:32 -0800274 case SSL3_ST_SW_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400275 return "3WSH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800276
Adam Langleyfcf25832014-12-18 17:42:32 -0800277 case SSL3_ST_SW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400278 return "3WSC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800279
Adam Langleyfcf25832014-12-18 17:42:32 -0800280 case SSL3_ST_SW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400281 return "3WSKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800282
Adam Langleyfcf25832014-12-18 17:42:32 -0800283 case SSL3_ST_SW_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400284 return "3WSD_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800285
Adam Langleyfcf25832014-12-18 17:42:32 -0800286 case SSL3_ST_SR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400287 return "3RCC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800288
Adam Langleyfcf25832014-12-18 17:42:32 -0800289 case SSL3_ST_SR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400290 return "3RCKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800291
Adam Langleyfcf25832014-12-18 17:42:32 -0800292 case SSL3_ST_SR_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400293 return "3RCV_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800294
Adam Langleyfcf25832014-12-18 17:42:32 -0800295 /* DTLS */
296 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400297 return "DRCHVA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800298
Adam Langleyfcf25832014-12-18 17:42:32 -0800299 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400300 return "UNKWN ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800301 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800302}
303
304const char *SSL_alert_type_string_long(int value) {
305 value >>= 8;
306 if (value == SSL3_AL_WARNING) {
307 return "warning";
308 } else if (value == SSL3_AL_FATAL) {
309 return "fatal";
310 }
311
312 return "unknown";
313}
314
315const char *SSL_alert_type_string(int value) {
David Benjaminc2ae53d2015-10-17 13:26:57 -0400316 return "!";
Adam Langleyfcf25832014-12-18 17:42:32 -0800317}
318
319const char *SSL_alert_desc_string(int value) {
David Benjaminc2ae53d2015-10-17 13:26:57 -0400320 return "!!";
Adam Langleyfcf25832014-12-18 17:42:32 -0800321}
322
323const char *SSL_alert_desc_string_long(int value) {
Adam Langleyfcf25832014-12-18 17:42:32 -0800324 switch (value & 0xff) {
325 case SSL3_AD_CLOSE_NOTIFY:
David Benjaminb86847c2015-10-17 13:05:27 -0400326 return "close notify";
Adam Langleyfcf25832014-12-18 17:42:32 -0800327
328 case SSL3_AD_UNEXPECTED_MESSAGE:
David Benjaminb86847c2015-10-17 13:05:27 -0400329 return "unexpected_message";
Adam Langleyfcf25832014-12-18 17:42:32 -0800330
331 case SSL3_AD_BAD_RECORD_MAC:
David Benjaminb86847c2015-10-17 13:05:27 -0400332 return "bad record mac";
Adam Langleyfcf25832014-12-18 17:42:32 -0800333
334 case SSL3_AD_DECOMPRESSION_FAILURE:
David Benjaminb86847c2015-10-17 13:05:27 -0400335 return "decompression failure";
Adam Langleyfcf25832014-12-18 17:42:32 -0800336
337 case SSL3_AD_HANDSHAKE_FAILURE:
David Benjaminb86847c2015-10-17 13:05:27 -0400338 return "handshake failure";
Adam Langleyfcf25832014-12-18 17:42:32 -0800339
340 case SSL3_AD_NO_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400341 return "no certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800342
343 case SSL3_AD_BAD_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400344 return "bad certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800345
346 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400347 return "unsupported certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800348
349 case SSL3_AD_CERTIFICATE_REVOKED:
David Benjaminb86847c2015-10-17 13:05:27 -0400350 return "certificate revoked";
Adam Langleyfcf25832014-12-18 17:42:32 -0800351
352 case SSL3_AD_CERTIFICATE_EXPIRED:
David Benjaminb86847c2015-10-17 13:05:27 -0400353 return "certificate expired";
Adam Langleyfcf25832014-12-18 17:42:32 -0800354
355 case SSL3_AD_CERTIFICATE_UNKNOWN:
David Benjaminb86847c2015-10-17 13:05:27 -0400356 return "certificate unknown";
Adam Langleyfcf25832014-12-18 17:42:32 -0800357
358 case SSL3_AD_ILLEGAL_PARAMETER:
David Benjaminb86847c2015-10-17 13:05:27 -0400359 return "illegal parameter";
Adam Langleyfcf25832014-12-18 17:42:32 -0800360
361 case TLS1_AD_DECRYPTION_FAILED:
David Benjaminb86847c2015-10-17 13:05:27 -0400362 return "decryption failed";
Adam Langleyfcf25832014-12-18 17:42:32 -0800363
364 case TLS1_AD_RECORD_OVERFLOW:
David Benjaminb86847c2015-10-17 13:05:27 -0400365 return "record overflow";
Adam Langleyfcf25832014-12-18 17:42:32 -0800366
367 case TLS1_AD_UNKNOWN_CA:
David Benjaminb86847c2015-10-17 13:05:27 -0400368 return "unknown CA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800369
370 case TLS1_AD_ACCESS_DENIED:
David Benjaminb86847c2015-10-17 13:05:27 -0400371 return "access denied";
Adam Langleyfcf25832014-12-18 17:42:32 -0800372
373 case TLS1_AD_DECODE_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400374 return "decode error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800375
376 case TLS1_AD_DECRYPT_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400377 return "decrypt error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800378
379 case TLS1_AD_EXPORT_RESTRICTION:
David Benjaminb86847c2015-10-17 13:05:27 -0400380 return "export restriction";
Adam Langleyfcf25832014-12-18 17:42:32 -0800381
382 case TLS1_AD_PROTOCOL_VERSION:
David Benjaminb86847c2015-10-17 13:05:27 -0400383 return "protocol version";
Adam Langleyfcf25832014-12-18 17:42:32 -0800384
385 case TLS1_AD_INSUFFICIENT_SECURITY:
David Benjaminb86847c2015-10-17 13:05:27 -0400386 return "insufficient security";
Adam Langleyfcf25832014-12-18 17:42:32 -0800387
388 case TLS1_AD_INTERNAL_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400389 return "internal error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800390
David Benjamin1db9e1b2016-10-07 20:51:43 -0400391 case SSL3_AD_INAPPROPRIATE_FALLBACK:
392 return "inappropriate fallback";
393
Adam Langleyfcf25832014-12-18 17:42:32 -0800394 case TLS1_AD_USER_CANCELLED:
David Benjaminb86847c2015-10-17 13:05:27 -0400395 return "user canceled";
Adam Langleyfcf25832014-12-18 17:42:32 -0800396
397 case TLS1_AD_NO_RENEGOTIATION:
David Benjaminb86847c2015-10-17 13:05:27 -0400398 return "no renegotiation";
Adam Langleyfcf25832014-12-18 17:42:32 -0800399
400 case TLS1_AD_UNSUPPORTED_EXTENSION:
David Benjaminb86847c2015-10-17 13:05:27 -0400401 return "unsupported extension";
Adam Langleyfcf25832014-12-18 17:42:32 -0800402
403 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
David Benjaminb86847c2015-10-17 13:05:27 -0400404 return "certificate unobtainable";
Adam Langleyfcf25832014-12-18 17:42:32 -0800405
406 case TLS1_AD_UNRECOGNIZED_NAME:
David Benjaminb86847c2015-10-17 13:05:27 -0400407 return "unrecognized name";
Adam Langleyfcf25832014-12-18 17:42:32 -0800408
409 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
David Benjaminb86847c2015-10-17 13:05:27 -0400410 return "bad certificate status response";
Adam Langleyfcf25832014-12-18 17:42:32 -0800411
412 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
David Benjaminb86847c2015-10-17 13:05:27 -0400413 return "bad certificate hash value";
Adam Langleyfcf25832014-12-18 17:42:32 -0800414
415 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
David Benjaminb86847c2015-10-17 13:05:27 -0400416 return "unknown PSK identity";
Adam Langleyfcf25832014-12-18 17:42:32 -0800417
David Benjamin1db9e1b2016-10-07 20:51:43 -0400418 case TLS1_AD_CERTIFICATE_REQUIRED:
419 return "certificate required";
David Benjaminc2ae53d2015-10-17 13:26:57 -0400420
Adam Langleyfcf25832014-12-18 17:42:32 -0800421 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400422 return "unknown";
Adam Langleyfcf25832014-12-18 17:42:32 -0800423 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800424}