mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
- Cache now only allows a maximum of entries in cache for preventing memory overrun
This commit is contained in:
@@ -29,7 +29,8 @@
|
||||
|
||||
#include "ssl.h"
|
||||
|
||||
#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /*!< 1 day */
|
||||
#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /*!< 1 day */
|
||||
#define SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /*!< Maximum entries in cache */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -53,8 +54,9 @@ struct _ssl_cache_entry
|
||||
*/
|
||||
struct _ssl_cache_context
|
||||
{
|
||||
ssl_cache_entry *chain; /*!< start of the chain */
|
||||
int timeout; /*!< cache timeout */
|
||||
ssl_cache_entry *chain; /*!< start of the chain */
|
||||
int timeout; /*!< cache entry timeout */
|
||||
int max_entries; /*!< maximum entries */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -91,6 +93,15 @@ int ssl_cache_set( void *data, const ssl_session *session );
|
||||
*/
|
||||
void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout );
|
||||
|
||||
/**
|
||||
* \brief Set the cache timeout
|
||||
* (Default: SSL_CACHE_DEFAULT_MAX_ENTRIES (50))
|
||||
*
|
||||
* \param cache SSL cache context
|
||||
* \param max cache entry maximum
|
||||
*/
|
||||
void ssl_cache_set_max_entries( ssl_cache_context *cache, int max );
|
||||
|
||||
/**
|
||||
* \brief Free referenced items in a cache context and clear memory
|
||||
*
|
||||
|
Reference in New Issue
Block a user