From ed10e2ab8741f3686a9e26175da4e3b2861e79cc Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 16 May 2025 14:24:50 +0200 Subject: [PATCH] Note functions that store the RNG callback in a context Signed-off-by: Gilles Peskine --- include/mbedtls/ssl.h | 4 ++++ include/mbedtls/ssl_ticket.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 960200f4b3..3cdddf7d72 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -2255,6 +2255,10 @@ void mbedtls_ssl_conf_verify(mbedtls_ssl_config *conf, /** * \brief Set the random number generator callback * + * \note The callback with its parameter must remain valid as + * long as there is an SSL context that uses the + * SSL configuration. + * * \param conf SSL configuration * \param f_rng RNG function (mandatory) * \param p_rng RNG parameter diff --git a/include/mbedtls/ssl_ticket.h b/include/mbedtls/ssl_ticket.h index bf3bc7648d..9f7e44029a 100644 --- a/include/mbedtls/ssl_ticket.h +++ b/include/mbedtls/ssl_ticket.h @@ -98,7 +98,9 @@ void mbedtls_ssl_ticket_init(mbedtls_ssl_ticket_context *ctx); * * \param ctx Context to be set up * \param f_rng RNG callback function (mandatory) - * \param p_rng RNG callback context + * \param p_rng RNG callback context. + * Note that the RNG callback must remain valid + * until the ticket context is freed. * \param cipher AEAD cipher to use for ticket protection. * Recommended value: MBEDTLS_CIPHER_AES_256_GCM. * \param lifetime Tickets lifetime in seconds