VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.0g/ssl/ssl_stat.c@ 69890

Last change on this file since 69890 was 69890, checked in by vboxsync, 7 years ago

Added OpenSSL 1.1.0g with unneeded files removed, otherwise unmodified.
bugref:8070: src/libs maintenance

  • Property svn:eol-style set to native
File size: 11.0 KB
Line 
1/*
2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/* ====================================================================
11 * Copyright 2005 Nokia. All rights reserved.
12 *
13 * The portions of the attached software ("Contribution") is developed by
14 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
15 * license.
16 *
17 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
18 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
19 * support (see RFC 4279) to OpenSSL.
20 *
21 * No patent licenses or other rights except those expressly stated in
22 * the OpenSSL open source license shall be deemed granted or received
23 * expressly, by implication, estoppel, or otherwise.
24 *
25 * No assurances are provided by Nokia that the Contribution does not
26 * infringe the patent or other intellectual property rights of any third
27 * party or that the license provides you with all the necessary rights
28 * to make use of the Contribution.
29 *
30 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
31 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
32 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
33 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
34 * OTHERWISE.
35 */
36
37#include <stdio.h>
38#include "ssl_locl.h"
39
40const char *SSL_state_string_long(const SSL *s)
41{
42 if (ossl_statem_in_error(s))
43 return "error";
44
45 switch (SSL_get_state(s)) {
46 case TLS_ST_CR_CERT_STATUS:
47 return "SSLv3/TLS read certificate status";
48 case TLS_ST_CW_NEXT_PROTO:
49 return "SSLv3/TLS write next proto";
50 case TLS_ST_SR_NEXT_PROTO:
51 return "SSLv3/TLS read next proto";
52 case TLS_ST_SW_CERT_STATUS:
53 return "SSLv3/TLS write certificate status";
54 case TLS_ST_BEFORE:
55 return "before SSL initialization";
56 case TLS_ST_OK:
57 return "SSL negotiation finished successfully";
58 case TLS_ST_CW_CLNT_HELLO:
59 return "SSLv3/TLS write client hello";
60 case TLS_ST_CR_SRVR_HELLO:
61 return "SSLv3/TLS read server hello";
62 case TLS_ST_CR_CERT:
63 return "SSLv3/TLS read server certificate";
64 case TLS_ST_CR_KEY_EXCH:
65 return "SSLv3/TLS read server key exchange";
66 case TLS_ST_CR_CERT_REQ:
67 return "SSLv3/TLS read server certificate request";
68 case TLS_ST_CR_SESSION_TICKET:
69 return "SSLv3/TLS read server session ticket";
70 case TLS_ST_CR_SRVR_DONE:
71 return "SSLv3/TLS read server done";
72 case TLS_ST_CW_CERT:
73 return "SSLv3/TLS write client certificate";
74 case TLS_ST_CW_KEY_EXCH:
75 return "SSLv3/TLS write client key exchange";
76 case TLS_ST_CW_CERT_VRFY:
77 return "SSLv3/TLS write certificate verify";
78 case TLS_ST_CW_CHANGE:
79 case TLS_ST_SW_CHANGE:
80 return "SSLv3/TLS write change cipher spec";
81 case TLS_ST_CW_FINISHED:
82 case TLS_ST_SW_FINISHED:
83 return "SSLv3/TLS write finished";
84 case TLS_ST_CR_CHANGE:
85 case TLS_ST_SR_CHANGE:
86 return "SSLv3/TLS read change cipher spec";
87 case TLS_ST_CR_FINISHED:
88 case TLS_ST_SR_FINISHED:
89 return "SSLv3/TLS read finished";
90 case TLS_ST_SR_CLNT_HELLO:
91 return "SSLv3/TLS read client hello";
92 case TLS_ST_SW_HELLO_REQ:
93 return "SSLv3/TLS write hello request";
94 case TLS_ST_SW_SRVR_HELLO:
95 return "SSLv3/TLS write server hello";
96 case TLS_ST_SW_CERT:
97 return "SSLv3/TLS write certificate";
98 case TLS_ST_SW_KEY_EXCH:
99 return "SSLv3/TLS write key exchange";
100 case TLS_ST_SW_CERT_REQ:
101 return "SSLv3/TLS write certificate request";
102 case TLS_ST_SW_SESSION_TICKET:
103 return "SSLv3/TLS write session ticket";
104 case TLS_ST_SW_SRVR_DONE:
105 return "SSLv3/TLS write server done";
106 case TLS_ST_SR_CERT:
107 return "SSLv3/TLS read client certificate";
108 case TLS_ST_SR_KEY_EXCH:
109 return "SSLv3/TLS read client key exchange";
110 case TLS_ST_SR_CERT_VRFY:
111 return "SSLv3/TLS read certificate verify";
112 case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
113 return "DTLS1 read hello verify request";
114 case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
115 return "DTLS1 write hello verify request";
116 default:
117 return "unknown state";
118 }
119}
120
121const char *SSL_state_string(const SSL *s)
122{
123 if (ossl_statem_in_error(s))
124 return "SSLERR";
125
126 switch (SSL_get_state(s)) {
127 case TLS_ST_SR_NEXT_PROTO:
128 return "TRNP";
129 case TLS_ST_SW_SESSION_TICKET:
130 return "TWST";
131 case TLS_ST_SW_CERT_STATUS:
132 return "TWCS";
133 case TLS_ST_CR_CERT_STATUS:
134 return "TRCS";
135 case TLS_ST_CR_SESSION_TICKET:
136 return "TRST";
137 case TLS_ST_CW_NEXT_PROTO:
138 return "TWNP";
139 case TLS_ST_BEFORE:
140 return "PINIT ";
141 case TLS_ST_OK:
142 return "SSLOK ";
143 case TLS_ST_CW_CLNT_HELLO:
144 return "TWCH";
145 case TLS_ST_CR_SRVR_HELLO:
146 return "TRSH";
147 case TLS_ST_CR_CERT:
148 return "TRSC";
149 case TLS_ST_CR_KEY_EXCH:
150 return "TRSKE";
151 case TLS_ST_CR_CERT_REQ:
152 return "TRCR";
153 case TLS_ST_CR_SRVR_DONE:
154 return "TRSD";
155 case TLS_ST_CW_CERT:
156 return "TWCC";
157 case TLS_ST_CW_KEY_EXCH:
158 return "TWCKE";
159 case TLS_ST_CW_CERT_VRFY:
160 return "TWCV";
161 case TLS_ST_SW_CHANGE:
162 case TLS_ST_CW_CHANGE:
163 return "TWCCS";
164 case TLS_ST_SW_FINISHED:
165 case TLS_ST_CW_FINISHED:
166 return "TWFIN";
167 case TLS_ST_SR_CHANGE:
168 case TLS_ST_CR_CHANGE:
169 return "TRCCS";
170 case TLS_ST_SR_FINISHED:
171 case TLS_ST_CR_FINISHED:
172 return "TRFIN";
173 case TLS_ST_SW_HELLO_REQ:
174 return "TWHR";
175 case TLS_ST_SR_CLNT_HELLO:
176 return "TRCH";
177 case TLS_ST_SW_SRVR_HELLO:
178 return "TWSH";
179 case TLS_ST_SW_CERT:
180 return "TWSC";
181 case TLS_ST_SW_KEY_EXCH:
182 return "TWSKE";
183 case TLS_ST_SW_CERT_REQ:
184 return "TWCR";
185 case TLS_ST_SW_SRVR_DONE:
186 return "TWSD";
187 case TLS_ST_SR_CERT:
188 return "TRCC";
189 case TLS_ST_SR_KEY_EXCH:
190 return "TRCKE";
191 case TLS_ST_SR_CERT_VRFY:
192 return "TRCV";
193 case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
194 return "DRCHV";
195 case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
196 return "DWCHV";
197 default:
198 return "UNKWN ";
199 }
200}
201
202const char *SSL_alert_type_string_long(int value)
203{
204 switch (value >> 8) {
205 case SSL3_AL_WARNING:
206 return "warning";
207 case SSL3_AL_FATAL:
208 return "fatal";
209 default:
210 return "unknown";
211 }
212}
213
214const char *SSL_alert_type_string(int value)
215{
216 switch (value >> 8) {
217 case SSL3_AL_WARNING:
218 return "W";
219 case SSL3_AL_FATAL:
220 return "F";
221 default:
222 return "U";
223 }
224}
225
226const char *SSL_alert_desc_string(int value)
227{
228 switch (value & 0xff) {
229 case SSL3_AD_CLOSE_NOTIFY:
230 return "CN";
231 case SSL3_AD_UNEXPECTED_MESSAGE:
232 return "UM";
233 case SSL3_AD_BAD_RECORD_MAC:
234 return "BM";
235 case SSL3_AD_DECOMPRESSION_FAILURE:
236 return "DF";
237 case SSL3_AD_HANDSHAKE_FAILURE:
238 return "HF";
239 case SSL3_AD_NO_CERTIFICATE:
240 return "NC";
241 case SSL3_AD_BAD_CERTIFICATE:
242 return "BC";
243 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
244 return "UC";
245 case SSL3_AD_CERTIFICATE_REVOKED:
246 return "CR";
247 case SSL3_AD_CERTIFICATE_EXPIRED:
248 return "CE";
249 case SSL3_AD_CERTIFICATE_UNKNOWN:
250 return "CU";
251 case SSL3_AD_ILLEGAL_PARAMETER:
252 return "IP";
253 case TLS1_AD_DECRYPTION_FAILED:
254 return "DC";
255 case TLS1_AD_RECORD_OVERFLOW:
256 return "RO";
257 case TLS1_AD_UNKNOWN_CA:
258 return "CA";
259 case TLS1_AD_ACCESS_DENIED:
260 return "AD";
261 case TLS1_AD_DECODE_ERROR:
262 return "DE";
263 case TLS1_AD_DECRYPT_ERROR:
264 return "CY";
265 case TLS1_AD_EXPORT_RESTRICTION:
266 return "ER";
267 case TLS1_AD_PROTOCOL_VERSION:
268 return "PV";
269 case TLS1_AD_INSUFFICIENT_SECURITY:
270 return "IS";
271 case TLS1_AD_INTERNAL_ERROR:
272 return "IE";
273 case TLS1_AD_USER_CANCELLED:
274 return "US";
275 case TLS1_AD_NO_RENEGOTIATION:
276 return "NR";
277 case TLS1_AD_UNSUPPORTED_EXTENSION:
278 return "UE";
279 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
280 return "CO";
281 case TLS1_AD_UNRECOGNIZED_NAME:
282 return "UN";
283 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
284 return "BR";
285 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
286 return "BH";
287 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
288 return "UP";
289 default:
290 return "UK";
291 }
292}
293
294const char *SSL_alert_desc_string_long(int value)
295{
296 switch (value & 0xff) {
297 case SSL3_AD_CLOSE_NOTIFY:
298 return "close notify";
299 case SSL3_AD_UNEXPECTED_MESSAGE:
300 return "unexpected_message";
301 case SSL3_AD_BAD_RECORD_MAC:
302 return "bad record mac";
303 case SSL3_AD_DECOMPRESSION_FAILURE:
304 return "decompression failure";
305 case SSL3_AD_HANDSHAKE_FAILURE:
306 return "handshake failure";
307 case SSL3_AD_NO_CERTIFICATE:
308 return "no certificate";
309 case SSL3_AD_BAD_CERTIFICATE:
310 return "bad certificate";
311 case SSL3_AD_UNSUPPORTED_CERTIFICATE:
312 return "unsupported certificate";
313 case SSL3_AD_CERTIFICATE_REVOKED:
314 return "certificate revoked";
315 case SSL3_AD_CERTIFICATE_EXPIRED:
316 return "certificate expired";
317 case SSL3_AD_CERTIFICATE_UNKNOWN:
318 return "certificate unknown";
319 case SSL3_AD_ILLEGAL_PARAMETER:
320 return "illegal parameter";
321 case TLS1_AD_DECRYPTION_FAILED:
322 return "decryption failed";
323 case TLS1_AD_RECORD_OVERFLOW:
324 return "record overflow";
325 case TLS1_AD_UNKNOWN_CA:
326 return "unknown CA";
327 case TLS1_AD_ACCESS_DENIED:
328 return "access denied";
329 case TLS1_AD_DECODE_ERROR:
330 return "decode error";
331 case TLS1_AD_DECRYPT_ERROR:
332 return "decrypt error";
333 case TLS1_AD_EXPORT_RESTRICTION:
334 return "export restriction";
335 case TLS1_AD_PROTOCOL_VERSION:
336 return "protocol version";
337 case TLS1_AD_INSUFFICIENT_SECURITY:
338 return "insufficient security";
339 case TLS1_AD_INTERNAL_ERROR:
340 return "internal error";
341 case TLS1_AD_USER_CANCELLED:
342 return "user canceled";
343 case TLS1_AD_NO_RENEGOTIATION:
344 return "no renegotiation";
345 case TLS1_AD_UNSUPPORTED_EXTENSION:
346 return "unsupported extension";
347 case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
348 return "certificate unobtainable";
349 case TLS1_AD_UNRECOGNIZED_NAME:
350 return "unrecognized name";
351 case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
352 return "bad certificate status response";
353 case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
354 return "bad certificate hash value";
355 case TLS1_AD_UNKNOWN_PSK_IDENTITY:
356 return "unknown PSK identity";
357 case TLS1_AD_NO_APPLICATION_PROTOCOL:
358 return "no application protocol";
359 default:
360 return "unknown";
361 }
362}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette