mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-21 03:57:47 +00:00
tinyCrypt: Bind RNG wrapper to tinyCrypt in mbedtls_ssl_setup()
This commit is contained in:
parent
c6c0fe6c5f
commit
ef982d57bf
|
@ -902,10 +902,6 @@ int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl );
|
||||||
int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl );
|
int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl );
|
||||||
void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl );
|
void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl );
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
|
||||||
int mbetls_uecc_rng_wrapper( uint8_t *dest, unsigned int size );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Update record layer
|
* \brief Update record layer
|
||||||
*
|
*
|
||||||
|
|
|
@ -3533,8 +3533,6 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl,
|
||||||
{
|
{
|
||||||
const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
|
const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
|
||||||
|
|
||||||
uECC_set_rng( &mbetls_uecc_rng_wrapper );
|
|
||||||
|
|
||||||
if( !uECC_make_key( ssl->handshake->ecdh_ownpubkey,
|
if( !uECC_make_key( ssl->handshake->ecdh_ownpubkey,
|
||||||
ssl->handshake->ecdh_privkey,
|
ssl->handshake->ecdh_privkey,
|
||||||
uecc_curve ) )
|
uecc_curve ) )
|
||||||
|
|
|
@ -3384,8 +3384,6 @@ static int ssl_prepare_server_key_exchange( mbedtls_ssl_context *ssl,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
uECC_set_rng( &mbetls_uecc_rng_wrapper );
|
|
||||||
|
|
||||||
if( ssl->handshake->curve_tls_id != 23 )
|
if( ssl->handshake->curve_tls_id != 23 )
|
||||||
return( MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN );
|
return( MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN );
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,13 @@
|
||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
#endif
|
#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 void ssl_reset_in_out_pointers( mbedtls_ssl_context *ssl );
|
||||||
static uint32_t ssl_get_hs_total_len( mbedtls_ssl_context const *ssl );
|
static uint32_t ssl_get_hs_total_len( mbedtls_ssl_context const *ssl );
|
||||||
|
|
||||||
|
@ -8234,6 +8241,10 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
||||||
|
|
||||||
ssl->conf = conf;
|
ssl->conf = conf;
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
uECC_set_rng( &uecc_rng_wrapper );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prepare base structures
|
* Prepare base structures
|
||||||
*/
|
*/
|
||||||
|
@ -12165,13 +12176,6 @@ unsigned char mbedtls_ssl_hash_from_md_alg( int md )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#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)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
/*
|
/*
|
||||||
* Check if a curve proposed by the peer is in our list.
|
* Check if a curve proposed by the peer is in our list.
|
||||||
|
|
Loading…
Reference in a new issue