Move ssl_set_rng() to act on config
diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h
index b72ba92..a72914f 100644
--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -799,12 +799,16 @@
* Pointers
*/
- const int *ciphersuite_list[4]; /*!< allowed ciphersuites / version */
+ const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */
/** Callback for printing debug output */
void (*f_dbg)(void *, int, const char *);
void *p_dbg; /*!< context for the debug function */
+ /** Callback for getting (pseudo-)random numbers */
+ int (*f_rng)(void *, unsigned char *, size_t);
+ void *p_rng; /*!< context for the RNG function */
+
/** Callback to retrieve a session from the cache */
int (*f_get_cache)(void *, mbedtls_ssl_session *);
/** Callback to store a session into the cache */
@@ -836,7 +840,7 @@
/** Callback to verify validity of a ClientHello cookie */
int (*f_cookie_check)( void *, const unsigned char *, size_t,
const unsigned char *, size_t );
- void *p_cookie; /*!< context for the cookie callbacks */
+ void *p_cookie; /*!< context for the cookie callbacks */
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C)
@@ -846,7 +850,7 @@
#endif /* MBEDTLS_X509_CRT_PARSE_C */
#if defined(MBEDTLS_SSL_SET_CURVES)
- const mbedtls_ecp_group_id *curve_list; /*!< allowed curves */
+ const mbedtls_ecp_group_id *curve_list; /*!< allowed curves */
#endif
#if defined(MBEDTLS_DHM_C)
@@ -966,9 +970,6 @@
/*
* Callbacks
*/
- int (*f_rng)(void *, unsigned char *, size_t);
- void *p_rng; /*!< context for the RNG function */
-
int (*f_send)(void *, const unsigned char *, size_t);
int (*f_recv)(void *, unsigned char *, size_t);
int (*f_recv_timeout)(void *, unsigned char *, size_t, uint32_t);
@@ -1243,11 +1244,11 @@
/**
* \brief Set the random number generator callback
*
- * \param ssl SSL context
+ * \param conf SSL configuration
* \param f_rng RNG function
* \param p_rng RNG parameter
*/
-void mbedtls_ssl_set_rng( mbedtls_ssl_context *ssl,
+void mbedtls_ssl_set_rng( mbedtls_ssl_config *conf,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );