1ebfedea0SLionel Sambuc /* ssl/ssl_stat.c */
2ebfedea0SLionel Sambuc /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3ebfedea0SLionel Sambuc * All rights reserved.
4ebfedea0SLionel Sambuc *
5ebfedea0SLionel Sambuc * This package is an SSL implementation written
6ebfedea0SLionel Sambuc * by Eric Young (eay@cryptsoft.com).
7ebfedea0SLionel Sambuc * The implementation was written so as to conform with Netscapes SSL.
8ebfedea0SLionel Sambuc *
9ebfedea0SLionel Sambuc * This library is free for commercial and non-commercial use as long as
10ebfedea0SLionel Sambuc * the following conditions are aheared to. The following conditions
11ebfedea0SLionel Sambuc * apply to all code found in this distribution, be it the RC4, RSA,
12ebfedea0SLionel Sambuc * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13ebfedea0SLionel Sambuc * included with this distribution is covered by the same copyright terms
14ebfedea0SLionel Sambuc * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15ebfedea0SLionel Sambuc *
16ebfedea0SLionel Sambuc * Copyright remains Eric Young's, and as such any Copyright notices in
17ebfedea0SLionel Sambuc * the code are not to be removed.
18ebfedea0SLionel Sambuc * If this package is used in a product, Eric Young should be given attribution
19ebfedea0SLionel Sambuc * as the author of the parts of the library used.
20ebfedea0SLionel Sambuc * This can be in the form of a textual message at program startup or
21ebfedea0SLionel Sambuc * in documentation (online or textual) provided with the package.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
24ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
25ebfedea0SLionel Sambuc * are met:
26ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the copyright
27ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
28ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
29ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
30ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
31ebfedea0SLionel Sambuc * 3. All advertising materials mentioning features or use of this software
32ebfedea0SLionel Sambuc * must display the following acknowledgement:
33ebfedea0SLionel Sambuc * "This product includes cryptographic software written by
34ebfedea0SLionel Sambuc * Eric Young (eay@cryptsoft.com)"
35ebfedea0SLionel Sambuc * The word 'cryptographic' can be left out if the rouines from the library
36ebfedea0SLionel Sambuc * being used are not cryptographic related :-).
37ebfedea0SLionel Sambuc * 4. If you include any Windows specific code (or a derivative thereof) from
38ebfedea0SLionel Sambuc * the apps directory (application code) you must include an acknowledgement:
39ebfedea0SLionel Sambuc * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40ebfedea0SLionel Sambuc *
41ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51ebfedea0SLionel Sambuc * SUCH DAMAGE.
52ebfedea0SLionel Sambuc *
53ebfedea0SLionel Sambuc * The licence and distribution terms for any publically available version or
54ebfedea0SLionel Sambuc * derivative of this code cannot be changed. i.e. this code cannot simply be
55ebfedea0SLionel Sambuc * copied and put under another distribution licence
56ebfedea0SLionel Sambuc * [including the GNU Public Licence.]
57ebfedea0SLionel Sambuc */
58ebfedea0SLionel Sambuc /* ====================================================================
59ebfedea0SLionel Sambuc * Copyright 2005 Nokia. All rights reserved.
60ebfedea0SLionel Sambuc *
61ebfedea0SLionel Sambuc * The portions of the attached software ("Contribution") is developed by
62ebfedea0SLionel Sambuc * Nokia Corporation and is licensed pursuant to the OpenSSL open source
63ebfedea0SLionel Sambuc * license.
64ebfedea0SLionel Sambuc *
65ebfedea0SLionel Sambuc * The Contribution, originally written by Mika Kousa and Pasi Eronen of
66ebfedea0SLionel Sambuc * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
67ebfedea0SLionel Sambuc * support (see RFC 4279) to OpenSSL.
68ebfedea0SLionel Sambuc *
69ebfedea0SLionel Sambuc * No patent licenses or other rights except those expressly stated in
70ebfedea0SLionel Sambuc * the OpenSSL open source license shall be deemed granted or received
71ebfedea0SLionel Sambuc * expressly, by implication, estoppel, or otherwise.
72ebfedea0SLionel Sambuc *
73ebfedea0SLionel Sambuc * No assurances are provided by Nokia that the Contribution does not
74ebfedea0SLionel Sambuc * infringe the patent or other intellectual property rights of any third
75ebfedea0SLionel Sambuc * party or that the license provides you with all the necessary rights
76ebfedea0SLionel Sambuc * to make use of the Contribution.
77ebfedea0SLionel Sambuc *
78ebfedea0SLionel Sambuc * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
79ebfedea0SLionel Sambuc * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
80ebfedea0SLionel Sambuc * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
81ebfedea0SLionel Sambuc * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
82ebfedea0SLionel Sambuc * OTHERWISE.
83ebfedea0SLionel Sambuc */
84ebfedea0SLionel Sambuc
85ebfedea0SLionel Sambuc #include <stdio.h>
86ebfedea0SLionel Sambuc #include "ssl_locl.h"
87ebfedea0SLionel Sambuc
SSL_state_string_long(const SSL * s)88ebfedea0SLionel Sambuc const char *SSL_state_string_long(const SSL *s)
89ebfedea0SLionel Sambuc {
90ebfedea0SLionel Sambuc const char *str;
91ebfedea0SLionel Sambuc
92*0a6a1f1dSLionel Sambuc switch (s->state) {
93*0a6a1f1dSLionel Sambuc case SSL_ST_BEFORE:
94*0a6a1f1dSLionel Sambuc str = "before SSL initialization";
95*0a6a1f1dSLionel Sambuc break;
96*0a6a1f1dSLionel Sambuc case SSL_ST_ACCEPT:
97*0a6a1f1dSLionel Sambuc str = "before accept initialization";
98*0a6a1f1dSLionel Sambuc break;
99*0a6a1f1dSLionel Sambuc case SSL_ST_CONNECT:
100*0a6a1f1dSLionel Sambuc str = "before connect initialization";
101*0a6a1f1dSLionel Sambuc break;
102*0a6a1f1dSLionel Sambuc case SSL_ST_OK:
103*0a6a1f1dSLionel Sambuc str = "SSL negotiation finished successfully";
104*0a6a1f1dSLionel Sambuc break;
105*0a6a1f1dSLionel Sambuc case SSL_ST_RENEGOTIATE:
106*0a6a1f1dSLionel Sambuc str = "SSL renegotiate ciphers";
107*0a6a1f1dSLionel Sambuc break;
108*0a6a1f1dSLionel Sambuc case SSL_ST_BEFORE | SSL_ST_CONNECT:
109*0a6a1f1dSLionel Sambuc str = "before/connect initialization";
110*0a6a1f1dSLionel Sambuc break;
111*0a6a1f1dSLionel Sambuc case SSL_ST_OK | SSL_ST_CONNECT:
112*0a6a1f1dSLionel Sambuc str = "ok/connect SSL initialization";
113*0a6a1f1dSLionel Sambuc break;
114*0a6a1f1dSLionel Sambuc case SSL_ST_BEFORE | SSL_ST_ACCEPT:
115*0a6a1f1dSLionel Sambuc str = "before/accept initialization";
116*0a6a1f1dSLionel Sambuc break;
117*0a6a1f1dSLionel Sambuc case SSL_ST_OK | SSL_ST_ACCEPT:
118*0a6a1f1dSLionel Sambuc str = "ok/accept SSL initialization";
119*0a6a1f1dSLionel Sambuc break;
120*0a6a1f1dSLionel Sambuc case SSL_ST_ERR:
121*0a6a1f1dSLionel Sambuc str = "error";
122*0a6a1f1dSLionel Sambuc break;
123ebfedea0SLionel Sambuc #ifndef OPENSSL_NO_SSL2
124*0a6a1f1dSLionel Sambuc case SSL2_ST_CLIENT_START_ENCRYPTION:
125*0a6a1f1dSLionel Sambuc str = "SSLv2 client start encryption";
126*0a6a1f1dSLionel Sambuc break;
127*0a6a1f1dSLionel Sambuc case SSL2_ST_SERVER_START_ENCRYPTION:
128*0a6a1f1dSLionel Sambuc str = "SSLv2 server start encryption";
129*0a6a1f1dSLionel Sambuc break;
130*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_HELLO_A:
131*0a6a1f1dSLionel Sambuc str = "SSLv2 write client hello A";
132*0a6a1f1dSLionel Sambuc break;
133*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_HELLO_B:
134*0a6a1f1dSLionel Sambuc str = "SSLv2 write client hello B";
135*0a6a1f1dSLionel Sambuc break;
136*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_HELLO_A:
137*0a6a1f1dSLionel Sambuc str = "SSLv2 read server hello A";
138*0a6a1f1dSLionel Sambuc break;
139*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_HELLO_B:
140*0a6a1f1dSLionel Sambuc str = "SSLv2 read server hello B";
141*0a6a1f1dSLionel Sambuc break;
142*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_MASTER_KEY_A:
143*0a6a1f1dSLionel Sambuc str = "SSLv2 write client master key A";
144*0a6a1f1dSLionel Sambuc break;
145*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_MASTER_KEY_B:
146*0a6a1f1dSLionel Sambuc str = "SSLv2 write client master key B";
147*0a6a1f1dSLionel Sambuc break;
148*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_FINISHED_A:
149*0a6a1f1dSLionel Sambuc str = "SSLv2 write client finished A";
150*0a6a1f1dSLionel Sambuc break;
151*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_FINISHED_B:
152*0a6a1f1dSLionel Sambuc str = "SSLv2 write client finished B";
153*0a6a1f1dSLionel Sambuc break;
154*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_A:
155*0a6a1f1dSLionel Sambuc str = "SSLv2 write client certificate A";
156*0a6a1f1dSLionel Sambuc break;
157*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_B:
158*0a6a1f1dSLionel Sambuc str = "SSLv2 write client certificate B";
159*0a6a1f1dSLionel Sambuc break;
160*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_C:
161*0a6a1f1dSLionel Sambuc str = "SSLv2 write client certificate C";
162*0a6a1f1dSLionel Sambuc break;
163*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_D:
164*0a6a1f1dSLionel Sambuc str = "SSLv2 write client certificate D";
165*0a6a1f1dSLionel Sambuc break;
166*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_VERIFY_A:
167*0a6a1f1dSLionel Sambuc str = "SSLv2 read server verify A";
168*0a6a1f1dSLionel Sambuc break;
169*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_VERIFY_B:
170*0a6a1f1dSLionel Sambuc str = "SSLv2 read server verify B";
171*0a6a1f1dSLionel Sambuc break;
172*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_FINISHED_A:
173*0a6a1f1dSLionel Sambuc str = "SSLv2 read server finished A";
174*0a6a1f1dSLionel Sambuc break;
175*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_FINISHED_B:
176*0a6a1f1dSLionel Sambuc str = "SSLv2 read server finished B";
177*0a6a1f1dSLionel Sambuc break;
178*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_A:
179*0a6a1f1dSLionel Sambuc str = "SSLv2 read client hello A";
180*0a6a1f1dSLionel Sambuc break;
181*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_B:
182*0a6a1f1dSLionel Sambuc str = "SSLv2 read client hello B";
183*0a6a1f1dSLionel Sambuc break;
184*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_C:
185*0a6a1f1dSLionel Sambuc str = "SSLv2 read client hello C";
186*0a6a1f1dSLionel Sambuc break;
187*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_HELLO_A:
188*0a6a1f1dSLionel Sambuc str = "SSLv2 write server hello A";
189*0a6a1f1dSLionel Sambuc break;
190*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_HELLO_B:
191*0a6a1f1dSLionel Sambuc str = "SSLv2 write server hello B";
192*0a6a1f1dSLionel Sambuc break;
193*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_MASTER_KEY_A:
194*0a6a1f1dSLionel Sambuc str = "SSLv2 read client master key A";
195*0a6a1f1dSLionel Sambuc break;
196*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_MASTER_KEY_B:
197*0a6a1f1dSLionel Sambuc str = "SSLv2 read client master key B";
198*0a6a1f1dSLionel Sambuc break;
199*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_A:
200*0a6a1f1dSLionel Sambuc str = "SSLv2 write server verify A";
201*0a6a1f1dSLionel Sambuc break;
202*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_B:
203*0a6a1f1dSLionel Sambuc str = "SSLv2 write server verify B";
204*0a6a1f1dSLionel Sambuc break;
205*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_C:
206*0a6a1f1dSLionel Sambuc str = "SSLv2 write server verify C";
207*0a6a1f1dSLionel Sambuc break;
208*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_FINISHED_A:
209*0a6a1f1dSLionel Sambuc str = "SSLv2 read client finished A";
210*0a6a1f1dSLionel Sambuc break;
211*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_FINISHED_B:
212*0a6a1f1dSLionel Sambuc str = "SSLv2 read client finished B";
213*0a6a1f1dSLionel Sambuc break;
214*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_FINISHED_A:
215*0a6a1f1dSLionel Sambuc str = "SSLv2 write server finished A";
216*0a6a1f1dSLionel Sambuc break;
217*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_FINISHED_B:
218*0a6a1f1dSLionel Sambuc str = "SSLv2 write server finished B";
219*0a6a1f1dSLionel Sambuc break;
220*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_A:
221*0a6a1f1dSLionel Sambuc str = "SSLv2 write request certificate A";
222*0a6a1f1dSLionel Sambuc break;
223*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_B:
224*0a6a1f1dSLionel Sambuc str = "SSLv2 write request certificate B";
225*0a6a1f1dSLionel Sambuc break;
226*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_C:
227*0a6a1f1dSLionel Sambuc str = "SSLv2 write request certificate C";
228*0a6a1f1dSLionel Sambuc break;
229*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_D:
230*0a6a1f1dSLionel Sambuc str = "SSLv2 write request certificate D";
231*0a6a1f1dSLionel Sambuc break;
232*0a6a1f1dSLionel Sambuc case SSL2_ST_X509_GET_SERVER_CERTIFICATE:
233*0a6a1f1dSLionel Sambuc str = "SSLv2 X509 read server certificate";
234*0a6a1f1dSLionel Sambuc break;
235*0a6a1f1dSLionel Sambuc case SSL2_ST_X509_GET_CLIENT_CERTIFICATE:
236*0a6a1f1dSLionel Sambuc str = "SSLv2 X509 read client certificate";
237*0a6a1f1dSLionel Sambuc break;
238ebfedea0SLionel Sambuc #endif
239ebfedea0SLionel Sambuc
240ebfedea0SLionel Sambuc #ifndef OPENSSL_NO_SSL3
241ebfedea0SLionel Sambuc /* SSLv3 additions */
242*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CLNT_HELLO_A:
243*0a6a1f1dSLionel Sambuc str = "SSLv3 write client hello A";
244*0a6a1f1dSLionel Sambuc break;
245*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CLNT_HELLO_B:
246*0a6a1f1dSLionel Sambuc str = "SSLv3 write client hello B";
247*0a6a1f1dSLionel Sambuc break;
248*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_HELLO_A:
249*0a6a1f1dSLionel Sambuc str = "SSLv3 read server hello A";
250*0a6a1f1dSLionel Sambuc break;
251*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_HELLO_B:
252*0a6a1f1dSLionel Sambuc str = "SSLv3 read server hello B";
253*0a6a1f1dSLionel Sambuc break;
254*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_A:
255*0a6a1f1dSLionel Sambuc str = "SSLv3 read server certificate A";
256*0a6a1f1dSLionel Sambuc break;
257*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_B:
258*0a6a1f1dSLionel Sambuc str = "SSLv3 read server certificate B";
259*0a6a1f1dSLionel Sambuc break;
260*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_KEY_EXCH_A:
261*0a6a1f1dSLionel Sambuc str = "SSLv3 read server key exchange A";
262*0a6a1f1dSLionel Sambuc break;
263*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_KEY_EXCH_B:
264*0a6a1f1dSLionel Sambuc str = "SSLv3 read server key exchange B";
265*0a6a1f1dSLionel Sambuc break;
266*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_REQ_A:
267*0a6a1f1dSLionel Sambuc str = "SSLv3 read server certificate request A";
268*0a6a1f1dSLionel Sambuc break;
269*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_REQ_B:
270*0a6a1f1dSLionel Sambuc str = "SSLv3 read server certificate request B";
271*0a6a1f1dSLionel Sambuc break;
272*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SESSION_TICKET_A:
273*0a6a1f1dSLionel Sambuc str = "SSLv3 read server session ticket A";
274*0a6a1f1dSLionel Sambuc break;
275*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SESSION_TICKET_B:
276*0a6a1f1dSLionel Sambuc str = "SSLv3 read server session ticket B";
277*0a6a1f1dSLionel Sambuc break;
278*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_DONE_A:
279*0a6a1f1dSLionel Sambuc str = "SSLv3 read server done A";
280*0a6a1f1dSLionel Sambuc break;
281*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_DONE_B:
282*0a6a1f1dSLionel Sambuc str = "SSLv3 read server done B";
283*0a6a1f1dSLionel Sambuc break;
284*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_A:
285*0a6a1f1dSLionel Sambuc str = "SSLv3 write client certificate A";
286*0a6a1f1dSLionel Sambuc break;
287*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_B:
288*0a6a1f1dSLionel Sambuc str = "SSLv3 write client certificate B";
289*0a6a1f1dSLionel Sambuc break;
290*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_C:
291*0a6a1f1dSLionel Sambuc str = "SSLv3 write client certificate C";
292*0a6a1f1dSLionel Sambuc break;
293*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_D:
294*0a6a1f1dSLionel Sambuc str = "SSLv3 write client certificate D";
295*0a6a1f1dSLionel Sambuc break;
296*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_KEY_EXCH_A:
297*0a6a1f1dSLionel Sambuc str = "SSLv3 write client key exchange A";
298*0a6a1f1dSLionel Sambuc break;
299*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_KEY_EXCH_B:
300*0a6a1f1dSLionel Sambuc str = "SSLv3 write client key exchange B";
301*0a6a1f1dSLionel Sambuc break;
302*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_VRFY_A:
303*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate verify A";
304*0a6a1f1dSLionel Sambuc break;
305*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_VRFY_B:
306*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate verify B";
307*0a6a1f1dSLionel Sambuc break;
308ebfedea0SLionel Sambuc
309ebfedea0SLionel Sambuc case SSL3_ST_CW_CHANGE_A:
310*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CHANGE_A:
311*0a6a1f1dSLionel Sambuc str = "SSLv3 write change cipher spec A";
312*0a6a1f1dSLionel Sambuc break;
313ebfedea0SLionel Sambuc case SSL3_ST_CW_CHANGE_B:
314*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CHANGE_B:
315*0a6a1f1dSLionel Sambuc str = "SSLv3 write change cipher spec B";
316*0a6a1f1dSLionel Sambuc break;
317ebfedea0SLionel Sambuc case SSL3_ST_CW_FINISHED_A:
318*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_FINISHED_A:
319*0a6a1f1dSLionel Sambuc str = "SSLv3 write finished A";
320*0a6a1f1dSLionel Sambuc break;
321ebfedea0SLionel Sambuc case SSL3_ST_CW_FINISHED_B:
322*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_FINISHED_B:
323*0a6a1f1dSLionel Sambuc str = "SSLv3 write finished B";
324*0a6a1f1dSLionel Sambuc break;
325ebfedea0SLionel Sambuc case SSL3_ST_CR_CHANGE_A:
326*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CHANGE_A:
327*0a6a1f1dSLionel Sambuc str = "SSLv3 read change cipher spec A";
328*0a6a1f1dSLionel Sambuc break;
329ebfedea0SLionel Sambuc case SSL3_ST_CR_CHANGE_B:
330*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CHANGE_B:
331*0a6a1f1dSLionel Sambuc str = "SSLv3 read change cipher spec B";
332*0a6a1f1dSLionel Sambuc break;
333ebfedea0SLionel Sambuc case SSL3_ST_CR_FINISHED_A:
334*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_FINISHED_A:
335*0a6a1f1dSLionel Sambuc str = "SSLv3 read finished A";
336*0a6a1f1dSLionel Sambuc break;
337ebfedea0SLionel Sambuc case SSL3_ST_CR_FINISHED_B:
338*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_FINISHED_B:
339*0a6a1f1dSLionel Sambuc str = "SSLv3 read finished B";
340*0a6a1f1dSLionel Sambuc break;
341ebfedea0SLionel Sambuc
342ebfedea0SLionel Sambuc case SSL3_ST_CW_FLUSH:
343*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_FLUSH:
344*0a6a1f1dSLionel Sambuc str = "SSLv3 flush data";
345*0a6a1f1dSLionel Sambuc break;
346ebfedea0SLionel Sambuc
347*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_A:
348*0a6a1f1dSLionel Sambuc str = "SSLv3 read client hello A";
349*0a6a1f1dSLionel Sambuc break;
350*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_B:
351*0a6a1f1dSLionel Sambuc str = "SSLv3 read client hello B";
352*0a6a1f1dSLionel Sambuc break;
353*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_C:
354*0a6a1f1dSLionel Sambuc str = "SSLv3 read client hello C";
355*0a6a1f1dSLionel Sambuc break;
356*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_A:
357*0a6a1f1dSLionel Sambuc str = "SSLv3 write hello request A";
358*0a6a1f1dSLionel Sambuc break;
359*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_B:
360*0a6a1f1dSLionel Sambuc str = "SSLv3 write hello request B";
361*0a6a1f1dSLionel Sambuc break;
362*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_C:
363*0a6a1f1dSLionel Sambuc str = "SSLv3 write hello request C";
364*0a6a1f1dSLionel Sambuc break;
365*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_HELLO_A:
366*0a6a1f1dSLionel Sambuc str = "SSLv3 write server hello A";
367*0a6a1f1dSLionel Sambuc break;
368*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_HELLO_B:
369*0a6a1f1dSLionel Sambuc str = "SSLv3 write server hello B";
370*0a6a1f1dSLionel Sambuc break;
371*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_A:
372*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate A";
373*0a6a1f1dSLionel Sambuc break;
374*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_B:
375*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate B";
376*0a6a1f1dSLionel Sambuc break;
377*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_KEY_EXCH_A:
378*0a6a1f1dSLionel Sambuc str = "SSLv3 write key exchange A";
379*0a6a1f1dSLionel Sambuc break;
380*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_KEY_EXCH_B:
381*0a6a1f1dSLionel Sambuc str = "SSLv3 write key exchange B";
382*0a6a1f1dSLionel Sambuc break;
383*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_REQ_A:
384*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate request A";
385*0a6a1f1dSLionel Sambuc break;
386*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_REQ_B:
387*0a6a1f1dSLionel Sambuc str = "SSLv3 write certificate request B";
388*0a6a1f1dSLionel Sambuc break;
389*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SESSION_TICKET_A:
390*0a6a1f1dSLionel Sambuc str = "SSLv3 write session ticket A";
391*0a6a1f1dSLionel Sambuc break;
392*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SESSION_TICKET_B:
393*0a6a1f1dSLionel Sambuc str = "SSLv3 write session ticket B";
394*0a6a1f1dSLionel Sambuc break;
395*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_DONE_A:
396*0a6a1f1dSLionel Sambuc str = "SSLv3 write server done A";
397*0a6a1f1dSLionel Sambuc break;
398*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_DONE_B:
399*0a6a1f1dSLionel Sambuc str = "SSLv3 write server done B";
400*0a6a1f1dSLionel Sambuc break;
401*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_A:
402*0a6a1f1dSLionel Sambuc str = "SSLv3 read client certificate A";
403*0a6a1f1dSLionel Sambuc break;
404*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_B:
405*0a6a1f1dSLionel Sambuc str = "SSLv3 read client certificate B";
406*0a6a1f1dSLionel Sambuc break;
407*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_KEY_EXCH_A:
408*0a6a1f1dSLionel Sambuc str = "SSLv3 read client key exchange A";
409*0a6a1f1dSLionel Sambuc break;
410*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_KEY_EXCH_B:
411*0a6a1f1dSLionel Sambuc str = "SSLv3 read client key exchange B";
412*0a6a1f1dSLionel Sambuc break;
413*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_VRFY_A:
414*0a6a1f1dSLionel Sambuc str = "SSLv3 read certificate verify A";
415*0a6a1f1dSLionel Sambuc break;
416*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_VRFY_B:
417*0a6a1f1dSLionel Sambuc str = "SSLv3 read certificate verify B";
418*0a6a1f1dSLionel Sambuc break;
419ebfedea0SLionel Sambuc #endif
420ebfedea0SLionel Sambuc
421ebfedea0SLionel Sambuc /* SSLv2/v3 compatibility states */
422ebfedea0SLionel Sambuc /* client */
423*0a6a1f1dSLionel Sambuc case SSL23_ST_CW_CLNT_HELLO_A:
424*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 write client hello A";
425*0a6a1f1dSLionel Sambuc break;
426*0a6a1f1dSLionel Sambuc case SSL23_ST_CW_CLNT_HELLO_B:
427*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 write client hello B";
428*0a6a1f1dSLionel Sambuc break;
429*0a6a1f1dSLionel Sambuc case SSL23_ST_CR_SRVR_HELLO_A:
430*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 read server hello A";
431*0a6a1f1dSLionel Sambuc break;
432*0a6a1f1dSLionel Sambuc case SSL23_ST_CR_SRVR_HELLO_B:
433*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 read server hello B";
434*0a6a1f1dSLionel Sambuc break;
435ebfedea0SLionel Sambuc /* server */
436*0a6a1f1dSLionel Sambuc case SSL23_ST_SR_CLNT_HELLO_A:
437*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 read client hello A";
438*0a6a1f1dSLionel Sambuc break;
439*0a6a1f1dSLionel Sambuc case SSL23_ST_SR_CLNT_HELLO_B:
440*0a6a1f1dSLionel Sambuc str = "SSLv2/v3 read client hello B";
441*0a6a1f1dSLionel Sambuc break;
442ebfedea0SLionel Sambuc
443ebfedea0SLionel Sambuc /* DTLS */
444*0a6a1f1dSLionel Sambuc case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
445*0a6a1f1dSLionel Sambuc str = "DTLS1 read hello verify request A";
446*0a6a1f1dSLionel Sambuc break;
447*0a6a1f1dSLionel Sambuc case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
448*0a6a1f1dSLionel Sambuc str = "DTLS1 read hello verify request B";
449*0a6a1f1dSLionel Sambuc break;
450*0a6a1f1dSLionel Sambuc case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A:
451*0a6a1f1dSLionel Sambuc str = "DTLS1 write hello verify request A";
452*0a6a1f1dSLionel Sambuc break;
453*0a6a1f1dSLionel Sambuc case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B:
454*0a6a1f1dSLionel Sambuc str = "DTLS1 write hello verify request B";
455*0a6a1f1dSLionel Sambuc break;
456ebfedea0SLionel Sambuc
457*0a6a1f1dSLionel Sambuc default:
458*0a6a1f1dSLionel Sambuc str = "unknown state";
459*0a6a1f1dSLionel Sambuc break;
460ebfedea0SLionel Sambuc }
461ebfedea0SLionel Sambuc return (str);
462ebfedea0SLionel Sambuc }
463ebfedea0SLionel Sambuc
SSL_rstate_string_long(const SSL * s)464ebfedea0SLionel Sambuc const char *SSL_rstate_string_long(const SSL *s)
465ebfedea0SLionel Sambuc {
466ebfedea0SLionel Sambuc const char *str;
467ebfedea0SLionel Sambuc
468*0a6a1f1dSLionel Sambuc switch (s->rstate) {
469*0a6a1f1dSLionel Sambuc case SSL_ST_READ_HEADER:
470*0a6a1f1dSLionel Sambuc str = "read header";
471*0a6a1f1dSLionel Sambuc break;
472*0a6a1f1dSLionel Sambuc case SSL_ST_READ_BODY:
473*0a6a1f1dSLionel Sambuc str = "read body";
474*0a6a1f1dSLionel Sambuc break;
475*0a6a1f1dSLionel Sambuc case SSL_ST_READ_DONE:
476*0a6a1f1dSLionel Sambuc str = "read done";
477*0a6a1f1dSLionel Sambuc break;
478*0a6a1f1dSLionel Sambuc default:
479*0a6a1f1dSLionel Sambuc str = "unknown";
480*0a6a1f1dSLionel Sambuc break;
481ebfedea0SLionel Sambuc }
482ebfedea0SLionel Sambuc return (str);
483ebfedea0SLionel Sambuc }
484ebfedea0SLionel Sambuc
SSL_state_string(const SSL * s)485ebfedea0SLionel Sambuc const char *SSL_state_string(const SSL *s)
486ebfedea0SLionel Sambuc {
487ebfedea0SLionel Sambuc const char *str;
488ebfedea0SLionel Sambuc
489*0a6a1f1dSLionel Sambuc switch (s->state) {
490*0a6a1f1dSLionel Sambuc case SSL_ST_BEFORE:
491*0a6a1f1dSLionel Sambuc str = "PINIT ";
492*0a6a1f1dSLionel Sambuc break;
493*0a6a1f1dSLionel Sambuc case SSL_ST_ACCEPT:
494*0a6a1f1dSLionel Sambuc str = "AINIT ";
495*0a6a1f1dSLionel Sambuc break;
496*0a6a1f1dSLionel Sambuc case SSL_ST_CONNECT:
497*0a6a1f1dSLionel Sambuc str = "CINIT ";
498*0a6a1f1dSLionel Sambuc break;
499*0a6a1f1dSLionel Sambuc case SSL_ST_OK:
500*0a6a1f1dSLionel Sambuc str = "SSLOK ";
501*0a6a1f1dSLionel Sambuc break;
502*0a6a1f1dSLionel Sambuc case SSL_ST_ERR:
503*0a6a1f1dSLionel Sambuc str = "SSLERR";
504*0a6a1f1dSLionel Sambuc break;
505ebfedea0SLionel Sambuc #ifndef OPENSSL_NO_SSL2
506*0a6a1f1dSLionel Sambuc case SSL2_ST_CLIENT_START_ENCRYPTION:
507*0a6a1f1dSLionel Sambuc str = "2CSENC";
508*0a6a1f1dSLionel Sambuc break;
509*0a6a1f1dSLionel Sambuc case SSL2_ST_SERVER_START_ENCRYPTION:
510*0a6a1f1dSLionel Sambuc str = "2SSENC";
511*0a6a1f1dSLionel Sambuc break;
512*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_HELLO_A:
513*0a6a1f1dSLionel Sambuc str = "2SCH_A";
514*0a6a1f1dSLionel Sambuc break;
515*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_HELLO_B:
516*0a6a1f1dSLionel Sambuc str = "2SCH_B";
517*0a6a1f1dSLionel Sambuc break;
518*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_HELLO_A:
519*0a6a1f1dSLionel Sambuc str = "2GSH_A";
520*0a6a1f1dSLionel Sambuc break;
521*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_HELLO_B:
522*0a6a1f1dSLionel Sambuc str = "2GSH_B";
523*0a6a1f1dSLionel Sambuc break;
524*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_MASTER_KEY_A:
525*0a6a1f1dSLionel Sambuc str = "2SCMKA";
526*0a6a1f1dSLionel Sambuc break;
527*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_MASTER_KEY_B:
528*0a6a1f1dSLionel Sambuc str = "2SCMKB";
529*0a6a1f1dSLionel Sambuc break;
530*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_FINISHED_A:
531*0a6a1f1dSLionel Sambuc str = "2SCF_A";
532*0a6a1f1dSLionel Sambuc break;
533*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_FINISHED_B:
534*0a6a1f1dSLionel Sambuc str = "2SCF_B";
535*0a6a1f1dSLionel Sambuc break;
536*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_A:
537*0a6a1f1dSLionel Sambuc str = "2SCC_A";
538*0a6a1f1dSLionel Sambuc break;
539*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_B:
540*0a6a1f1dSLionel Sambuc str = "2SCC_B";
541*0a6a1f1dSLionel Sambuc break;
542*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_C:
543*0a6a1f1dSLionel Sambuc str = "2SCC_C";
544*0a6a1f1dSLionel Sambuc break;
545*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_CLIENT_CERTIFICATE_D:
546*0a6a1f1dSLionel Sambuc str = "2SCC_D";
547*0a6a1f1dSLionel Sambuc break;
548*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_VERIFY_A:
549*0a6a1f1dSLionel Sambuc str = "2GSV_A";
550*0a6a1f1dSLionel Sambuc break;
551*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_VERIFY_B:
552*0a6a1f1dSLionel Sambuc str = "2GSV_B";
553*0a6a1f1dSLionel Sambuc break;
554*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_FINISHED_A:
555*0a6a1f1dSLionel Sambuc str = "2GSF_A";
556*0a6a1f1dSLionel Sambuc break;
557*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_SERVER_FINISHED_B:
558*0a6a1f1dSLionel Sambuc str = "2GSF_B";
559*0a6a1f1dSLionel Sambuc break;
560*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_A:
561*0a6a1f1dSLionel Sambuc str = "2GCH_A";
562*0a6a1f1dSLionel Sambuc break;
563*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_B:
564*0a6a1f1dSLionel Sambuc str = "2GCH_B";
565*0a6a1f1dSLionel Sambuc break;
566*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_HELLO_C:
567*0a6a1f1dSLionel Sambuc str = "2GCH_C";
568*0a6a1f1dSLionel Sambuc break;
569*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_HELLO_A:
570*0a6a1f1dSLionel Sambuc str = "2SSH_A";
571*0a6a1f1dSLionel Sambuc break;
572*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_HELLO_B:
573*0a6a1f1dSLionel Sambuc str = "2SSH_B";
574*0a6a1f1dSLionel Sambuc break;
575*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_MASTER_KEY_A:
576*0a6a1f1dSLionel Sambuc str = "2GCMKA";
577*0a6a1f1dSLionel Sambuc break;
578*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_MASTER_KEY_B:
579*0a6a1f1dSLionel Sambuc str = "2GCMKA";
580*0a6a1f1dSLionel Sambuc break;
581*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_A:
582*0a6a1f1dSLionel Sambuc str = "2SSV_A";
583*0a6a1f1dSLionel Sambuc break;
584*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_B:
585*0a6a1f1dSLionel Sambuc str = "2SSV_B";
586*0a6a1f1dSLionel Sambuc break;
587*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_VERIFY_C:
588*0a6a1f1dSLionel Sambuc str = "2SSV_C";
589*0a6a1f1dSLionel Sambuc break;
590*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_FINISHED_A:
591*0a6a1f1dSLionel Sambuc str = "2GCF_A";
592*0a6a1f1dSLionel Sambuc break;
593*0a6a1f1dSLionel Sambuc case SSL2_ST_GET_CLIENT_FINISHED_B:
594*0a6a1f1dSLionel Sambuc str = "2GCF_B";
595*0a6a1f1dSLionel Sambuc break;
596*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_FINISHED_A:
597*0a6a1f1dSLionel Sambuc str = "2SSF_A";
598*0a6a1f1dSLionel Sambuc break;
599*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_SERVER_FINISHED_B:
600*0a6a1f1dSLionel Sambuc str = "2SSF_B";
601*0a6a1f1dSLionel Sambuc break;
602*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_A:
603*0a6a1f1dSLionel Sambuc str = "2SRC_A";
604*0a6a1f1dSLionel Sambuc break;
605*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_B:
606*0a6a1f1dSLionel Sambuc str = "2SRC_B";
607*0a6a1f1dSLionel Sambuc break;
608*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_C:
609*0a6a1f1dSLionel Sambuc str = "2SRC_C";
610*0a6a1f1dSLionel Sambuc break;
611*0a6a1f1dSLionel Sambuc case SSL2_ST_SEND_REQUEST_CERTIFICATE_D:
612*0a6a1f1dSLionel Sambuc str = "2SRC_D";
613*0a6a1f1dSLionel Sambuc break;
614*0a6a1f1dSLionel Sambuc case SSL2_ST_X509_GET_SERVER_CERTIFICATE:
615*0a6a1f1dSLionel Sambuc str = "2X9GSC";
616*0a6a1f1dSLionel Sambuc break;
617*0a6a1f1dSLionel Sambuc case SSL2_ST_X509_GET_CLIENT_CERTIFICATE:
618*0a6a1f1dSLionel Sambuc str = "2X9GCC";
619*0a6a1f1dSLionel Sambuc break;
620ebfedea0SLionel Sambuc #endif
621ebfedea0SLionel Sambuc
622ebfedea0SLionel Sambuc #ifndef OPENSSL_NO_SSL3
623ebfedea0SLionel Sambuc /* SSLv3 additions */
624ebfedea0SLionel Sambuc case SSL3_ST_SW_FLUSH:
625*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_FLUSH:
626*0a6a1f1dSLionel Sambuc str = "3FLUSH";
627*0a6a1f1dSLionel Sambuc break;
628*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CLNT_HELLO_A:
629*0a6a1f1dSLionel Sambuc str = "3WCH_A";
630*0a6a1f1dSLionel Sambuc break;
631*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CLNT_HELLO_B:
632*0a6a1f1dSLionel Sambuc str = "3WCH_B";
633*0a6a1f1dSLionel Sambuc break;
634*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_HELLO_A:
635*0a6a1f1dSLionel Sambuc str = "3RSH_A";
636*0a6a1f1dSLionel Sambuc break;
637*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_HELLO_B:
638*0a6a1f1dSLionel Sambuc str = "3RSH_B";
639*0a6a1f1dSLionel Sambuc break;
640*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_A:
641*0a6a1f1dSLionel Sambuc str = "3RSC_A";
642*0a6a1f1dSLionel Sambuc break;
643*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_B:
644*0a6a1f1dSLionel Sambuc str = "3RSC_B";
645*0a6a1f1dSLionel Sambuc break;
646*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_KEY_EXCH_A:
647*0a6a1f1dSLionel Sambuc str = "3RSKEA";
648*0a6a1f1dSLionel Sambuc break;
649*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_KEY_EXCH_B:
650*0a6a1f1dSLionel Sambuc str = "3RSKEB";
651*0a6a1f1dSLionel Sambuc break;
652*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_REQ_A:
653*0a6a1f1dSLionel Sambuc str = "3RCR_A";
654*0a6a1f1dSLionel Sambuc break;
655*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CERT_REQ_B:
656*0a6a1f1dSLionel Sambuc str = "3RCR_B";
657*0a6a1f1dSLionel Sambuc break;
658*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_DONE_A:
659*0a6a1f1dSLionel Sambuc str = "3RSD_A";
660*0a6a1f1dSLionel Sambuc break;
661*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_SRVR_DONE_B:
662*0a6a1f1dSLionel Sambuc str = "3RSD_B";
663*0a6a1f1dSLionel Sambuc break;
664*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_A:
665*0a6a1f1dSLionel Sambuc str = "3WCC_A";
666*0a6a1f1dSLionel Sambuc break;
667*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_B:
668*0a6a1f1dSLionel Sambuc str = "3WCC_B";
669*0a6a1f1dSLionel Sambuc break;
670*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_C:
671*0a6a1f1dSLionel Sambuc str = "3WCC_C";
672*0a6a1f1dSLionel Sambuc break;
673*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_D:
674*0a6a1f1dSLionel Sambuc str = "3WCC_D";
675*0a6a1f1dSLionel Sambuc break;
676*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_KEY_EXCH_A:
677*0a6a1f1dSLionel Sambuc str = "3WCKEA";
678*0a6a1f1dSLionel Sambuc break;
679*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_KEY_EXCH_B:
680*0a6a1f1dSLionel Sambuc str = "3WCKEB";
681*0a6a1f1dSLionel Sambuc break;
682*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_VRFY_A:
683*0a6a1f1dSLionel Sambuc str = "3WCV_A";
684*0a6a1f1dSLionel Sambuc break;
685*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CERT_VRFY_B:
686*0a6a1f1dSLionel Sambuc str = "3WCV_B";
687*0a6a1f1dSLionel Sambuc break;
688ebfedea0SLionel Sambuc
689ebfedea0SLionel Sambuc case SSL3_ST_SW_CHANGE_A:
690*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CHANGE_A:
691*0a6a1f1dSLionel Sambuc str = "3WCCSA";
692*0a6a1f1dSLionel Sambuc break;
693ebfedea0SLionel Sambuc case SSL3_ST_SW_CHANGE_B:
694*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_CHANGE_B:
695*0a6a1f1dSLionel Sambuc str = "3WCCSB";
696*0a6a1f1dSLionel Sambuc break;
697ebfedea0SLionel Sambuc case SSL3_ST_SW_FINISHED_A:
698*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_FINISHED_A:
699*0a6a1f1dSLionel Sambuc str = "3WFINA";
700*0a6a1f1dSLionel Sambuc break;
701ebfedea0SLionel Sambuc case SSL3_ST_SW_FINISHED_B:
702*0a6a1f1dSLionel Sambuc case SSL3_ST_CW_FINISHED_B:
703*0a6a1f1dSLionel Sambuc str = "3WFINB";
704*0a6a1f1dSLionel Sambuc break;
705ebfedea0SLionel Sambuc case SSL3_ST_SR_CHANGE_A:
706*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CHANGE_A:
707*0a6a1f1dSLionel Sambuc str = "3RCCSA";
708*0a6a1f1dSLionel Sambuc break;
709ebfedea0SLionel Sambuc case SSL3_ST_SR_CHANGE_B:
710*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_CHANGE_B:
711*0a6a1f1dSLionel Sambuc str = "3RCCSB";
712*0a6a1f1dSLionel Sambuc break;
713ebfedea0SLionel Sambuc case SSL3_ST_SR_FINISHED_A:
714*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_FINISHED_A:
715*0a6a1f1dSLionel Sambuc str = "3RFINA";
716*0a6a1f1dSLionel Sambuc break;
717ebfedea0SLionel Sambuc case SSL3_ST_SR_FINISHED_B:
718*0a6a1f1dSLionel Sambuc case SSL3_ST_CR_FINISHED_B:
719*0a6a1f1dSLionel Sambuc str = "3RFINB";
720*0a6a1f1dSLionel Sambuc break;
721ebfedea0SLionel Sambuc
722*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_A:
723*0a6a1f1dSLionel Sambuc str = "3WHR_A";
724*0a6a1f1dSLionel Sambuc break;
725*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_B:
726*0a6a1f1dSLionel Sambuc str = "3WHR_B";
727*0a6a1f1dSLionel Sambuc break;
728*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_HELLO_REQ_C:
729*0a6a1f1dSLionel Sambuc str = "3WHR_C";
730*0a6a1f1dSLionel Sambuc break;
731*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_A:
732*0a6a1f1dSLionel Sambuc str = "3RCH_A";
733*0a6a1f1dSLionel Sambuc break;
734*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_B:
735*0a6a1f1dSLionel Sambuc str = "3RCH_B";
736*0a6a1f1dSLionel Sambuc break;
737*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CLNT_HELLO_C:
738*0a6a1f1dSLionel Sambuc str = "3RCH_C";
739*0a6a1f1dSLionel Sambuc break;
740*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_HELLO_A:
741*0a6a1f1dSLionel Sambuc str = "3WSH_A";
742*0a6a1f1dSLionel Sambuc break;
743*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_HELLO_B:
744*0a6a1f1dSLionel Sambuc str = "3WSH_B";
745*0a6a1f1dSLionel Sambuc break;
746*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_A:
747*0a6a1f1dSLionel Sambuc str = "3WSC_A";
748*0a6a1f1dSLionel Sambuc break;
749*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_B:
750*0a6a1f1dSLionel Sambuc str = "3WSC_B";
751*0a6a1f1dSLionel Sambuc break;
752*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_KEY_EXCH_A:
753*0a6a1f1dSLionel Sambuc str = "3WSKEA";
754*0a6a1f1dSLionel Sambuc break;
755*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_KEY_EXCH_B:
756*0a6a1f1dSLionel Sambuc str = "3WSKEB";
757*0a6a1f1dSLionel Sambuc break;
758*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_REQ_A:
759*0a6a1f1dSLionel Sambuc str = "3WCR_A";
760*0a6a1f1dSLionel Sambuc break;
761*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_CERT_REQ_B:
762*0a6a1f1dSLionel Sambuc str = "3WCR_B";
763*0a6a1f1dSLionel Sambuc break;
764*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_DONE_A:
765*0a6a1f1dSLionel Sambuc str = "3WSD_A";
766*0a6a1f1dSLionel Sambuc break;
767*0a6a1f1dSLionel Sambuc case SSL3_ST_SW_SRVR_DONE_B:
768*0a6a1f1dSLionel Sambuc str = "3WSD_B";
769*0a6a1f1dSLionel Sambuc break;
770*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_A:
771*0a6a1f1dSLionel Sambuc str = "3RCC_A";
772*0a6a1f1dSLionel Sambuc break;
773*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_B:
774*0a6a1f1dSLionel Sambuc str = "3RCC_B";
775*0a6a1f1dSLionel Sambuc break;
776*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_KEY_EXCH_A:
777*0a6a1f1dSLionel Sambuc str = "3RCKEA";
778*0a6a1f1dSLionel Sambuc break;
779*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_KEY_EXCH_B:
780*0a6a1f1dSLionel Sambuc str = "3RCKEB";
781*0a6a1f1dSLionel Sambuc break;
782*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_VRFY_A:
783*0a6a1f1dSLionel Sambuc str = "3RCV_A";
784*0a6a1f1dSLionel Sambuc break;
785*0a6a1f1dSLionel Sambuc case SSL3_ST_SR_CERT_VRFY_B:
786*0a6a1f1dSLionel Sambuc str = "3RCV_B";
787*0a6a1f1dSLionel Sambuc break;
788ebfedea0SLionel Sambuc #endif
789ebfedea0SLionel Sambuc
790ebfedea0SLionel Sambuc /* SSLv2/v3 compatibility states */
791ebfedea0SLionel Sambuc /* client */
792*0a6a1f1dSLionel Sambuc case SSL23_ST_CW_CLNT_HELLO_A:
793*0a6a1f1dSLionel Sambuc str = "23WCHA";
794*0a6a1f1dSLionel Sambuc break;
795*0a6a1f1dSLionel Sambuc case SSL23_ST_CW_CLNT_HELLO_B:
796*0a6a1f1dSLionel Sambuc str = "23WCHB";
797*0a6a1f1dSLionel Sambuc break;
798*0a6a1f1dSLionel Sambuc case SSL23_ST_CR_SRVR_HELLO_A:
799*0a6a1f1dSLionel Sambuc str = "23RSHA";
800*0a6a1f1dSLionel Sambuc break;
801*0a6a1f1dSLionel Sambuc case SSL23_ST_CR_SRVR_HELLO_B:
802*0a6a1f1dSLionel Sambuc str = "23RSHA";
803*0a6a1f1dSLionel Sambuc break;
804ebfedea0SLionel Sambuc /* server */
805*0a6a1f1dSLionel Sambuc case SSL23_ST_SR_CLNT_HELLO_A:
806*0a6a1f1dSLionel Sambuc str = "23RCHA";
807*0a6a1f1dSLionel Sambuc break;
808*0a6a1f1dSLionel Sambuc case SSL23_ST_SR_CLNT_HELLO_B:
809*0a6a1f1dSLionel Sambuc str = "23RCHB";
810*0a6a1f1dSLionel Sambuc break;
811ebfedea0SLionel Sambuc
812*0a6a1f1dSLionel Sambuc /* DTLS */
813*0a6a1f1dSLionel Sambuc case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
814*0a6a1f1dSLionel Sambuc str = "DRCHVA";
815*0a6a1f1dSLionel Sambuc break;
816*0a6a1f1dSLionel Sambuc case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B:
817*0a6a1f1dSLionel Sambuc str = "DRCHVB";
818*0a6a1f1dSLionel Sambuc break;
819*0a6a1f1dSLionel Sambuc case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A:
820*0a6a1f1dSLionel Sambuc str = "DWCHVA";
821*0a6a1f1dSLionel Sambuc break;
822*0a6a1f1dSLionel Sambuc case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B:
823*0a6a1f1dSLionel Sambuc str = "DWCHVB";
824*0a6a1f1dSLionel Sambuc break;
825*0a6a1f1dSLionel Sambuc
826*0a6a1f1dSLionel Sambuc default:
827*0a6a1f1dSLionel Sambuc str = "UNKWN ";
828*0a6a1f1dSLionel Sambuc break;
829ebfedea0SLionel Sambuc }
830ebfedea0SLionel Sambuc return (str);
831ebfedea0SLionel Sambuc }
832ebfedea0SLionel Sambuc
SSL_alert_type_string_long(int value)833ebfedea0SLionel Sambuc const char *SSL_alert_type_string_long(int value)
834ebfedea0SLionel Sambuc {
835ebfedea0SLionel Sambuc value >>= 8;
836ebfedea0SLionel Sambuc if (value == SSL3_AL_WARNING)
837ebfedea0SLionel Sambuc return ("warning");
838ebfedea0SLionel Sambuc else if (value == SSL3_AL_FATAL)
839ebfedea0SLionel Sambuc return ("fatal");
840ebfedea0SLionel Sambuc else
841ebfedea0SLionel Sambuc return ("unknown");
842ebfedea0SLionel Sambuc }
843ebfedea0SLionel Sambuc
SSL_alert_type_string(int value)844ebfedea0SLionel Sambuc const char *SSL_alert_type_string(int value)
845ebfedea0SLionel Sambuc {
846ebfedea0SLionel Sambuc value >>= 8;
847ebfedea0SLionel Sambuc if (value == SSL3_AL_WARNING)
848ebfedea0SLionel Sambuc return ("W");
849ebfedea0SLionel Sambuc else if (value == SSL3_AL_FATAL)
850ebfedea0SLionel Sambuc return ("F");
851ebfedea0SLionel Sambuc else
852ebfedea0SLionel Sambuc return ("U");
853ebfedea0SLionel Sambuc }
854ebfedea0SLionel Sambuc
SSL_alert_desc_string(int value)855ebfedea0SLionel Sambuc const char *SSL_alert_desc_string(int value)
856ebfedea0SLionel Sambuc {
857ebfedea0SLionel Sambuc const char *str;
858ebfedea0SLionel Sambuc
859*0a6a1f1dSLionel Sambuc switch (value & 0xff) {
860*0a6a1f1dSLionel Sambuc case SSL3_AD_CLOSE_NOTIFY:
861*0a6a1f1dSLionel Sambuc str = "CN";
862*0a6a1f1dSLionel Sambuc break;
863*0a6a1f1dSLionel Sambuc case SSL3_AD_UNEXPECTED_MESSAGE:
864*0a6a1f1dSLionel Sambuc str = "UM";
865*0a6a1f1dSLionel Sambuc break;
866*0a6a1f1dSLionel Sambuc case SSL3_AD_BAD_RECORD_MAC:
867*0a6a1f1dSLionel Sambuc str = "BM";
868*0a6a1f1dSLionel Sambuc break;
869*0a6a1f1dSLionel Sambuc case SSL3_AD_DECOMPRESSION_FAILURE:
870*0a6a1f1dSLionel Sambuc str = "DF";
871*0a6a1f1dSLionel Sambuc break;
872*0a6a1f1dSLionel Sambuc case SSL3_AD_HANDSHAKE_FAILURE:
873*0a6a1f1dSLionel Sambuc str = "HF";
874*0a6a1f1dSLionel Sambuc break;
875*0a6a1f1dSLionel Sambuc case SSL3_AD_NO_CERTIFICATE:
876*0a6a1f1dSLionel Sambuc str = "NC";
877*0a6a1f1dSLionel Sambuc break;
878*0a6a1f1dSLionel Sambuc case SSL3_AD_BAD_CERTIFICATE:
879*0a6a1f1dSLionel Sambuc str = "BC";
880*0a6a1f1dSLionel Sambuc break;
881*0a6a1f1dSLionel Sambuc case SSL3_AD_UNSUPPORTED_CERTIFICATE:
882*0a6a1f1dSLionel Sambuc str = "UC";
883*0a6a1f1dSLionel Sambuc break;
884*0a6a1f1dSLionel Sambuc case SSL3_AD_CERTIFICATE_REVOKED:
885*0a6a1f1dSLionel Sambuc str = "CR";
886*0a6a1f1dSLionel Sambuc break;
887*0a6a1f1dSLionel Sambuc case SSL3_AD_CERTIFICATE_EXPIRED:
888*0a6a1f1dSLionel Sambuc str = "CE";
889*0a6a1f1dSLionel Sambuc break;
890*0a6a1f1dSLionel Sambuc case SSL3_AD_CERTIFICATE_UNKNOWN:
891*0a6a1f1dSLionel Sambuc str = "CU";
892*0a6a1f1dSLionel Sambuc break;
893*0a6a1f1dSLionel Sambuc case SSL3_AD_ILLEGAL_PARAMETER:
894*0a6a1f1dSLionel Sambuc str = "IP";
895*0a6a1f1dSLionel Sambuc break;
896*0a6a1f1dSLionel Sambuc case TLS1_AD_DECRYPTION_FAILED:
897*0a6a1f1dSLionel Sambuc str = "DC";
898*0a6a1f1dSLionel Sambuc break;
899*0a6a1f1dSLionel Sambuc case TLS1_AD_RECORD_OVERFLOW:
900*0a6a1f1dSLionel Sambuc str = "RO";
901*0a6a1f1dSLionel Sambuc break;
902*0a6a1f1dSLionel Sambuc case TLS1_AD_UNKNOWN_CA:
903*0a6a1f1dSLionel Sambuc str = "CA";
904*0a6a1f1dSLionel Sambuc break;
905*0a6a1f1dSLionel Sambuc case TLS1_AD_ACCESS_DENIED:
906*0a6a1f1dSLionel Sambuc str = "AD";
907*0a6a1f1dSLionel Sambuc break;
908*0a6a1f1dSLionel Sambuc case TLS1_AD_DECODE_ERROR:
909*0a6a1f1dSLionel Sambuc str = "DE";
910*0a6a1f1dSLionel Sambuc break;
911*0a6a1f1dSLionel Sambuc case TLS1_AD_DECRYPT_ERROR:
912*0a6a1f1dSLionel Sambuc str = "CY";
913*0a6a1f1dSLionel Sambuc break;
914*0a6a1f1dSLionel Sambuc case TLS1_AD_EXPORT_RESTRICTION:
915*0a6a1f1dSLionel Sambuc str = "ER";
916*0a6a1f1dSLionel Sambuc break;
917*0a6a1f1dSLionel Sambuc case TLS1_AD_PROTOCOL_VERSION:
918*0a6a1f1dSLionel Sambuc str = "PV";
919*0a6a1f1dSLionel Sambuc break;
920*0a6a1f1dSLionel Sambuc case TLS1_AD_INSUFFICIENT_SECURITY:
921*0a6a1f1dSLionel Sambuc str = "IS";
922*0a6a1f1dSLionel Sambuc break;
923*0a6a1f1dSLionel Sambuc case TLS1_AD_INTERNAL_ERROR:
924*0a6a1f1dSLionel Sambuc str = "IE";
925*0a6a1f1dSLionel Sambuc break;
926*0a6a1f1dSLionel Sambuc case TLS1_AD_USER_CANCELLED:
927*0a6a1f1dSLionel Sambuc str = "US";
928*0a6a1f1dSLionel Sambuc break;
929*0a6a1f1dSLionel Sambuc case TLS1_AD_NO_RENEGOTIATION:
930*0a6a1f1dSLionel Sambuc str = "NR";
931*0a6a1f1dSLionel Sambuc break;
932*0a6a1f1dSLionel Sambuc case TLS1_AD_UNSUPPORTED_EXTENSION:
933*0a6a1f1dSLionel Sambuc str = "UE";
934*0a6a1f1dSLionel Sambuc break;
935*0a6a1f1dSLionel Sambuc case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
936*0a6a1f1dSLionel Sambuc str = "CO";
937*0a6a1f1dSLionel Sambuc break;
938*0a6a1f1dSLionel Sambuc case TLS1_AD_UNRECOGNIZED_NAME:
939*0a6a1f1dSLionel Sambuc str = "UN";
940*0a6a1f1dSLionel Sambuc break;
941*0a6a1f1dSLionel Sambuc case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
942*0a6a1f1dSLionel Sambuc str = "BR";
943*0a6a1f1dSLionel Sambuc break;
944*0a6a1f1dSLionel Sambuc case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
945*0a6a1f1dSLionel Sambuc str = "BH";
946*0a6a1f1dSLionel Sambuc break;
947*0a6a1f1dSLionel Sambuc case TLS1_AD_UNKNOWN_PSK_IDENTITY:
948*0a6a1f1dSLionel Sambuc str = "UP";
949*0a6a1f1dSLionel Sambuc break;
950*0a6a1f1dSLionel Sambuc default:
951*0a6a1f1dSLionel Sambuc str = "UK";
952*0a6a1f1dSLionel Sambuc break;
953ebfedea0SLionel Sambuc }
954ebfedea0SLionel Sambuc return (str);
955ebfedea0SLionel Sambuc }
956ebfedea0SLionel Sambuc
SSL_alert_desc_string_long(int value)957ebfedea0SLionel Sambuc const char *SSL_alert_desc_string_long(int value)
958ebfedea0SLionel Sambuc {
959ebfedea0SLionel Sambuc const char *str;
960ebfedea0SLionel Sambuc
961*0a6a1f1dSLionel Sambuc switch (value & 0xff) {
962ebfedea0SLionel Sambuc case SSL3_AD_CLOSE_NOTIFY:
963ebfedea0SLionel Sambuc str = "close notify";
964ebfedea0SLionel Sambuc break;
965ebfedea0SLionel Sambuc case SSL3_AD_UNEXPECTED_MESSAGE:
966ebfedea0SLionel Sambuc str = "unexpected_message";
967ebfedea0SLionel Sambuc break;
968ebfedea0SLionel Sambuc case SSL3_AD_BAD_RECORD_MAC:
969ebfedea0SLionel Sambuc str = "bad record mac";
970ebfedea0SLionel Sambuc break;
971ebfedea0SLionel Sambuc case SSL3_AD_DECOMPRESSION_FAILURE:
972ebfedea0SLionel Sambuc str = "decompression failure";
973ebfedea0SLionel Sambuc break;
974ebfedea0SLionel Sambuc case SSL3_AD_HANDSHAKE_FAILURE:
975ebfedea0SLionel Sambuc str = "handshake failure";
976ebfedea0SLionel Sambuc break;
977ebfedea0SLionel Sambuc case SSL3_AD_NO_CERTIFICATE:
978ebfedea0SLionel Sambuc str = "no certificate";
979ebfedea0SLionel Sambuc break;
980ebfedea0SLionel Sambuc case SSL3_AD_BAD_CERTIFICATE:
981ebfedea0SLionel Sambuc str = "bad certificate";
982ebfedea0SLionel Sambuc break;
983ebfedea0SLionel Sambuc case SSL3_AD_UNSUPPORTED_CERTIFICATE:
984ebfedea0SLionel Sambuc str = "unsupported certificate";
985ebfedea0SLionel Sambuc break;
986ebfedea0SLionel Sambuc case SSL3_AD_CERTIFICATE_REVOKED:
987ebfedea0SLionel Sambuc str = "certificate revoked";
988ebfedea0SLionel Sambuc break;
989ebfedea0SLionel Sambuc case SSL3_AD_CERTIFICATE_EXPIRED:
990ebfedea0SLionel Sambuc str = "certificate expired";
991ebfedea0SLionel Sambuc break;
992ebfedea0SLionel Sambuc case SSL3_AD_CERTIFICATE_UNKNOWN:
993ebfedea0SLionel Sambuc str = "certificate unknown";
994ebfedea0SLionel Sambuc break;
995ebfedea0SLionel Sambuc case SSL3_AD_ILLEGAL_PARAMETER:
996ebfedea0SLionel Sambuc str = "illegal parameter";
997ebfedea0SLionel Sambuc break;
998ebfedea0SLionel Sambuc case TLS1_AD_DECRYPTION_FAILED:
999ebfedea0SLionel Sambuc str = "decryption failed";
1000ebfedea0SLionel Sambuc break;
1001ebfedea0SLionel Sambuc case TLS1_AD_RECORD_OVERFLOW:
1002ebfedea0SLionel Sambuc str = "record overflow";
1003ebfedea0SLionel Sambuc break;
1004ebfedea0SLionel Sambuc case TLS1_AD_UNKNOWN_CA:
1005ebfedea0SLionel Sambuc str = "unknown CA";
1006ebfedea0SLionel Sambuc break;
1007ebfedea0SLionel Sambuc case TLS1_AD_ACCESS_DENIED:
1008ebfedea0SLionel Sambuc str = "access denied";
1009ebfedea0SLionel Sambuc break;
1010ebfedea0SLionel Sambuc case TLS1_AD_DECODE_ERROR:
1011ebfedea0SLionel Sambuc str = "decode error";
1012ebfedea0SLionel Sambuc break;
1013ebfedea0SLionel Sambuc case TLS1_AD_DECRYPT_ERROR:
1014ebfedea0SLionel Sambuc str = "decrypt error";
1015ebfedea0SLionel Sambuc break;
1016ebfedea0SLionel Sambuc case TLS1_AD_EXPORT_RESTRICTION:
1017ebfedea0SLionel Sambuc str = "export restriction";
1018ebfedea0SLionel Sambuc break;
1019ebfedea0SLionel Sambuc case TLS1_AD_PROTOCOL_VERSION:
1020ebfedea0SLionel Sambuc str = "protocol version";
1021ebfedea0SLionel Sambuc break;
1022ebfedea0SLionel Sambuc case TLS1_AD_INSUFFICIENT_SECURITY:
1023ebfedea0SLionel Sambuc str = "insufficient security";
1024ebfedea0SLionel Sambuc break;
1025ebfedea0SLionel Sambuc case TLS1_AD_INTERNAL_ERROR:
1026ebfedea0SLionel Sambuc str = "internal error";
1027ebfedea0SLionel Sambuc break;
1028ebfedea0SLionel Sambuc case TLS1_AD_USER_CANCELLED:
1029ebfedea0SLionel Sambuc str = "user canceled";
1030ebfedea0SLionel Sambuc break;
1031ebfedea0SLionel Sambuc case TLS1_AD_NO_RENEGOTIATION:
1032ebfedea0SLionel Sambuc str = "no renegotiation";
1033ebfedea0SLionel Sambuc break;
1034ebfedea0SLionel Sambuc case TLS1_AD_UNSUPPORTED_EXTENSION:
1035ebfedea0SLionel Sambuc str = "unsupported extension";
1036ebfedea0SLionel Sambuc break;
1037ebfedea0SLionel Sambuc case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
1038ebfedea0SLionel Sambuc str = "certificate unobtainable";
1039ebfedea0SLionel Sambuc break;
1040ebfedea0SLionel Sambuc case TLS1_AD_UNRECOGNIZED_NAME:
1041ebfedea0SLionel Sambuc str = "unrecognized name";
1042ebfedea0SLionel Sambuc break;
1043ebfedea0SLionel Sambuc case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
1044ebfedea0SLionel Sambuc str = "bad certificate status response";
1045ebfedea0SLionel Sambuc break;
1046ebfedea0SLionel Sambuc case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
1047ebfedea0SLionel Sambuc str = "bad certificate hash value";
1048ebfedea0SLionel Sambuc break;
1049ebfedea0SLionel Sambuc case TLS1_AD_UNKNOWN_PSK_IDENTITY:
1050ebfedea0SLionel Sambuc str = "unknown PSK identity";
1051ebfedea0SLionel Sambuc break;
1052*0a6a1f1dSLionel Sambuc default:
1053*0a6a1f1dSLionel Sambuc str = "unknown";
1054*0a6a1f1dSLionel Sambuc break;
1055ebfedea0SLionel Sambuc }
1056ebfedea0SLionel Sambuc return (str);
1057ebfedea0SLionel Sambuc }
1058ebfedea0SLionel Sambuc
SSL_rstate_string(const SSL * s)1059ebfedea0SLionel Sambuc const char *SSL_rstate_string(const SSL *s)
1060ebfedea0SLionel Sambuc {
1061ebfedea0SLionel Sambuc const char *str;
1062ebfedea0SLionel Sambuc
1063*0a6a1f1dSLionel Sambuc switch (s->rstate) {
1064*0a6a1f1dSLionel Sambuc case SSL_ST_READ_HEADER:
1065*0a6a1f1dSLionel Sambuc str = "RH";
1066*0a6a1f1dSLionel Sambuc break;
1067*0a6a1f1dSLionel Sambuc case SSL_ST_READ_BODY:
1068*0a6a1f1dSLionel Sambuc str = "RB";
1069*0a6a1f1dSLionel Sambuc break;
1070*0a6a1f1dSLionel Sambuc case SSL_ST_READ_DONE:
1071*0a6a1f1dSLionel Sambuc str = "RD";
1072*0a6a1f1dSLionel Sambuc break;
1073*0a6a1f1dSLionel Sambuc default:
1074*0a6a1f1dSLionel Sambuc str = "unknown";
1075*0a6a1f1dSLionel Sambuc break;
1076ebfedea0SLionel Sambuc }
1077ebfedea0SLionel Sambuc return (str);
1078ebfedea0SLionel Sambuc }
1079