tls_cache.c File Reference

Session cache management. More...

#include "tls.h"
#include "tls_cache.h"
#include "tls_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TLS_TRACE_LEVEL
 

Functions

TlsCachetlsInitCache (uint_t size)
 Session cache initialization. More...
 
TlsSessionStatetlsFindCache (TlsCache *cache, const uint8_t *sessionId, size_t sessionIdLen)
 Search the session cache for a given session ID. More...
 
error_t tlsSaveToCache (TlsContext *context)
 Save current session in cache. More...
 
error_t tlsRemoveFromCache (TlsContext *context)
 Remove current session from cache. More...
 
void tlsFreeCache (TlsCache *cache)
 Properly dispose a session cache. More...
 

Detailed Description

Session cache management.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file tls_cache.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TLS_TRACE_LEVEL

Definition at line 32 of file tls_cache.c.

Function Documentation

◆ tlsFindCache()

TlsSessionState* tlsFindCache ( TlsCache cache,
const uint8_t *  sessionId,
size_t  sessionIdLen 
)

Search the session cache for a given session ID.

Parameters
[in]cachePointer to the session cache
[in]sessionIdExpected session ID
[in]sessionIdLenLength of the session ID
Returns
A pointer to the matching session is returned. NULL is returned if the specified ID could not be found in the session cache

Definition at line 97 of file tls_cache.c.

◆ tlsFreeCache()

void tlsFreeCache ( TlsCache cache)

Properly dispose a session cache.

Parameters
[in]cachePointer to the session cache to be released

Definition at line 319 of file tls_cache.c.

◆ tlsInitCache()

TlsCache* tlsInitCache ( uint_t  size)

Session cache initialization.

Parameters
[in]sizeMaximum number of cache entries
Returns
Handle referencing the fully initialized session cache

Definition at line 50 of file tls_cache.c.

◆ tlsRemoveFromCache()

error_t tlsRemoveFromCache ( TlsContext context)

Remove current session from cache.

Parameters
[in]contextTLS context
Returns
Error code

Definition at line 269 of file tls_cache.c.

◆ tlsSaveToCache()

error_t tlsSaveToCache ( TlsContext context)

Save current session in cache.

Parameters
[in]contextTLS context
Returns
Error code

Definition at line 164 of file tls_cache.c.