2016-05-18 02:18:30 +08:00
|
|
|
/*
|
2017-07-31 20:55:37 +08:00
|
|
|
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
2017-06-20 22:14:36 +08:00
|
|
|
* Copyright 2005 Nokia. All rights reserved.
|
1998-12-21 18:52:47 +08:00
|
|
|
*
|
2018-12-06 20:08:51 +08:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 02:18:30 +08:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
1998-12-21 18:52:47 +08:00
|
|
|
*/
|
2016-05-18 02:18:30 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
#include <stdio.h>
|
2019-09-28 06:45:40 +08:00
|
|
|
#include "ssl_local.h"
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2002-01-12 23:56:13 +08:00
|
|
|
const char *SSL_state_string_long(const SSL *s)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
2016-03-22 22:52:13 +08:00
|
|
|
if (ossl_statem_in_error(s))
|
2015-09-08 16:13:50 +08:00
|
|
|
return "error";
|
|
|
|
|
2015-10-05 17:49:15 +08:00
|
|
|
switch (SSL_get_state(s)) {
|
2016-09-08 03:40:16 +08:00
|
|
|
case TLS_ST_CR_CERT_STATUS:
|
|
|
|
return "SSLv3/TLS read certificate status";
|
|
|
|
case TLS_ST_CW_NEXT_PROTO:
|
|
|
|
return "SSLv3/TLS write next proto";
|
|
|
|
case TLS_ST_SR_NEXT_PROTO:
|
2017-07-31 20:55:37 +08:00
|
|
|
return "SSLv3/TLS read next proto";
|
2016-09-08 03:40:16 +08:00
|
|
|
case TLS_ST_SW_CERT_STATUS:
|
2017-07-31 20:55:37 +08:00
|
|
|
return "SSLv3/TLS write certificate status";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_BEFORE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "before SSL initialization";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_OK:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSL negotiation finished successfully";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CLNT_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write client hello";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_SRVR_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server hello";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server certificate";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server key exchange";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_CERT_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server certificate request";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_SESSION_TICKET:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server session ticket";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_SRVR_DONE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read server done";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write client certificate";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write client key exchange";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CERT_VRFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write certificate verify";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CHANGE:
|
|
|
|
case TLS_ST_SW_CHANGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write change cipher spec";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_FINISHED:
|
|
|
|
case TLS_ST_SW_FINISHED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write finished";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_CHANGE:
|
|
|
|
case TLS_ST_SR_CHANGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read change cipher spec";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_FINISHED:
|
|
|
|
case TLS_ST_SR_FINISHED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read finished";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CLNT_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read client hello";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_HELLO_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write hello request";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_SRVR_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write server hello";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write certificate";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write key exchange";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_CERT_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write certificate request";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_SESSION_TICKET:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write session ticket";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_SRVR_DONE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS write server done";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read client certificate";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read client key exchange";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CERT_VRFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLv3/TLS read certificate verify";
|
2015-09-08 16:13:50 +08:00
|
|
|
case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DTLS1 read hello verify request";
|
2015-09-08 16:13:50 +08:00
|
|
|
case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DTLS1 write hello verify request";
|
2017-11-27 20:35:15 +08:00
|
|
|
case TLS_ST_SW_ENCRYPTED_EXTENSIONS:
|
|
|
|
return "TLSv1.3 write encrypted extensions";
|
|
|
|
case TLS_ST_CR_ENCRYPTED_EXTENSIONS:
|
|
|
|
return "TLSv1.3 read encrypted extensions";
|
|
|
|
case TLS_ST_CR_CERT_VRFY:
|
|
|
|
return "TLSv1.3 read server certificate verify";
|
|
|
|
case TLS_ST_SW_CERT_VRFY:
|
|
|
|
return "TLSv1.3 write server certificate verify";
|
|
|
|
case TLS_ST_CR_HELLO_REQ:
|
|
|
|
return "SSLv3/TLS read hello request";
|
|
|
|
case TLS_ST_SW_KEY_UPDATE:
|
|
|
|
return "TLSv1.3 write server key update";
|
|
|
|
case TLS_ST_CW_KEY_UPDATE:
|
|
|
|
return "TLSv1.3 write client key update";
|
|
|
|
case TLS_ST_SR_KEY_UPDATE:
|
|
|
|
return "TLSv1.3 read client key update";
|
|
|
|
case TLS_ST_CR_KEY_UPDATE:
|
|
|
|
return "TLSv1.3 read server key update";
|
|
|
|
case TLS_ST_EARLY_DATA:
|
|
|
|
return "TLSv1.3 early data";
|
|
|
|
case TLS_ST_PENDING_EARLY_DATA_END:
|
|
|
|
return "TLSv1.3 pending early data end";
|
|
|
|
case TLS_ST_CW_END_OF_EARLY_DATA:
|
|
|
|
return "TLSv1.3 write end of early data";
|
|
|
|
case TLS_ST_SR_END_OF_EARLY_DATA:
|
|
|
|
return "TLSv1.3 read end of early data";
|
2015-01-22 11:40:55 +08:00
|
|
|
default:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unknown state";
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2002-01-12 23:56:13 +08:00
|
|
|
const char *SSL_state_string(const SSL *s)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
2016-03-22 22:52:13 +08:00
|
|
|
if (ossl_statem_in_error(s))
|
2015-09-08 16:13:50 +08:00
|
|
|
return "SSLERR";
|
|
|
|
|
2015-10-05 17:49:15 +08:00
|
|
|
switch (SSL_get_state(s)) {
|
2016-09-08 03:40:16 +08:00
|
|
|
case TLS_ST_SR_NEXT_PROTO:
|
|
|
|
return "TRNP";
|
|
|
|
case TLS_ST_SW_SESSION_TICKET:
|
|
|
|
return "TWST";
|
|
|
|
case TLS_ST_SW_CERT_STATUS:
|
|
|
|
return "TWCS";
|
|
|
|
case TLS_ST_CR_CERT_STATUS:
|
|
|
|
return "TRCS";
|
|
|
|
case TLS_ST_CR_SESSION_TICKET:
|
|
|
|
return "TRST";
|
|
|
|
case TLS_ST_CW_NEXT_PROTO:
|
|
|
|
return "TWNP";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_BEFORE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "PINIT ";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_OK:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "SSLOK ";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CLNT_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCH";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_SRVR_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRSH";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRSC";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRSKE";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_CERT_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCR";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CR_SRVR_DONE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRSD";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCC";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCKE";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_CW_CERT_VRFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCV";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_CHANGE:
|
|
|
|
case TLS_ST_CW_CHANGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCCS";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_FINISHED:
|
|
|
|
case TLS_ST_CW_FINISHED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWFIN";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CHANGE:
|
|
|
|
case TLS_ST_CR_CHANGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCCS";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_FINISHED:
|
|
|
|
case TLS_ST_CR_FINISHED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRFIN";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_HELLO_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWHR";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CLNT_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCH";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_SRVR_HELLO:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWSH";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWSC";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWSKE";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_CERT_REQ:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWCR";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SW_SRVR_DONE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TWSD";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CERT:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCC";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_KEY_EXCH:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCKE";
|
2015-09-08 16:13:50 +08:00
|
|
|
case TLS_ST_SR_CERT_VRFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "TRCV";
|
2015-09-08 16:13:50 +08:00
|
|
|
case DTLS_ST_CR_HELLO_VERIFY_REQUEST:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DRCHV";
|
2015-09-08 16:13:50 +08:00
|
|
|
case DTLS_ST_SW_HELLO_VERIFY_REQUEST:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DWCHV";
|
2017-11-27 20:35:15 +08:00
|
|
|
case TLS_ST_SW_ENCRYPTED_EXTENSIONS:
|
|
|
|
return "TWEE";
|
|
|
|
case TLS_ST_CR_ENCRYPTED_EXTENSIONS:
|
|
|
|
return "TREE";
|
|
|
|
case TLS_ST_CR_CERT_VRFY:
|
|
|
|
return "TRSCV";
|
|
|
|
case TLS_ST_SW_CERT_VRFY:
|
|
|
|
return "TRSCV";
|
|
|
|
case TLS_ST_CR_HELLO_REQ:
|
|
|
|
return "TRHR";
|
|
|
|
case TLS_ST_SW_KEY_UPDATE:
|
|
|
|
return "TWSKU";
|
|
|
|
case TLS_ST_CW_KEY_UPDATE:
|
|
|
|
return "TWCKU";
|
|
|
|
case TLS_ST_SR_KEY_UPDATE:
|
|
|
|
return "TRCKU";
|
|
|
|
case TLS_ST_CR_KEY_UPDATE:
|
|
|
|
return "TRSKU";
|
|
|
|
case TLS_ST_EARLY_DATA:
|
|
|
|
return "TED";
|
|
|
|
case TLS_ST_PENDING_EARLY_DATA_END:
|
|
|
|
return "TPEDE";
|
|
|
|
case TLS_ST_CW_END_OF_EARLY_DATA:
|
|
|
|
return "TWEOED";
|
|
|
|
case TLS_ST_SR_END_OF_EARLY_DATA:
|
|
|
|
return "TWEOED";
|
2015-01-22 11:40:55 +08:00
|
|
|
default:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UNKWN ";
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2001-08-24 01:22:43 +08:00
|
|
|
const char *SSL_alert_type_string_long(int value)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
2016-03-22 22:52:13 +08:00
|
|
|
switch (value >> 8) {
|
|
|
|
case SSL3_AL_WARNING:
|
|
|
|
return "warning";
|
|
|
|
case SSL3_AL_FATAL:
|
|
|
|
return "fatal";
|
|
|
|
default:
|
|
|
|
return "unknown";
|
|
|
|
}
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2001-08-24 01:22:43 +08:00
|
|
|
const char *SSL_alert_type_string(int value)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
2016-03-22 22:52:13 +08:00
|
|
|
switch (value >> 8) {
|
|
|
|
case SSL3_AL_WARNING:
|
|
|
|
return "W";
|
|
|
|
case SSL3_AL_FATAL:
|
|
|
|
return "F";
|
|
|
|
default:
|
|
|
|
return "U";
|
|
|
|
}
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2001-08-24 01:22:43 +08:00
|
|
|
const char *SSL_alert_desc_string(int value)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
|
|
|
switch (value & 0xff) {
|
|
|
|
case SSL3_AD_CLOSE_NOTIFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CN";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_UNEXPECTED_MESSAGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UM";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_BAD_RECORD_MAC:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "BM";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_DECOMPRESSION_FAILURE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DF";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_HANDSHAKE_FAILURE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "HF";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_NO_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "NC";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_BAD_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "BC";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_UNSUPPORTED_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UC";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_REVOKED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CR";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_EXPIRED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CE";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_UNKNOWN:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CU";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_ILLEGAL_PARAMETER:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "IP";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECRYPTION_FAILED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DC";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_RECORD_OVERFLOW:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "RO";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNKNOWN_CA:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CA";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_ACCESS_DENIED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "AD";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECODE_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "DE";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECRYPT_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CY";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_EXPORT_RESTRICTION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "ER";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_PROTOCOL_VERSION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "PV";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_INSUFFICIENT_SECURITY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "IS";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_INTERNAL_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "IE";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_USER_CANCELLED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "US";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_NO_RENEGOTIATION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "NR";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNSUPPORTED_EXTENSION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UE";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "CO";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNRECOGNIZED_NAME:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UN";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "BR";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "BH";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UP";
|
2015-01-22 11:40:55 +08:00
|
|
|
default:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "UK";
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2001-08-24 01:22:43 +08:00
|
|
|
const char *SSL_alert_desc_string_long(int value)
|
2015-01-22 11:40:55 +08:00
|
|
|
{
|
|
|
|
switch (value & 0xff) {
|
|
|
|
case SSL3_AD_CLOSE_NOTIFY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "close notify";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_UNEXPECTED_MESSAGE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unexpected_message";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_BAD_RECORD_MAC:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "bad record mac";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_DECOMPRESSION_FAILURE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "decompression failure";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_HANDSHAKE_FAILURE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "handshake failure";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_NO_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "no certificate";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_BAD_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "bad certificate";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_UNSUPPORTED_CERTIFICATE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unsupported certificate";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_REVOKED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "certificate revoked";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_EXPIRED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "certificate expired";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_CERTIFICATE_UNKNOWN:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "certificate unknown";
|
2015-01-22 11:40:55 +08:00
|
|
|
case SSL3_AD_ILLEGAL_PARAMETER:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "illegal parameter";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECRYPTION_FAILED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "decryption failed";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_RECORD_OVERFLOW:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "record overflow";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNKNOWN_CA:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unknown CA";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_ACCESS_DENIED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "access denied";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECODE_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "decode error";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_DECRYPT_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "decrypt error";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_EXPORT_RESTRICTION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "export restriction";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_PROTOCOL_VERSION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "protocol version";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_INSUFFICIENT_SECURITY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "insufficient security";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_INTERNAL_ERROR:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "internal error";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_USER_CANCELLED:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "user canceled";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_NO_RENEGOTIATION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "no renegotiation";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNSUPPORTED_EXTENSION:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unsupported extension";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_CERTIFICATE_UNOBTAINABLE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "certificate unobtainable";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNRECOGNIZED_NAME:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unrecognized name";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "bad certificate status response";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "bad certificate hash value";
|
2015-01-22 11:40:55 +08:00
|
|
|
case TLS1_AD_UNKNOWN_PSK_IDENTITY:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unknown PSK identity";
|
2016-08-06 01:03:17 +08:00
|
|
|
case TLS1_AD_NO_APPLICATION_PROTOCOL:
|
2016-07-05 02:16:14 +08:00
|
|
|
return "no application protocol";
|
2015-01-22 11:40:55 +08:00
|
|
|
default:
|
2016-03-22 22:52:13 +08:00
|
|
|
return "unknown";
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
|
|
|
}
|