sl@0: /* ssl/ssl_stat.c */ sl@0: /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) sl@0: * All rights reserved. sl@0: * sl@0: * This package is an SSL implementation written sl@0: * by Eric Young (eay@cryptsoft.com). sl@0: * The implementation was written so as to conform with Netscapes SSL. sl@0: * sl@0: * This library is free for commercial and non-commercial use as long as sl@0: * the following conditions are aheared to. The following conditions sl@0: * apply to all code found in this distribution, be it the RC4, RSA, sl@0: * lhash, DES, etc., code; not just the SSL code. The SSL documentation sl@0: * included with this distribution is covered by the same copyright terms sl@0: * except that the holder is Tim Hudson (tjh@cryptsoft.com). sl@0: * sl@0: * Copyright remains Eric Young's, and as such any Copyright notices in sl@0: * the code are not to be removed. sl@0: * If this package is used in a product, Eric Young should be given attribution sl@0: * as the author of the parts of the library used. sl@0: * This can be in the form of a textual message at program startup or sl@0: * in documentation (online or textual) provided with the package. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 3. All advertising materials mentioning features or use of this software sl@0: * must display the following acknowledgement: sl@0: * "This product includes cryptographic software written by sl@0: * Eric Young (eay@cryptsoft.com)" sl@0: * The word 'cryptographic' can be left out if the rouines from the library sl@0: * being used are not cryptographic related :-). sl@0: * 4. If you include any Windows specific code (or a derivative thereof) from sl@0: * the apps directory (application code) you must include an acknowledgement: sl@0: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * The licence and distribution terms for any publically available version or sl@0: * derivative of this code cannot be changed. i.e. this code cannot simply be sl@0: * copied and put under another distribution licence sl@0: * [including the GNU Public Licence.] sl@0: */ sl@0: sl@0: #include sl@0: #include "ssl_locl.h" sl@0: sl@0: EXPORT_C const char *SSL_state_string_long(const SSL *s) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (s->state) sl@0: { sl@0: case SSL_ST_BEFORE: str="before SSL initialization"; break; sl@0: case SSL_ST_ACCEPT: str="before accept initialization"; break; sl@0: case SSL_ST_CONNECT: str="before connect initialization"; break; sl@0: case SSL_ST_OK: str="SSL negotiation finished successfully"; break; sl@0: case SSL_ST_RENEGOTIATE: str="SSL renegotiate ciphers"; break; sl@0: case SSL_ST_BEFORE|SSL_ST_CONNECT: str="before/connect initialization"; break; sl@0: case SSL_ST_OK|SSL_ST_CONNECT: str="ok/connect SSL initialization"; break; sl@0: case SSL_ST_BEFORE|SSL_ST_ACCEPT: str="before/accept initialization"; break; sl@0: case SSL_ST_OK|SSL_ST_ACCEPT: str="ok/accept SSL initialization"; break; sl@0: #ifndef OPENSSL_NO_SSL2 sl@0: case SSL2_ST_CLIENT_START_ENCRYPTION: str="SSLv2 client start encryption"; break; sl@0: case SSL2_ST_SERVER_START_ENCRYPTION: str="SSLv2 server start encryption"; break; sl@0: case SSL2_ST_SEND_CLIENT_HELLO_A: str="SSLv2 write client hello A"; break; sl@0: case SSL2_ST_SEND_CLIENT_HELLO_B: str="SSLv2 write client hello B"; break; sl@0: case SSL2_ST_GET_SERVER_HELLO_A: str="SSLv2 read server hello A"; break; sl@0: case SSL2_ST_GET_SERVER_HELLO_B: str="SSLv2 read server hello B"; break; sl@0: case SSL2_ST_SEND_CLIENT_MASTER_KEY_A: str="SSLv2 write client master key A"; break; sl@0: case SSL2_ST_SEND_CLIENT_MASTER_KEY_B: str="SSLv2 write client master key B"; break; sl@0: case SSL2_ST_SEND_CLIENT_FINISHED_A: str="SSLv2 write client finished A"; break; sl@0: case SSL2_ST_SEND_CLIENT_FINISHED_B: str="SSLv2 write client finished B"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_A: str="SSLv2 write client certificate A"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_B: str="SSLv2 write client certificate B"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_C: str="SSLv2 write client certificate C"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_D: str="SSLv2 write client certificate D"; break; sl@0: case SSL2_ST_GET_SERVER_VERIFY_A: str="SSLv2 read server verify A"; break; sl@0: case SSL2_ST_GET_SERVER_VERIFY_B: str="SSLv2 read server verify B"; break; sl@0: case SSL2_ST_GET_SERVER_FINISHED_A: str="SSLv2 read server finished A"; break; sl@0: case SSL2_ST_GET_SERVER_FINISHED_B: str="SSLv2 read server finished B"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_A: str="SSLv2 read client hello A"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_B: str="SSLv2 read client hello B"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_C: str="SSLv2 read client hello C"; break; sl@0: case SSL2_ST_SEND_SERVER_HELLO_A: str="SSLv2 write server hello A"; break; sl@0: case SSL2_ST_SEND_SERVER_HELLO_B: str="SSLv2 write server hello B"; break; sl@0: case SSL2_ST_GET_CLIENT_MASTER_KEY_A: str="SSLv2 read client master key A"; break; sl@0: case SSL2_ST_GET_CLIENT_MASTER_KEY_B: str="SSLv2 read client master key B"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_A: str="SSLv2 write server verify A"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_B: str="SSLv2 write server verify B"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_C: str="SSLv2 write server verify C"; break; sl@0: case SSL2_ST_GET_CLIENT_FINISHED_A: str="SSLv2 read client finished A"; break; sl@0: case SSL2_ST_GET_CLIENT_FINISHED_B: str="SSLv2 read client finished B"; break; sl@0: case SSL2_ST_SEND_SERVER_FINISHED_A: str="SSLv2 write server finished A"; break; sl@0: case SSL2_ST_SEND_SERVER_FINISHED_B: str="SSLv2 write server finished B"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_A: str="SSLv2 write request certificate A"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_B: str="SSLv2 write request certificate B"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_C: str="SSLv2 write request certificate C"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_D: str="SSLv2 write request certificate D"; break; sl@0: case SSL2_ST_X509_GET_SERVER_CERTIFICATE: str="SSLv2 X509 read server certificate"; break; sl@0: case SSL2_ST_X509_GET_CLIENT_CERTIFICATE: str="SSLv2 X509 read client certificate"; break; sl@0: #endif sl@0: sl@0: #ifndef OPENSSL_NO_SSL3 sl@0: /* SSLv3 additions */ sl@0: case SSL3_ST_CW_CLNT_HELLO_A: str="SSLv3 write client hello A"; break; sl@0: case SSL3_ST_CW_CLNT_HELLO_B: str="SSLv3 write client hello B"; break; sl@0: case SSL3_ST_CR_SRVR_HELLO_A: str="SSLv3 read server hello A"; break; sl@0: case SSL3_ST_CR_SRVR_HELLO_B: str="SSLv3 read server hello B"; break; sl@0: case SSL3_ST_CR_CERT_A: str="SSLv3 read server certificate A"; break; sl@0: case SSL3_ST_CR_CERT_B: str="SSLv3 read server certificate B"; break; sl@0: case SSL3_ST_CR_KEY_EXCH_A: str="SSLv3 read server key exchange A"; break; sl@0: case SSL3_ST_CR_KEY_EXCH_B: str="SSLv3 read server key exchange B"; break; sl@0: case SSL3_ST_CR_CERT_REQ_A: str="SSLv3 read server certificate request A"; break; sl@0: case SSL3_ST_CR_CERT_REQ_B: str="SSLv3 read server certificate request B"; break; sl@0: case SSL3_ST_CR_SRVR_DONE_A: str="SSLv3 read server done A"; break; sl@0: case SSL3_ST_CR_SRVR_DONE_B: str="SSLv3 read server done B"; break; sl@0: case SSL3_ST_CW_CERT_A: str="SSLv3 write client certificate A"; break; sl@0: case SSL3_ST_CW_CERT_B: str="SSLv3 write client certificate B"; break; sl@0: case SSL3_ST_CW_CERT_C: str="SSLv3 write client certificate C"; break; sl@0: case SSL3_ST_CW_CERT_D: str="SSLv3 write client certificate D"; break; sl@0: case SSL3_ST_CW_KEY_EXCH_A: str="SSLv3 write client key exchange A"; break; sl@0: case SSL3_ST_CW_KEY_EXCH_B: str="SSLv3 write client key exchange B"; break; sl@0: case SSL3_ST_CW_CERT_VRFY_A: str="SSLv3 write certificate verify A"; break; sl@0: case SSL3_ST_CW_CERT_VRFY_B: str="SSLv3 write certificate verify B"; break; sl@0: sl@0: case SSL3_ST_CW_CHANGE_A: sl@0: case SSL3_ST_SW_CHANGE_A: str="SSLv3 write change cipher spec A"; break; sl@0: case SSL3_ST_CW_CHANGE_B: sl@0: case SSL3_ST_SW_CHANGE_B: str="SSLv3 write change cipher spec B"; break; sl@0: case SSL3_ST_CW_FINISHED_A: sl@0: case SSL3_ST_SW_FINISHED_A: str="SSLv3 write finished A"; break; sl@0: case SSL3_ST_CW_FINISHED_B: sl@0: case SSL3_ST_SW_FINISHED_B: str="SSLv3 write finished B"; break; sl@0: case SSL3_ST_CR_CHANGE_A: sl@0: case SSL3_ST_SR_CHANGE_A: str="SSLv3 read change cipher spec A"; break; sl@0: case SSL3_ST_CR_CHANGE_B: sl@0: case SSL3_ST_SR_CHANGE_B: str="SSLv3 read change cipher spec B"; break; sl@0: case SSL3_ST_CR_FINISHED_A: sl@0: case SSL3_ST_SR_FINISHED_A: str="SSLv3 read finished A"; break; sl@0: case SSL3_ST_CR_FINISHED_B: sl@0: case SSL3_ST_SR_FINISHED_B: str="SSLv3 read finished B"; break; sl@0: sl@0: case SSL3_ST_CW_FLUSH: sl@0: case SSL3_ST_SW_FLUSH: str="SSLv3 flush data"; break; sl@0: sl@0: case SSL3_ST_SR_CLNT_HELLO_A: str="SSLv3 read client hello A"; break; sl@0: case SSL3_ST_SR_CLNT_HELLO_B: str="SSLv3 read client hello B"; break; sl@0: case SSL3_ST_SR_CLNT_HELLO_C: str="SSLv3 read client hello C"; break; sl@0: case SSL3_ST_SW_HELLO_REQ_A: str="SSLv3 write hello request A"; break; sl@0: case SSL3_ST_SW_HELLO_REQ_B: str="SSLv3 write hello request B"; break; sl@0: case SSL3_ST_SW_HELLO_REQ_C: str="SSLv3 write hello request C"; break; sl@0: case SSL3_ST_SW_SRVR_HELLO_A: str="SSLv3 write server hello A"; break; sl@0: case SSL3_ST_SW_SRVR_HELLO_B: str="SSLv3 write server hello B"; break; sl@0: case SSL3_ST_SW_CERT_A: str="SSLv3 write certificate A"; break; sl@0: case SSL3_ST_SW_CERT_B: str="SSLv3 write certificate B"; break; sl@0: case SSL3_ST_SW_KEY_EXCH_A: str="SSLv3 write key exchange A"; break; sl@0: case SSL3_ST_SW_KEY_EXCH_B: str="SSLv3 write key exchange B"; break; sl@0: case SSL3_ST_SW_CERT_REQ_A: str="SSLv3 write certificate request A"; break; sl@0: case SSL3_ST_SW_CERT_REQ_B: str="SSLv3 write certificate request B"; break; sl@0: case SSL3_ST_SW_SRVR_DONE_A: str="SSLv3 write server done A"; break; sl@0: case SSL3_ST_SW_SRVR_DONE_B: str="SSLv3 write server done B"; break; sl@0: case SSL3_ST_SR_CERT_A: str="SSLv3 read client certificate A"; break; sl@0: case SSL3_ST_SR_CERT_B: str="SSLv3 read client certificate B"; break; sl@0: case SSL3_ST_SR_KEY_EXCH_A: str="SSLv3 read client key exchange A"; break; sl@0: case SSL3_ST_SR_KEY_EXCH_B: str="SSLv3 read client key exchange B"; break; sl@0: case SSL3_ST_SR_CERT_VRFY_A: str="SSLv3 read certificate verify A"; break; sl@0: case SSL3_ST_SR_CERT_VRFY_B: str="SSLv3 read certificate verify B"; break; sl@0: #endif sl@0: sl@0: #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) sl@0: /* SSLv2/v3 compatibility states */ sl@0: /* client */ sl@0: case SSL23_ST_CW_CLNT_HELLO_A: str="SSLv2/v3 write client hello A"; break; sl@0: case SSL23_ST_CW_CLNT_HELLO_B: str="SSLv2/v3 write client hello B"; break; sl@0: case SSL23_ST_CR_SRVR_HELLO_A: str="SSLv2/v3 read server hello A"; break; sl@0: case SSL23_ST_CR_SRVR_HELLO_B: str="SSLv2/v3 read server hello B"; break; sl@0: /* server */ sl@0: case SSL23_ST_SR_CLNT_HELLO_A: str="SSLv2/v3 read client hello A"; break; sl@0: case SSL23_ST_SR_CLNT_HELLO_B: str="SSLv2/v3 read client hello B"; break; sl@0: #endif sl@0: sl@0: default: str="unknown state"; break; sl@0: } sl@0: return(str); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_rstate_string_long(const SSL *s) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (s->rstate) sl@0: { sl@0: case SSL_ST_READ_HEADER: str="read header"; break; sl@0: case SSL_ST_READ_BODY: str="read body"; break; sl@0: case SSL_ST_READ_DONE: str="read done"; break; sl@0: default: str="unknown"; break; sl@0: } sl@0: return(str); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_state_string(const SSL *s) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (s->state) sl@0: { sl@0: case SSL_ST_BEFORE: str="PINIT "; break; sl@0: case SSL_ST_ACCEPT: str="AINIT "; break; sl@0: case SSL_ST_CONNECT: str="CINIT "; break; sl@0: case SSL_ST_OK: str="SSLOK "; break; sl@0: #ifndef OPENSSL_NO_SSL2 sl@0: case SSL2_ST_CLIENT_START_ENCRYPTION: str="2CSENC"; break; sl@0: case SSL2_ST_SERVER_START_ENCRYPTION: str="2SSENC"; break; sl@0: case SSL2_ST_SEND_CLIENT_HELLO_A: str="2SCH_A"; break; sl@0: case SSL2_ST_SEND_CLIENT_HELLO_B: str="2SCH_B"; break; sl@0: case SSL2_ST_GET_SERVER_HELLO_A: str="2GSH_A"; break; sl@0: case SSL2_ST_GET_SERVER_HELLO_B: str="2GSH_B"; break; sl@0: case SSL2_ST_SEND_CLIENT_MASTER_KEY_A: str="2SCMKA"; break; sl@0: case SSL2_ST_SEND_CLIENT_MASTER_KEY_B: str="2SCMKB"; break; sl@0: case SSL2_ST_SEND_CLIENT_FINISHED_A: str="2SCF_A"; break; sl@0: case SSL2_ST_SEND_CLIENT_FINISHED_B: str="2SCF_B"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_A: str="2SCC_A"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_B: str="2SCC_B"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_C: str="2SCC_C"; break; sl@0: case SSL2_ST_SEND_CLIENT_CERTIFICATE_D: str="2SCC_D"; break; sl@0: case SSL2_ST_GET_SERVER_VERIFY_A: str="2GSV_A"; break; sl@0: case SSL2_ST_GET_SERVER_VERIFY_B: str="2GSV_B"; break; sl@0: case SSL2_ST_GET_SERVER_FINISHED_A: str="2GSF_A"; break; sl@0: case SSL2_ST_GET_SERVER_FINISHED_B: str="2GSF_B"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_A: str="2GCH_A"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_B: str="2GCH_B"; break; sl@0: case SSL2_ST_GET_CLIENT_HELLO_C: str="2GCH_C"; break; sl@0: case SSL2_ST_SEND_SERVER_HELLO_A: str="2SSH_A"; break; sl@0: case SSL2_ST_SEND_SERVER_HELLO_B: str="2SSH_B"; break; sl@0: case SSL2_ST_GET_CLIENT_MASTER_KEY_A: str="2GCMKA"; break; sl@0: case SSL2_ST_GET_CLIENT_MASTER_KEY_B: str="2GCMKA"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_A: str="2SSV_A"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_B: str="2SSV_B"; break; sl@0: case SSL2_ST_SEND_SERVER_VERIFY_C: str="2SSV_C"; break; sl@0: case SSL2_ST_GET_CLIENT_FINISHED_A: str="2GCF_A"; break; sl@0: case SSL2_ST_GET_CLIENT_FINISHED_B: str="2GCF_B"; break; sl@0: case SSL2_ST_SEND_SERVER_FINISHED_A: str="2SSF_A"; break; sl@0: case SSL2_ST_SEND_SERVER_FINISHED_B: str="2SSF_B"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_A: str="2SRC_A"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_B: str="2SRC_B"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_C: str="2SRC_C"; break; sl@0: case SSL2_ST_SEND_REQUEST_CERTIFICATE_D: str="2SRC_D"; break; sl@0: case SSL2_ST_X509_GET_SERVER_CERTIFICATE: str="2X9GSC"; break; sl@0: case SSL2_ST_X509_GET_CLIENT_CERTIFICATE: str="2X9GCC"; break; sl@0: #endif sl@0: sl@0: #ifndef OPENSSL_NO_SSL3 sl@0: /* SSLv3 additions */ sl@0: case SSL3_ST_SW_FLUSH: sl@0: case SSL3_ST_CW_FLUSH: str="3FLUSH"; break; sl@0: case SSL3_ST_CW_CLNT_HELLO_A: str="3WCH_A"; break; sl@0: case SSL3_ST_CW_CLNT_HELLO_B: str="3WCH_B"; break; sl@0: case SSL3_ST_CR_SRVR_HELLO_A: str="3RSH_A"; break; sl@0: case SSL3_ST_CR_SRVR_HELLO_B: str="3RSH_B"; break; sl@0: case SSL3_ST_CR_CERT_A: str="3RSC_A"; break; sl@0: case SSL3_ST_CR_CERT_B: str="3RSC_B"; break; sl@0: case SSL3_ST_CR_KEY_EXCH_A: str="3RSKEA"; break; sl@0: case SSL3_ST_CR_KEY_EXCH_B: str="3RSKEB"; break; sl@0: case SSL3_ST_CR_CERT_REQ_A: str="3RCR_A"; break; sl@0: case SSL3_ST_CR_CERT_REQ_B: str="3RCR_B"; break; sl@0: case SSL3_ST_CR_SRVR_DONE_A: str="3RSD_A"; break; sl@0: case SSL3_ST_CR_SRVR_DONE_B: str="3RSD_B"; break; sl@0: case SSL3_ST_CW_CERT_A: str="3WCC_A"; break; sl@0: case SSL3_ST_CW_CERT_B: str="3WCC_B"; break; sl@0: case SSL3_ST_CW_CERT_C: str="3WCC_C"; break; sl@0: case SSL3_ST_CW_CERT_D: str="3WCC_D"; break; sl@0: case SSL3_ST_CW_KEY_EXCH_A: str="3WCKEA"; break; sl@0: case SSL3_ST_CW_KEY_EXCH_B: str="3WCKEB"; break; sl@0: case SSL3_ST_CW_CERT_VRFY_A: str="3WCV_A"; break; sl@0: case SSL3_ST_CW_CERT_VRFY_B: str="3WCV_B"; break; sl@0: sl@0: case SSL3_ST_SW_CHANGE_A: sl@0: case SSL3_ST_CW_CHANGE_A: str="3WCCSA"; break; sl@0: case SSL3_ST_SW_CHANGE_B: sl@0: case SSL3_ST_CW_CHANGE_B: str="3WCCSB"; break; sl@0: case SSL3_ST_SW_FINISHED_A: sl@0: case SSL3_ST_CW_FINISHED_A: str="3WFINA"; break; sl@0: case SSL3_ST_SW_FINISHED_B: sl@0: case SSL3_ST_CW_FINISHED_B: str="3WFINB"; break; sl@0: case SSL3_ST_SR_CHANGE_A: sl@0: case SSL3_ST_CR_CHANGE_A: str="3RCCSA"; break; sl@0: case SSL3_ST_SR_CHANGE_B: sl@0: case SSL3_ST_CR_CHANGE_B: str="3RCCSB"; break; sl@0: case SSL3_ST_SR_FINISHED_A: sl@0: case SSL3_ST_CR_FINISHED_A: str="3RFINA"; break; sl@0: case SSL3_ST_SR_FINISHED_B: sl@0: case SSL3_ST_CR_FINISHED_B: str="3RFINB"; break; sl@0: sl@0: case SSL3_ST_SW_HELLO_REQ_A: str="3WHR_A"; break; sl@0: case SSL3_ST_SW_HELLO_REQ_B: str="3WHR_B"; break; sl@0: case SSL3_ST_SW_HELLO_REQ_C: str="3WHR_C"; break; sl@0: case SSL3_ST_SR_CLNT_HELLO_A: str="3RCH_A"; break; sl@0: case SSL3_ST_SR_CLNT_HELLO_B: str="3RCH_B"; break; sl@0: case SSL3_ST_SR_CLNT_HELLO_C: str="3RCH_C"; break; sl@0: case SSL3_ST_SW_SRVR_HELLO_A: str="3WSH_A"; break; sl@0: case SSL3_ST_SW_SRVR_HELLO_B: str="3WSH_B"; break; sl@0: case SSL3_ST_SW_CERT_A: str="3WSC_A"; break; sl@0: case SSL3_ST_SW_CERT_B: str="3WSC_B"; break; sl@0: case SSL3_ST_SW_KEY_EXCH_A: str="3WSKEA"; break; sl@0: case SSL3_ST_SW_KEY_EXCH_B: str="3WSKEB"; break; sl@0: case SSL3_ST_SW_CERT_REQ_A: str="3WCR_A"; break; sl@0: case SSL3_ST_SW_CERT_REQ_B: str="3WCR_B"; break; sl@0: case SSL3_ST_SW_SRVR_DONE_A: str="3WSD_A"; break; sl@0: case SSL3_ST_SW_SRVR_DONE_B: str="3WSD_B"; break; sl@0: case SSL3_ST_SR_CERT_A: str="3RCC_A"; break; sl@0: case SSL3_ST_SR_CERT_B: str="3RCC_B"; break; sl@0: case SSL3_ST_SR_KEY_EXCH_A: str="3RCKEA"; break; sl@0: case SSL3_ST_SR_KEY_EXCH_B: str="3RCKEB"; break; sl@0: case SSL3_ST_SR_CERT_VRFY_A: str="3RCV_A"; break; sl@0: case SSL3_ST_SR_CERT_VRFY_B: str="3RCV_B"; break; sl@0: #endif sl@0: sl@0: #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) sl@0: /* SSLv2/v3 compatibility states */ sl@0: /* client */ sl@0: case SSL23_ST_CW_CLNT_HELLO_A: str="23WCHA"; break; sl@0: case SSL23_ST_CW_CLNT_HELLO_B: str="23WCHB"; break; sl@0: case SSL23_ST_CR_SRVR_HELLO_A: str="23RSHA"; break; sl@0: case SSL23_ST_CR_SRVR_HELLO_B: str="23RSHA"; break; sl@0: /* server */ sl@0: case SSL23_ST_SR_CLNT_HELLO_A: str="23RCHA"; break; sl@0: case SSL23_ST_SR_CLNT_HELLO_B: str="23RCHB"; break; sl@0: #endif sl@0: sl@0: default: str="UNKWN "; break; sl@0: } sl@0: return(str); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_alert_type_string_long(int value) sl@0: { sl@0: value>>=8; sl@0: if (value == SSL3_AL_WARNING) sl@0: return("warning"); sl@0: else if (value == SSL3_AL_FATAL) sl@0: return("fatal"); sl@0: else sl@0: return("unknown"); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_alert_type_string(int value) sl@0: { sl@0: value>>=8; sl@0: if (value == SSL3_AL_WARNING) sl@0: return("W"); sl@0: else if (value == SSL3_AL_FATAL) sl@0: return("F"); sl@0: else sl@0: return("U"); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_alert_desc_string(int value) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (value & 0xff) sl@0: { sl@0: case SSL3_AD_CLOSE_NOTIFY: str="CN"; break; sl@0: case SSL3_AD_UNEXPECTED_MESSAGE: str="UM"; break; sl@0: case SSL3_AD_BAD_RECORD_MAC: str="BM"; break; sl@0: case SSL3_AD_DECOMPRESSION_FAILURE: str="DF"; break; sl@0: case SSL3_AD_HANDSHAKE_FAILURE: str="HF"; break; sl@0: case SSL3_AD_NO_CERTIFICATE: str="NC"; break; sl@0: case SSL3_AD_BAD_CERTIFICATE: str="BC"; break; sl@0: case SSL3_AD_UNSUPPORTED_CERTIFICATE: str="UC"; break; sl@0: case SSL3_AD_CERTIFICATE_REVOKED: str="CR"; break; sl@0: case SSL3_AD_CERTIFICATE_EXPIRED: str="CE"; break; sl@0: case SSL3_AD_CERTIFICATE_UNKNOWN: str="CU"; break; sl@0: case SSL3_AD_ILLEGAL_PARAMETER: str="IP"; break; sl@0: case TLS1_AD_DECRYPTION_FAILED: str="DC"; break; sl@0: case TLS1_AD_RECORD_OVERFLOW: str="RO"; break; sl@0: case TLS1_AD_UNKNOWN_CA: str="CA"; break; sl@0: case TLS1_AD_ACCESS_DENIED: str="AD"; break; sl@0: case TLS1_AD_DECODE_ERROR: str="DE"; break; sl@0: case TLS1_AD_DECRYPT_ERROR: str="CY"; break; sl@0: case TLS1_AD_EXPORT_RESTRICTION: str="ER"; break; sl@0: case TLS1_AD_PROTOCOL_VERSION: str="PV"; break; sl@0: case TLS1_AD_INSUFFICIENT_SECURITY: str="IS"; break; sl@0: case TLS1_AD_INTERNAL_ERROR: str="IE"; break; sl@0: case TLS1_AD_USER_CANCELLED: str="US"; break; sl@0: case TLS1_AD_NO_RENEGOTIATION: str="NR"; break; sl@0: default: str="UK"; break; sl@0: } sl@0: return(str); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_alert_desc_string_long(int value) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (value & 0xff) sl@0: { sl@0: case SSL3_AD_CLOSE_NOTIFY: sl@0: str="close notify"; sl@0: break; sl@0: case SSL3_AD_UNEXPECTED_MESSAGE: sl@0: str="unexpected_message"; sl@0: break; sl@0: case SSL3_AD_BAD_RECORD_MAC: sl@0: str="bad record mac"; sl@0: break; sl@0: case SSL3_AD_DECOMPRESSION_FAILURE: sl@0: str="decompression failure"; sl@0: break; sl@0: case SSL3_AD_HANDSHAKE_FAILURE: sl@0: str="handshake failure"; sl@0: break; sl@0: case SSL3_AD_NO_CERTIFICATE: sl@0: str="no certificate"; sl@0: break; sl@0: case SSL3_AD_BAD_CERTIFICATE: sl@0: str="bad certificate"; sl@0: break; sl@0: case SSL3_AD_UNSUPPORTED_CERTIFICATE: sl@0: str="unsupported certificate"; sl@0: break; sl@0: case SSL3_AD_CERTIFICATE_REVOKED: sl@0: str="certificate revoked"; sl@0: break; sl@0: case SSL3_AD_CERTIFICATE_EXPIRED: sl@0: str="certificate expired"; sl@0: break; sl@0: case SSL3_AD_CERTIFICATE_UNKNOWN: sl@0: str="certificate unknown"; sl@0: break; sl@0: case SSL3_AD_ILLEGAL_PARAMETER: sl@0: str="illegal parameter"; sl@0: break; sl@0: case TLS1_AD_DECRYPTION_FAILED: sl@0: str="decryption failed"; sl@0: break; sl@0: case TLS1_AD_RECORD_OVERFLOW: sl@0: str="record overflow"; sl@0: break; sl@0: case TLS1_AD_UNKNOWN_CA: sl@0: str="unknown CA"; sl@0: break; sl@0: case TLS1_AD_ACCESS_DENIED: sl@0: str="access denied"; sl@0: break; sl@0: case TLS1_AD_DECODE_ERROR: sl@0: str="decode error"; sl@0: break; sl@0: case TLS1_AD_DECRYPT_ERROR: sl@0: str="decrypt error"; sl@0: break; sl@0: case TLS1_AD_EXPORT_RESTRICTION: sl@0: str="export restriction"; sl@0: break; sl@0: case TLS1_AD_PROTOCOL_VERSION: sl@0: str="protocol version"; sl@0: break; sl@0: case TLS1_AD_INSUFFICIENT_SECURITY: sl@0: str="insufficient security"; sl@0: break; sl@0: case TLS1_AD_INTERNAL_ERROR: sl@0: str="internal error"; sl@0: break; sl@0: case TLS1_AD_USER_CANCELLED: sl@0: str="user canceled"; sl@0: break; sl@0: case TLS1_AD_NO_RENEGOTIATION: sl@0: str="no renegotiation"; sl@0: break; sl@0: default: str="unknown"; break; sl@0: } sl@0: return(str); sl@0: } sl@0: sl@0: EXPORT_C const char *SSL_rstate_string(const SSL *s) sl@0: { sl@0: const char *str; sl@0: sl@0: switch (s->rstate) sl@0: { sl@0: case SSL_ST_READ_HEADER:str="RH"; break; sl@0: case SSL_ST_READ_BODY: str="RB"; break; sl@0: case SSL_ST_READ_DONE: str="RD"; break; sl@0: default: str="unknown"; break; sl@0: } sl@0: return(str); sl@0: }