1998-12-21 10:56:39 +00:00
|
|
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
1998-12-21 10:52:47 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This package is an SSL implementation written
|
|
|
|
* by Eric Young (eay@cryptsoft.com).
|
|
|
|
* The implementation was written so as to conform with Netscapes SSL.
|
2015-01-22 03:40:55 +00:00
|
|
|
*
|
1998-12-21 10:52:47 +00:00
|
|
|
* This library is free for commercial and non-commercial use as long as
|
|
|
|
* the following conditions are aheared to. The following conditions
|
|
|
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
|
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
|
|
* included with this distribution is covered by the same copyright terms
|
|
|
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
2015-01-22 03:40:55 +00:00
|
|
|
*
|
1998-12-21 10:52:47 +00:00
|
|
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
|
|
* the code are not to be removed.
|
|
|
|
* If this package is used in a product, Eric Young should be given attribution
|
|
|
|
* as the author of the parts of the library used.
|
|
|
|
* This can be in the form of a textual message at program startup or
|
|
|
|
* in documentation (online or textual) provided with the package.
|
2015-01-22 03:40:55 +00:00
|
|
|
*
|
1998-12-21 10:52:47 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* "This product includes cryptographic software written by
|
|
|
|
* Eric Young (eay@cryptsoft.com)"
|
|
|
|
* The word 'cryptographic' can be left out if the rouines from the library
|
|
|
|
* being used are not cryptographic related :-).
|
2015-01-22 03:40:55 +00:00
|
|
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
1998-12-21 10:52:47 +00:00
|
|
|
* the apps directory (application code) you must include an acknowledgement:
|
|
|
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
2015-01-22 03:40:55 +00:00
|
|
|
*
|
1998-12-21 10:52:47 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2015-01-22 03:40:55 +00:00
|
|
|
*
|
1998-12-21 10:52:47 +00:00
|
|
|
* The licence and distribution terms for any publically available version or
|
|
|
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
|
|
|
* copied and put under another distribution licence
|
|
|
|
* [including the GNU Public Licence.]
|
|
|
|
*/
|
2006-03-10 23:06:27 +00:00
|
|
|
/* ====================================================================
|
|
|
|
* Copyright 2005 Nokia. All rights reserved.
|
|
|
|
*
|
|
|
|
* The portions of the attached software ("Contribution") is developed by
|
|
|
|
* Nokia Corporation and is licensed pursuant to the OpenSSL open source
|
|
|
|
* license.
|
|
|
|
*
|
|
|
|
* The Contribution, originally written by Mika Kousa and Pasi Eronen of
|
|
|
|
* Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
|
|
|
|
* support (see RFC 4279) to OpenSSL.
|
|
|
|
*
|
|
|
|
* No patent licenses or other rights except those expressly stated in
|
|
|
|
* the OpenSSL open source license shall be deemed granted or received
|
|
|
|
* expressly, by implication, estoppel, or otherwise.
|
|
|
|
*
|
|
|
|
* No assurances are provided by Nokia that the Contribution does not
|
|
|
|
* infringe the patent or other intellectual property rights of any third
|
|
|
|
* party or that the license provides you with all the necessary rights
|
|
|
|
* to make use of the Contribution.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
|
|
|
|
* ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
|
|
|
|
* SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
|
|
|
|
* OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
|
|
|
|
* OTHERWISE.
|
|
|
|
*/
|
1998-12-21 10:52:47 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "ssl_locl.h"
|
|
|
|
|
2002-01-12 15:56:13 +00:00
|
|
|
const char *SSL_state_string_long(const SSL *s)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
const char *str;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-10-05 09:39:54 +00:00
|
|
|
if (ossl_statem_in_error(s)) {
|
2015-09-08 08:13:50 +00:00
|
|
|
return "error";
|
|
|
|
}
|
|
|
|
|
2015-10-05 09:49:15 +00:00
|
|
|
switch (SSL_get_state(s)) {
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_BEFORE:
|
2015-01-22 03:40:55 +00:00
|
|
|
str = "before SSL initialization";
|
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_OK:
|
2015-01-22 03:40:55 +00:00
|
|
|
str = "SSL negotiation finished successfully";
|
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
|
|
|
/* SSLv3 additions */
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CLNT_HELLO:
|
|
|
|
str = "SSLv3/TLS write client hello";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_SRVR_HELLO:
|
|
|
|
str = "SSLv3/TLS read server hello";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_CERT:
|
|
|
|
str = "SSLv3/TLS read server certificate";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_KEY_EXCH:
|
|
|
|
str = "SSLv3/TLS read server key exchange";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_CERT_REQ:
|
|
|
|
str = "SSLv3/TLS read server certificate request";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_SESSION_TICKET:
|
|
|
|
str = "SSLv3/TLS read server session ticket";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_SRVR_DONE:
|
|
|
|
str = "SSLv3/TLS read server done";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CERT:
|
|
|
|
str = "SSLv3/TLS write client certificate";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_KEY_EXCH:
|
|
|
|
str = "SSLv3/TLS write client key exchange";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CERT_VRFY:
|
|
|
|
str = "SSLv3/TLS write certificate verify";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CHANGE:
|
|
|
|
case TLS_ST_SW_CHANGE:
|
|
|
|
str = "SSLv3/TLS write change cipher spec";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_FINISHED:
|
|
|
|
case TLS_ST_SW_FINISHED:
|
|
|
|
str = "SSLv3/TLS write finished";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_CHANGE:
|
|
|
|
case TLS_ST_SR_CHANGE:
|
|
|
|
str = "SSLv3/TLS read change cipher spec";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_FINISHED:
|
|
|
|
case TLS_ST_SR_FINISHED:
|
|
|
|
str = "SSLv3/TLS read finished";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CLNT_HELLO:
|
|
|
|
str = "SSLv3/TLS read client hello";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_HELLO_REQ:
|
|
|
|
str = "SSLv3/TLS write hello request";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_SRVR_HELLO:
|
|
|
|
str = "SSLv3/TLS write server hello";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_CERT:
|
|
|
|
str = "SSLv3/TLS write certificate";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_KEY_EXCH:
|
|
|
|
str = "SSLv3/TLS write key exchange";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_CERT_REQ:
|
|
|
|
str = "SSLv3/TLS write certificate request";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_SESSION_TICKET:
|
|
|
|
str = "SSLv3/TLS write session ticket";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_SRVR_DONE:
|
|
|
|
str = "SSLv3/TLS write server done";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CERT:
|
|
|
|
str = "SSLv3/TLS read client certificate";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_KEY_EXCH:
|
|
|
|
str = "SSLv3/TLS read client key exchange";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CERT_VRFY:
|
|
|
|
str = "SSLv3/TLS read certificate verify";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2010-01-16 19:20:52 +00:00
|
|
|
/* DTLS */
|
2015-09-08 08:13:50 +00:00
|
|
|
case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
|
|
|
|
str = "DTLS1 read hello verify request";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
|
|
|
|
str = "DTLS1 write hello verify request";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2010-01-16 19:20:52 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
default:
|
|
|
|
str = "unknown state";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (str);
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
|
|
|
|
2002-01-12 15:56:13 +00:00
|
|
|
const char *SSL_state_string(const SSL *s)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
const char *str;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-10-05 09:39:54 +00:00
|
|
|
if (ossl_statem_in_error(s)) {
|
2015-09-08 08:13:50 +00:00
|
|
|
return "SSLERR";
|
|
|
|
}
|
|
|
|
|
2015-10-05 09:49:15 +00:00
|
|
|
switch (SSL_get_state(s)) {
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_BEFORE:
|
2015-01-22 03:40:55 +00:00
|
|
|
str = "PINIT ";
|
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_OK:
|
2015-01-22 03:40:55 +00:00
|
|
|
str = "SSLOK ";
|
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CLNT_HELLO:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCH";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_SRVR_HELLO:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRSH";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_CERT:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRSC";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_KEY_EXCH:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRSKE";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_CERT_REQ:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCR";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CR_SRVR_DONE:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRSD";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CERT:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCC";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_KEY_EXCH:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCKE";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_CW_CERT_VRFY:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCV";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_CHANGE:
|
|
|
|
case TLS_ST_CW_CHANGE:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCCS";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_FINISHED:
|
|
|
|
case TLS_ST_CW_FINISHED:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWFIN";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CHANGE:
|
|
|
|
case TLS_ST_CR_CHANGE:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCCS";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_FINISHED:
|
|
|
|
case TLS_ST_CR_FINISHED:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRFIN";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_HELLO_REQ:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWHR";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CLNT_HELLO:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCH";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_SRVR_HELLO:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWSH";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_CERT:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWSC";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_KEY_EXCH:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWSKE";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_CERT_REQ:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWCR";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SW_SRVR_DONE:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TWSD";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CERT:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCC";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_KEY_EXCH:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCKE";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case TLS_ST_SR_CERT_VRFY:
|
2015-10-26 12:21:40 +00:00
|
|
|
str = "TRCV";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2010-01-16 19:20:52 +00:00
|
|
|
/* DTLS */
|
2015-09-08 08:13:50 +00:00
|
|
|
case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
|
|
|
|
str = "DRCHV";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
2015-09-08 08:13:50 +00:00
|
|
|
case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
|
|
|
|
str = "DWCHV";
|
2015-01-22 03:40:55 +00:00
|
|
|
break;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
default:
|
|
|
|
str = "UNKWN ";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (str);
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2001-08-23 17:22:43 +00:00
|
|
|
const char *SSL_alert_type_string_long(int value)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
value >>= 8;
|
|
|
|
if (value == SSL3_AL_WARNING)
|
|
|
|
return ("warning");
|
|
|
|
else if (value == SSL3_AL_FATAL)
|
|
|
|
return ("fatal");
|
|
|
|
else
|
|
|
|
return ("unknown");
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2001-08-23 17:22:43 +00:00
|
|
|
const char *SSL_alert_type_string(int value)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
value >>= 8;
|
|
|
|
if (value == SSL3_AL_WARNING)
|
|
|
|
return ("W");
|
|
|
|
else if (value == SSL3_AL_FATAL)
|
|
|
|
return ("F");
|
|
|
|
else
|
|
|
|
return ("U");
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2001-08-23 17:22:43 +00:00
|
|
|
const char *SSL_alert_desc_string(int value)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
const char *str;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
switch (value & 0xff) {
|
|
|
|
case SSL3_AD_CLOSE_NOTIFY:
|
|
|
|
str = "CN";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_UNEXPECTED_MESSAGE:
|
|
|
|
str = "UM";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_BAD_RECORD_MAC:
|
|
|
|
str = "BM";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_DECOMPRESSION_FAILURE:
|
|
|
|
str = "DF";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_HANDSHAKE_FAILURE:
|
|
|
|
str = "HF";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_NO_CERTIFICATE:
|
|
|
|
str = "NC";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_BAD_CERTIFICATE:
|
|
|
|
str = "BC";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_UNSUPPORTED_CERTIFICATE:
|
|
|
|
str = "UC";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_REVOKED:
|
|
|
|
str = "CR";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_EXPIRED:
|
|
|
|
str = "CE";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_UNKNOWN:
|
|
|
|
str = "CU";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_ILLEGAL_PARAMETER:
|
|
|
|
str = "IP";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECRYPTION_FAILED:
|
|
|
|
str = "DC";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_RECORD_OVERFLOW:
|
|
|
|
str = "RO";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNKNOWN_CA:
|
|
|
|
str = "CA";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_ACCESS_DENIED:
|
|
|
|
str = "AD";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECODE_ERROR:
|
|
|
|
str = "DE";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECRYPT_ERROR:
|
|
|
|
str = "CY";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_EXPORT_RESTRICTION:
|
|
|
|
str = "ER";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_PROTOCOL_VERSION:
|
|
|
|
str = "PV";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_INSUFFICIENT_SECURITY:
|
|
|
|
str = "IS";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_INTERNAL_ERROR:
|
|
|
|
str = "IE";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_USER_CANCELLED:
|
|
|
|
str = "US";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_NO_RENEGOTIATION:
|
|
|
|
str = "NR";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNSUPPORTED_EXTENSION:
|
|
|
|
str = "UE";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
|
|
|
|
str = "CO";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNRECOGNIZED_NAME:
|
|
|
|
str = "UN";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
|
|
|
|
str = "BR";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
|
|
|
|
str = "BH";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
|
|
|
str = "UP";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
str = "UK";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (str);
|
|
|
|
}
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2001-08-23 17:22:43 +00:00
|
|
|
const char *SSL_alert_desc_string_long(int value)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
const char *str;
|
1998-12-21 10:52:47 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
switch (value & 0xff) {
|
|
|
|
case SSL3_AD_CLOSE_NOTIFY:
|
|
|
|
str = "close notify";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_UNEXPECTED_MESSAGE:
|
|
|
|
str = "unexpected_message";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_BAD_RECORD_MAC:
|
|
|
|
str = "bad record mac";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_DECOMPRESSION_FAILURE:
|
|
|
|
str = "decompression failure";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_HANDSHAKE_FAILURE:
|
|
|
|
str = "handshake failure";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_NO_CERTIFICATE:
|
|
|
|
str = "no certificate";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_BAD_CERTIFICATE:
|
|
|
|
str = "bad certificate";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_UNSUPPORTED_CERTIFICATE:
|
|
|
|
str = "unsupported certificate";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_REVOKED:
|
|
|
|
str = "certificate revoked";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_EXPIRED:
|
|
|
|
str = "certificate expired";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_CERTIFICATE_UNKNOWN:
|
|
|
|
str = "certificate unknown";
|
|
|
|
break;
|
|
|
|
case SSL3_AD_ILLEGAL_PARAMETER:
|
|
|
|
str = "illegal parameter";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECRYPTION_FAILED:
|
|
|
|
str = "decryption failed";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_RECORD_OVERFLOW:
|
|
|
|
str = "record overflow";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNKNOWN_CA:
|
|
|
|
str = "unknown CA";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_ACCESS_DENIED:
|
|
|
|
str = "access denied";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECODE_ERROR:
|
|
|
|
str = "decode error";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_DECRYPT_ERROR:
|
|
|
|
str = "decrypt error";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_EXPORT_RESTRICTION:
|
|
|
|
str = "export restriction";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_PROTOCOL_VERSION:
|
|
|
|
str = "protocol version";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_INSUFFICIENT_SECURITY:
|
|
|
|
str = "insufficient security";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_INTERNAL_ERROR:
|
|
|
|
str = "internal error";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_USER_CANCELLED:
|
|
|
|
str = "user canceled";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_NO_RENEGOTIATION:
|
|
|
|
str = "no renegotiation";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNSUPPORTED_EXTENSION:
|
|
|
|
str = "unsupported extension";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
|
|
|
|
str = "certificate unobtainable";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNRECOGNIZED_NAME:
|
|
|
|
str = "unrecognized name";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
|
|
|
|
str = "bad certificate status response";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
|
|
|
|
str = "bad certificate hash value";
|
|
|
|
break;
|
|
|
|
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
|
|
|
str = "unknown PSK identity";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
str = "unknown";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (str);
|
|
|
|
}
|