blob: 22149e25df21cb05d710ce9a8205a364a0d77ddd [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
191 case SSL3_ST_SR_KEY_EXCH_B:
David Benjaminb86847c2015-10-17 13:05:27 -0400192 return "SSLv3 read client key exchange B";
Adam Langleyfcf25832014-12-18 17:42:32 -0800193
194 case SSL3_ST_SR_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400195 return "SSLv3 read certificate verify A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800196
Adam Langleyfcf25832014-12-18 17:42:32 -0800197 /* DTLS */
198 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400199 return "DTLS1 read hello verify request A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800200
Adam Langleyfcf25832014-12-18 17:42:32 -0800201 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400202 return "unknown state";
Adam Langleyfcf25832014-12-18 17:42:32 -0800203 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800204}
205
David Benjaminb86847c2015-10-17 13:05:27 -0400206const char *SSL_state_string(const SSL *ssl) {
David Benjamin9e766d72017-02-10 23:14:17 -0500207 switch (ssl_state(ssl)) {
Adam Langleyfcf25832014-12-18 17:42:32 -0800208 case SSL_ST_ACCEPT:
David Benjaminb86847c2015-10-17 13:05:27 -0400209 return "AINIT ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800210
211 case SSL_ST_CONNECT:
David Benjaminb86847c2015-10-17 13:05:27 -0400212 return "CINIT ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800213
214 case SSL_ST_OK:
David Benjaminb86847c2015-10-17 13:05:27 -0400215 return "SSLOK ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800216
217 /* SSLv3 additions */
218 case SSL3_ST_SW_FLUSH:
219 case SSL3_ST_CW_FLUSH:
David Benjaminb86847c2015-10-17 13:05:27 -0400220 return "3FLUSH";
Adam Langleyfcf25832014-12-18 17:42:32 -0800221
222 case SSL3_ST_CW_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400223 return "3WCH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800224
Adam Langleyfcf25832014-12-18 17:42:32 -0800225 case SSL3_ST_CR_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400226 return "3RSH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800227
Adam Langleyfcf25832014-12-18 17:42:32 -0800228 case SSL3_ST_CR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400229 return "3RSC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800230
Adam Langleyfcf25832014-12-18 17:42:32 -0800231 case SSL3_ST_CR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400232 return "3RSKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800233
Adam Langleyfcf25832014-12-18 17:42:32 -0800234 case SSL3_ST_CR_CERT_REQ_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400235 return "3RCR_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800236
Adam Langleyfcf25832014-12-18 17:42:32 -0800237 case SSL3_ST_CR_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400238 return "3RSD_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800239
Adam Langleyfcf25832014-12-18 17:42:32 -0800240 case SSL3_ST_CW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400241 return "3WCC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800242
Adam Langleyfcf25832014-12-18 17:42:32 -0800243 case SSL3_ST_CW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400244 return "3WCKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800245
Adam Langleyfcf25832014-12-18 17:42:32 -0800246 case SSL3_ST_CW_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400247 return "3WCV_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800248
David Benjamin352d0a92016-06-28 11:22:02 -0400249 case SSL3_ST_CW_CHANGE:
250 return "3WCCS_";
Adam Langleyfcf25832014-12-18 17:42:32 -0800251
252 case SSL3_ST_SW_FINISHED_A:
253 case SSL3_ST_CW_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400254 return "3WFINA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800255
Adam Langleyfcf25832014-12-18 17:42:32 -0800256 case SSL3_ST_CR_CHANGE:
257 case SSL3_ST_SR_CHANGE:
David Benjaminb86847c2015-10-17 13:05:27 -0400258 return "3RCCS_";
Adam Langleyfcf25832014-12-18 17:42:32 -0800259
260 case SSL3_ST_SR_FINISHED_A:
261 case SSL3_ST_CR_FINISHED_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400262 return "3RFINA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800263
Adam Langleyfcf25832014-12-18 17:42:32 -0800264 case SSL3_ST_SR_CLNT_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400265 return "3RCH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800266
267 case SSL3_ST_SR_CLNT_HELLO_B:
David Benjaminb86847c2015-10-17 13:05:27 -0400268 return "3RCH_B";
Adam Langleyfcf25832014-12-18 17:42:32 -0800269
270 case SSL3_ST_SR_CLNT_HELLO_C:
David Benjaminb86847c2015-10-17 13:05:27 -0400271 return "3RCH_C";
Adam Langleyfcf25832014-12-18 17:42:32 -0800272
Adam Langleyfcf25832014-12-18 17:42:32 -0800273 case SSL3_ST_SW_SRVR_HELLO_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400274 return "3WSH_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800275
Adam Langleyfcf25832014-12-18 17:42:32 -0800276 case SSL3_ST_SW_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400277 return "3WSC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800278
Adam Langleyfcf25832014-12-18 17:42:32 -0800279 case SSL3_ST_SW_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400280 return "3WSKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800281
Adam Langleyfcf25832014-12-18 17:42:32 -0800282 case SSL3_ST_SW_SRVR_DONE_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400283 return "3WSD_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800284
Adam Langleyfcf25832014-12-18 17:42:32 -0800285 case SSL3_ST_SR_CERT_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400286 return "3RCC_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800287
Adam Langleyfcf25832014-12-18 17:42:32 -0800288 case SSL3_ST_SR_KEY_EXCH_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400289 return "3RCKEA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800290
Adam Langleyfcf25832014-12-18 17:42:32 -0800291 case SSL3_ST_SR_CERT_VRFY_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400292 return "3RCV_A";
Adam Langleyfcf25832014-12-18 17:42:32 -0800293
Adam Langleyfcf25832014-12-18 17:42:32 -0800294 /* DTLS */
295 case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
David Benjaminb86847c2015-10-17 13:05:27 -0400296 return "DRCHVA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800297
Adam Langleyfcf25832014-12-18 17:42:32 -0800298 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400299 return "UNKWN ";
Adam Langleyfcf25832014-12-18 17:42:32 -0800300 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800301}
302
303const char *SSL_alert_type_string_long(int value) {
304 value >>= 8;
305 if (value == SSL3_AL_WARNING) {
306 return "warning";
307 } else if (value == SSL3_AL_FATAL) {
308 return "fatal";
309 }
310
311 return "unknown";
312}
313
314const char *SSL_alert_type_string(int value) {
David Benjaminc2ae53d2015-10-17 13:26:57 -0400315 return "!";
Adam Langleyfcf25832014-12-18 17:42:32 -0800316}
317
318const char *SSL_alert_desc_string(int value) {
David Benjaminc2ae53d2015-10-17 13:26:57 -0400319 return "!!";
Adam Langleyfcf25832014-12-18 17:42:32 -0800320}
321
322const char *SSL_alert_desc_string_long(int value) {
Adam Langleyfcf25832014-12-18 17:42:32 -0800323 switch (value & 0xff) {
324 case SSL3_AD_CLOSE_NOTIFY:
David Benjaminb86847c2015-10-17 13:05:27 -0400325 return "close notify";
Adam Langleyfcf25832014-12-18 17:42:32 -0800326
327 case SSL3_AD_UNEXPECTED_MESSAGE:
David Benjaminb86847c2015-10-17 13:05:27 -0400328 return "unexpected_message";
Adam Langleyfcf25832014-12-18 17:42:32 -0800329
330 case SSL3_AD_BAD_RECORD_MAC:
David Benjaminb86847c2015-10-17 13:05:27 -0400331 return "bad record mac";
Adam Langleyfcf25832014-12-18 17:42:32 -0800332
333 case SSL3_AD_DECOMPRESSION_FAILURE:
David Benjaminb86847c2015-10-17 13:05:27 -0400334 return "decompression failure";
Adam Langleyfcf25832014-12-18 17:42:32 -0800335
336 case SSL3_AD_HANDSHAKE_FAILURE:
David Benjaminb86847c2015-10-17 13:05:27 -0400337 return "handshake failure";
Adam Langleyfcf25832014-12-18 17:42:32 -0800338
339 case SSL3_AD_NO_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400340 return "no certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800341
342 case SSL3_AD_BAD_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400343 return "bad certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800344
345 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
David Benjaminb86847c2015-10-17 13:05:27 -0400346 return "unsupported certificate";
Adam Langleyfcf25832014-12-18 17:42:32 -0800347
348 case SSL3_AD_CERTIFICATE_REVOKED:
David Benjaminb86847c2015-10-17 13:05:27 -0400349 return "certificate revoked";
Adam Langleyfcf25832014-12-18 17:42:32 -0800350
351 case SSL3_AD_CERTIFICATE_EXPIRED:
David Benjaminb86847c2015-10-17 13:05:27 -0400352 return "certificate expired";
Adam Langleyfcf25832014-12-18 17:42:32 -0800353
354 case SSL3_AD_CERTIFICATE_UNKNOWN:
David Benjaminb86847c2015-10-17 13:05:27 -0400355 return "certificate unknown";
Adam Langleyfcf25832014-12-18 17:42:32 -0800356
357 case SSL3_AD_ILLEGAL_PARAMETER:
David Benjaminb86847c2015-10-17 13:05:27 -0400358 return "illegal parameter";
Adam Langleyfcf25832014-12-18 17:42:32 -0800359
360 case TLS1_AD_DECRYPTION_FAILED:
David Benjaminb86847c2015-10-17 13:05:27 -0400361 return "decryption failed";
Adam Langleyfcf25832014-12-18 17:42:32 -0800362
363 case TLS1_AD_RECORD_OVERFLOW:
David Benjaminb86847c2015-10-17 13:05:27 -0400364 return "record overflow";
Adam Langleyfcf25832014-12-18 17:42:32 -0800365
366 case TLS1_AD_UNKNOWN_CA:
David Benjaminb86847c2015-10-17 13:05:27 -0400367 return "unknown CA";
Adam Langleyfcf25832014-12-18 17:42:32 -0800368
369 case TLS1_AD_ACCESS_DENIED:
David Benjaminb86847c2015-10-17 13:05:27 -0400370 return "access denied";
Adam Langleyfcf25832014-12-18 17:42:32 -0800371
372 case TLS1_AD_DECODE_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400373 return "decode error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800374
375 case TLS1_AD_DECRYPT_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400376 return "decrypt error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800377
378 case TLS1_AD_EXPORT_RESTRICTION:
David Benjaminb86847c2015-10-17 13:05:27 -0400379 return "export restriction";
Adam Langleyfcf25832014-12-18 17:42:32 -0800380
381 case TLS1_AD_PROTOCOL_VERSION:
David Benjaminb86847c2015-10-17 13:05:27 -0400382 return "protocol version";
Adam Langleyfcf25832014-12-18 17:42:32 -0800383
384 case TLS1_AD_INSUFFICIENT_SECURITY:
David Benjaminb86847c2015-10-17 13:05:27 -0400385 return "insufficient security";
Adam Langleyfcf25832014-12-18 17:42:32 -0800386
387 case TLS1_AD_INTERNAL_ERROR:
David Benjaminb86847c2015-10-17 13:05:27 -0400388 return "internal error";
Adam Langleyfcf25832014-12-18 17:42:32 -0800389
David Benjamin1db9e1b2016-10-07 20:51:43 -0400390 case SSL3_AD_INAPPROPRIATE_FALLBACK:
391 return "inappropriate fallback";
392
Adam Langleyfcf25832014-12-18 17:42:32 -0800393 case TLS1_AD_USER_CANCELLED:
David Benjaminb86847c2015-10-17 13:05:27 -0400394 return "user canceled";
Adam Langleyfcf25832014-12-18 17:42:32 -0800395
396 case TLS1_AD_NO_RENEGOTIATION:
David Benjaminb86847c2015-10-17 13:05:27 -0400397 return "no renegotiation";
Adam Langleyfcf25832014-12-18 17:42:32 -0800398
399 case TLS1_AD_UNSUPPORTED_EXTENSION:
David Benjaminb86847c2015-10-17 13:05:27 -0400400 return "unsupported extension";
Adam Langleyfcf25832014-12-18 17:42:32 -0800401
402 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
David Benjaminb86847c2015-10-17 13:05:27 -0400403 return "certificate unobtainable";
Adam Langleyfcf25832014-12-18 17:42:32 -0800404
405 case TLS1_AD_UNRECOGNIZED_NAME:
David Benjaminb86847c2015-10-17 13:05:27 -0400406 return "unrecognized name";
Adam Langleyfcf25832014-12-18 17:42:32 -0800407
408 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
David Benjaminb86847c2015-10-17 13:05:27 -0400409 return "bad certificate status response";
Adam Langleyfcf25832014-12-18 17:42:32 -0800410
411 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
David Benjaminb86847c2015-10-17 13:05:27 -0400412 return "bad certificate hash value";
Adam Langleyfcf25832014-12-18 17:42:32 -0800413
414 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
David Benjaminb86847c2015-10-17 13:05:27 -0400415 return "unknown PSK identity";
Adam Langleyfcf25832014-12-18 17:42:32 -0800416
David Benjamin1db9e1b2016-10-07 20:51:43 -0400417 case TLS1_AD_CERTIFICATE_REQUIRED:
418 return "certificate required";
David Benjaminc2ae53d2015-10-17 13:26:57 -0400419
Adam Langleyfcf25832014-12-18 17:42:32 -0800420 default:
David Benjaminb86847c2015-10-17 13:05:27 -0400421 return "unknown";
Adam Langleyfcf25832014-12-18 17:42:32 -0800422 }
Adam Langleyfcf25832014-12-18 17:42:32 -0800423}