From 40d4708f17d8d9a9f8dc580969160d94107894df Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Mon, 4 Mar 2024 15:24:51 +0000 Subject: [PATCH] ssl: Added session getter for ciphersuite_id. Signed-off-by: Minos Galanakis --- include/mbedtls/ssl.h | 12 ++++++++++++ include/mbedtls/ssl_ciphersuites.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 4c085b0c76..cdc0996db9 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -2742,6 +2742,18 @@ static inline size_t mbedtls_ssl_session_get_id_len(const mbedtls_ssl_session *s return session->MBEDTLS_PRIVATE(id_len); } +/** + * \brief Get the ciphersuite-id. + * + * \param session SSL session. + * + * \return int represetation for ciphersuite. + */ +static inline int mbedtls_ssl_session_get_ciphersuite_id(const mbedtls_ssl_session *session) +{ + return session->MBEDTLS_PRIVATE(ciphersuite); +} + /** * \brief Configure a key export callback. * (Default: none.) diff --git a/include/mbedtls/ssl_ciphersuites.h b/include/mbedtls/ssl_ciphersuites.h index 01865b6c4e..12d446200f 100644 --- a/include/mbedtls/ssl_ciphersuites.h +++ b/include/mbedtls/ssl_ciphersuites.h @@ -468,7 +468,7 @@ static inline const char *mbedtls_ssl_ciphersuite_get_name(const mbedtls_ssl_cip return info->MBEDTLS_PRIVATE(name); } -static inline const int mbedtls_ssl_ciphersuite_get_id(const mbedtls_ssl_ciphersuite_t *info) +static inline int mbedtls_ssl_ciphersuite_get_id(const mbedtls_ssl_ciphersuite_t *info) { return info->MBEDTLS_PRIVATE(id); }