From 358b448d7255fa7d2f5708a26f330276cc0c2d8b Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Mon, 4 Mar 2024 02:19:31 +0000 Subject: [PATCH] ssl_ciphersuite: Added getter methods for ciphersuite id. Signed-off-by: Minos Galanakis --- include/mbedtls/ssl.h | 5 +++-- include/mbedtls/ssl_ciphersuites.h | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 78ea4da8b8..4c085b0c76 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -2724,7 +2724,8 @@ static inline int mbedtls_ssl_session_get_ticket_creation_time( * * \return The address of the session-id buffer. */ -static inline const unsigned char[32]* mbedtls_ssl_session_get_id(const mbedtls_ssl_session *session) +static inline unsigned const char (*mbedtls_ssl_session_get_id(const mbedtls_ssl_session * + session))[32] { return &session->MBEDTLS_PRIVATE(id); } @@ -2736,7 +2737,7 @@ static inline const unsigned char[32]* mbedtls_ssl_session_get_id(const mbedtls_ * * \return size_t size of session-id buffer. */ -static inline const size_t mbedtls_ssl_session_get_id_len(const mbedtls_ssl_session *session) +static inline size_t mbedtls_ssl_session_get_id_len(const mbedtls_ssl_session *session) { return session->MBEDTLS_PRIVATE(id_len); } diff --git a/include/mbedtls/ssl_ciphersuites.h b/include/mbedtls/ssl_ciphersuites.h index f755ef3042..01865b6c4e 100644 --- a/include/mbedtls/ssl_ciphersuites.h +++ b/include/mbedtls/ssl_ciphersuites.h @@ -468,6 +468,11 @@ 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) +{ + return info->MBEDTLS_PRIVATE(id); +} + size_t mbedtls_ssl_ciphersuite_get_cipher_key_bitlen(const mbedtls_ssl_ciphersuite_t *info); #ifdef __cplusplus