Merge pull request #7298 from lpy4105/issue/6840/add-cache-entry-removal-api

ssl_cache: misc improvements
This commit is contained in:
Gilles Peskine 2023-04-11 09:30:40 +02:00 committed by GitHub
commit c9e8a65d06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 14 deletions

View file

@ -106,7 +106,8 @@
/* Error space gap */
/* Error space gap */
/* Error space gap */
/* Error space gap */
/** Cache entry not found */
#define MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND -0x7E80
/** Memory allocation failed */
#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00
/** Hardware acceleration function returned with error */

View file

@ -102,6 +102,11 @@ void mbedtls_ssl_cache_init(mbedtls_ssl_cache_context *cache);
* \param session_id_len The length of \p session_id in bytes.
* \param session The address at which to store the session
* associated with \p session_id, if present.
*
* \return \c 0 on success.
* \return #MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND if there is
* no cache entry with specified session ID found, or
* any other negative error code for other failures.
*/
int mbedtls_ssl_cache_get(void *data,
unsigned char const *session_id,
@ -117,6 +122,9 @@ int mbedtls_ssl_cache_get(void *data,
* associated to \p session.
* \param session_id_len The length of \p session_id in bytes.
* \param session The session to store.
*
* \return \c 0 on success.
* \return A negative error code on failure.
*/
int mbedtls_ssl_cache_set(void *data,
unsigned char const *session_id,
@ -132,9 +140,10 @@ int mbedtls_ssl_cache_set(void *data,
* associated to \p session.
* \param session_id_len The length of \p session_id in bytes.
*
* \return 0: The cache entry for session with provided ID
* is removed or does not exist.
* Otherwise: fail.
* \return \c 0 on success. This indicates the cache entry for
* the session with provided ID is removed or does not
* exist.
* \return A negative error code on failure.
*/
int mbedtls_ssl_cache_remove(void *data,
unsigned char const *session_id,