tinyCrypt: Bind RNG wrapper to tinyCrypt in mbedtls_ssl_setup()
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index a1c26d0..752c172 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -55,6 +55,13 @@
#include "mbedtls/oid.h"
#endif
+#if defined(MBEDTLS_USE_TINYCRYPT)
+static int uecc_rng_wrapper( uint8_t *dest, unsigned int size )
+{
+ return( mbedtls_ssl_conf_rng_func( NULL, dest, size ) );
+}
+#endif /* MBEDTLS_USE_TINYCRYPT */
+
static void ssl_reset_in_out_pointers( mbedtls_ssl_context *ssl );
static uint32_t ssl_get_hs_total_len( mbedtls_ssl_context const *ssl );
@@ -8234,6 +8241,10 @@
ssl->conf = conf;
+#if defined(MBEDTLS_USE_TINYCRYPT)
+ uECC_set_rng( &uecc_rng_wrapper );
+#endif
+
/*
* Prepare base structures
*/
@@ -12165,13 +12176,6 @@
}
}
-#if defined(MBEDTLS_USE_TINYCRYPT)
-int mbetls_uecc_rng_wrapper( uint8_t *dest, unsigned int size )
-{
- return( mbedtls_ssl_conf_rng_func( NULL, dest, size ) );
-}
-#endif /* MBEDTLS_USE_TINYCRYPT */
-
#if defined(MBEDTLS_ECP_C)
/*
* Check if a curve proposed by the peer is in our list.