Move verify_result from ssl_context to session

This commit is contained in:
Manuel Pégourié-Gonnard 2013-08-23 10:44:29 +02:00 committed by Paul Bakker
parent 43fdd617e1
commit 38d1eba3b5
4 changed files with 12 additions and 6 deletions

View File

@ -355,6 +355,7 @@ struct _ssl_session
#if defined(POLARSSL_X509_PARSE_C)
x509_cert *peer_cert; /*!< peer X.509 cert chain */
#endif /* POLARSSL_X509_PARSE_C */
int verify_result; /*!< verification result */
#if defined(POLARSSL_SSL_SESSION_TICKETS)
unsigned char *ticket; /*!< RFC 5077 session ticket */

View File

@ -83,6 +83,8 @@ int ssl_cache_get( void *data, ssl_session *session )
memcpy( session->master, entry->session.master, 48 );
session->verify_result = entry->session.verify_result;
#if defined(POLARSSL_X509_PARSE_C)
/*
* Restore peer certificate (without rest of the original chain)

View File

@ -2113,7 +2113,7 @@ int ssl_parse_certificate( ssl_context *ssl )
if( ssl->endpoint == SSL_IS_SERVER &&
ssl->authmode == SSL_VERIFY_NONE )
{
ssl->verify_result = BADCERT_SKIP_VERIFY;
ssl->session_negotiate->verify_result = BADCERT_SKIP_VERIFY;
SSL_DEBUG_MSG( 2, ( "<= skip parse certificate" ) );
ssl->state++;
return( 0 );
@ -2140,7 +2140,7 @@ int ssl_parse_certificate( ssl_context *ssl )
{
SSL_DEBUG_MSG( 1, ( "SSLv3 client has no certificate" ) );
ssl->verify_result = BADCERT_MISSING;
ssl->session_negotiate->verify_result = BADCERT_MISSING;
if( ssl->authmode == SSL_VERIFY_OPTIONAL )
return( 0 );
else
@ -2158,7 +2158,7 @@ int ssl_parse_certificate( ssl_context *ssl )
{
SSL_DEBUG_MSG( 1, ( "TLSv1 client has no certificate" ) );
ssl->verify_result = BADCERT_MISSING;
ssl->session_negotiate->verify_result = BADCERT_MISSING;
if( ssl->authmode == SSL_VERIFY_REQUIRED )
return( POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE );
else
@ -2241,8 +2241,8 @@ int ssl_parse_certificate( ssl_context *ssl )
}
ret = x509parse_verify( ssl->session_negotiate->peer_cert,
ssl->ca_chain, ssl->ca_crl,
ssl->peer_cn, &ssl->verify_result,
ssl->ca_chain, ssl->ca_crl, ssl->peer_cn,
&ssl->session_negotiate->verify_result,
ssl->f_vrfy, ssl->p_vrfy );
if( ret != 0 )
@ -3325,7 +3325,7 @@ size_t ssl_get_bytes_avail( const ssl_context *ssl )
int ssl_get_verify_result( const ssl_context *ssl )
{
return( ssl->verify_result );
return( ssl->session->verify_result );
}
const char *ssl_get_ciphersuite( const ssl_context *ssl )

View File

@ -859,6 +859,9 @@ send_request:
{
--opt.reconnect;
printf( " ! Press a key to reconnect\n" );
(void) getchar();
printf( " . Reconnecting with saved session..." );
fflush( stdout );