Go to the documentation of this file.
32 #define TRACE_LEVEL TLS_TRACE_LEVEL
41 #if (TLS_SUPPORT == ENABLED)
100 #if (TLS_MAX_VERSION >= TLS_VERSION_1_0 && TLS_MIN_VERSION <= TLS_VERSION_1_2)
119 for(i = 0; i < cache->
size; i++)
134 for(i = 0; i < cache->
size; i++)
166 #if (TLS_MAX_VERSION >= TLS_VERSION_1_0 && TLS_MIN_VERSION <= TLS_VERSION_1_2)
179 if(context->cache == NULL)
183 if(context->sessionIdLen == 0)
193 firstFreeEntry = NULL;
198 for(i = 0; i < context->cache->size; i++)
201 session = &context->cache->sessions[i];
208 firstFreeEntry = NULL;
220 firstFreeEntry = session;
226 if(oldestEntry == NULL)
228 oldestEntry = session;
232 oldestEntry = session;
238 if(firstFreeEntry != NULL)
242 else if(oldestEntry != NULL)
271 #if (TLS_MAX_VERSION >= TLS_VERSION_1_0 && TLS_MIN_VERSION <= TLS_VERSION_1_2)
280 if(context->cache == NULL)
284 if(context->sessionIdLen == 0)
291 for(i = 0; i < context->cache->size; i++)
294 session = &context->cache->sessions[i];
327 for(i = 0; i < cache->
size; i++)
#define tlsAllocMem(size)
error_t tlsSaveToCache(TlsContext *context)
Save current session in cache.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
systime_t timestamp
Time stamp to manage entry lifetime.
void tlsFreeCache(TlsCache *cache)
Properly dispose a session cache.
error_t tlsSaveSessionId(const TlsContext *context, TlsSessionState *session)
Save session ID.
Session cache management.
size_t sessionIdLen
Length of the session identifier.
#define osMemcmp(p1, p2, length)
OsMutex mutex
Mutex preventing simultaneous access to the cache.
void tlsFreeSessionState(TlsSessionState *session)
Properly dispose a session state.
TlsSessionState * tlsFindCache(TlsCache *cache, const uint8_t *sessionId, size_t sessionIdLen)
Search the session cache for a given session ID.
@ ERROR_INVALID_PARAMETER
Invalid parameter.
@ ERROR_FAILURE
Generic error code.
error_t tlsRemoveFromCache(TlsContext *context)
Remove current session from cache.
uint_t size
Maximum number of entries.
uint32_t systime_t
System time.
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
uint8_t sessionId[32]
Session identifier.
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
TlsCache * tlsInitCache(uint_t size)
Session cache initialization.
#define TLS_SESSION_CACHE_LIFETIME
TlsSessionState sessions[]
Cache entries.
TLS (Transport Layer Security)
#define osMemset(p, value, length)
systime_t osGetSystemTime(void)
Retrieve system time.