mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 16:45:28 +00:00
TinyCrypt Test: Initialize TinyCrypt RNG in test suites if enabled
This commit is contained in:
parent
75f8d3276f
commit
f2bf115057
|
@ -28,6 +28,10 @@
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
#include "tinycrypt/ecc.h"
|
||||||
|
#endif /* MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <basetsd.h>
|
#include <basetsd.h>
|
||||||
typedef UINT8 uint8_t;
|
typedef UINT8 uint8_t;
|
||||||
|
@ -545,6 +549,18 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
static int uecc_rng_wrapper( uint8_t *dest, unsigned int size )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
ret = rnd_std_rand( NULL, dest, size );
|
||||||
|
if( ret == 0 )
|
||||||
|
return( (int) size );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_USE_TINYCRYPT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function only returns zeros
|
* This function only returns zeros
|
||||||
*
|
*
|
||||||
|
|
|
@ -410,6 +410,10 @@ int execute_tests( int argc , const char ** argv )
|
||||||
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
|
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
|
uECC_set_rng( &uecc_rng_wrapper );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The C standard doesn't guarantee that all-bits-0 is the representation
|
* The C standard doesn't guarantee that all-bits-0 is the representation
|
||||||
* of a NULL pointer. We do however use that in our code for initializing
|
* of a NULL pointer. We do however use that in our code for initializing
|
||||||
|
|
Loading…
Reference in a new issue