mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 10:45:36 +01:00
Fix bug with ssl_cache and max_entries=0
This commit is contained in:
parent
780d671f9d
commit
274a12e17c
@ -33,6 +33,8 @@ Bugfix
|
||||
* Programs rsa_sign_pss and rsa_verify_pss were not using PSS since 1.3.0
|
||||
* Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by
|
||||
Alex Wilson.)
|
||||
* Fixed bug in ssl_cache: when max_entries = 0 and TIMING_C is enabled,
|
||||
entries would still be created.
|
||||
|
||||
= PolarSSL 1.3.4 released on 2014-01-27
|
||||
Features
|
||||
|
@ -106,7 +106,7 @@ int ssl_cache_set( void *data, const ssl_session *session );
|
||||
* A timeout of 0 indicates no timeout.
|
||||
*
|
||||
* \param cache SSL cache context
|
||||
* \param timeout cache entry timeout
|
||||
* \param timeout cache entry timeout in seconds
|
||||
*/
|
||||
void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout );
|
||||
#endif /* POLARSSL_HAVE_TIME */
|
||||
|
@ -186,8 +186,14 @@ int ssl_cache_set( void *data, const ssl_session *session )
|
||||
/*
|
||||
* Reuse oldest entry if max_entries reached
|
||||
*/
|
||||
if( old != NULL && count >= cache->max_entries )
|
||||
if( count >= cache->max_entries )
|
||||
{
|
||||
if( old == NULL )
|
||||
{
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cur = old;
|
||||
memset( &cur->session, 0, sizeof(ssl_session) );
|
||||
#if defined(POLARSSL_X509_CRT_PARSE_C)
|
||||
@ -228,6 +234,9 @@ int ssl_cache_set( void *data, const ssl_session *session )
|
||||
#endif /* POLARSSL_HAVE_TIME */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* max_entries not reached, create new entry
|
||||
*/
|
||||
cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) );
|
||||
if( cur == NULL )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user