1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add ssl_get_session() to save session on client

This commit is contained in:
Manuel Pégourié-Gonnard
2013-07-30 12:41:56 +02:00
committed by Paul Bakker
parent a8342398c8
commit 747180391d
2 changed files with 45 additions and 5 deletions

View File

@ -3222,6 +3222,31 @@ const x509_cert *ssl_get_peer_cert( const ssl_context *ssl )
}
#endif /* POLARSSL_X509_PARSE_C */
int ssl_get_session( const ssl_context *ssl, ssl_session *dst )
{
ssl_session *src;
if( ssl == NULL ||
dst == NULL ||
ssl->session == NULL ||
ssl->endpoint != SSL_IS_CLIENT )
{
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
}
src = ssl->session;
ssl_session_free( dst );
memcpy( dst, src, sizeof( ssl_session ) );
/*
* For now, just set peer_cert to NULL, deep-copy not implemented yet
*/
dst->peer_cert = NULL;
return( 0 );
}
/*
* Perform a single step of the SSL handshake
*/