From 917dd8bd817a5ece85e554f2091e9beb6dcbfd04 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 29 Sep 2023 13:39:49 +0200 Subject: [PATCH] Add new error code for SSL cache entry not found There was no good error to return in this case. Signed-off-by: Gilles Peskine --- include/mbedtls/ssl.h | 2 ++ library/error.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index cc9a27082b52..3ec558b4f21c 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -193,6 +193,8 @@ #define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000 /** Invalid value in SSL config */ #define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80 +/** Cache entry not found */ +#define MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND -0x5E00 /* * Various constants diff --git a/library/error.c b/library/error.c index f4826c8b156a..6aa4b921984c 100644 --- a/library/error.c +++ b/library/error.c @@ -518,6 +518,8 @@ const char *mbedtls_high_level_strerr(int error_code) return( "SSL - A cryptographic operation is in progress. Try again later" ); case -(MBEDTLS_ERR_SSL_BAD_CONFIG): return( "SSL - Invalid value in SSL config" ); + case -(MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND): + return( "SSL - Cache entry not found" ); #endif /* MBEDTLS_SSL_TLS_C */ #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)