mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-08-09 12:31:16 +00:00
Disable timing.c
Move hardclock implementation to entropy_pool.c to use that as a (pseudo) entropy source for now
This commit is contained in:
parent
a8b2673bce
commit
524d507363
|
@ -2150,7 +2150,7 @@
|
||||||
*
|
*
|
||||||
* This module is used by the HAVEGE random number generator.
|
* This module is used by the HAVEGE random number generator.
|
||||||
*/
|
*/
|
||||||
#define MBEDTLS_TIMING_C
|
//#define MBEDTLS_TIMING_C
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MBEDTLS_VERSION_C
|
* \def MBEDTLS_VERSION_C
|
||||||
|
|
|
@ -47,7 +47,7 @@ int mbedtls_havege_poll( void *data,
|
||||||
unsigned char *output, size_t len, size_t *olen );
|
unsigned char *output, size_t len, size_t *olen );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C) || defined(TARGET_LIKE_CORTEX_M4)
|
||||||
/**
|
/**
|
||||||
* \brief mbedtls_timing_hardclock-based entropy poll callback
|
* \brief mbedtls_timing_hardclock-based entropy poll callback
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -65,7 +65,7 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
|
||||||
mbedtls_entropy_add_source( ctx, mbedtls_platform_entropy_poll, NULL,
|
mbedtls_entropy_add_source( ctx, mbedtls_platform_entropy_poll, NULL,
|
||||||
MBEDTLS_ENTROPY_MIN_PLATFORM );
|
MBEDTLS_ENTROPY_MIN_PLATFORM );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C) || defined(TARGET_LIKE_CORTEX_M4)
|
||||||
mbedtls_entropy_add_source( ctx, mbedtls_hardclock_poll, NULL, MBEDTLS_ENTROPY_MIN_HARDCLOCK );
|
mbedtls_entropy_add_source( ctx, mbedtls_hardclock_poll, NULL, MBEDTLS_ENTROPY_MIN_HARDCLOCK );
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_HAVEGE_C)
|
#if defined(MBEDTLS_HAVEGE_C)
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
#include "mbedtls/entropy.h"
|
#include "mbedtls/entropy.h"
|
||||||
#include "mbedtls/entropy_poll.h"
|
#include "mbedtls/entropy_poll.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C) || defined(TARGET_LIKE_CORTEX_M4)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
#include "mbedtls/timing.h"
|
#include "mbedtls/timing.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_HAVEGE_C)
|
#if defined(MBEDTLS_HAVEGE_C)
|
||||||
|
@ -159,7 +161,26 @@ int mbedtls_platform_entropy_poll( void *data,
|
||||||
#endif /* _WIN32 && !EFIX64 && !EFI32 */
|
#endif /* _WIN32 && !EFIX64 && !EFI32 */
|
||||||
#endif /* !MBEDTLS_NO_PLATFORM_ENTROPY */
|
#endif /* !MBEDTLS_NO_PLATFORM_ENTROPY */
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(TARGET_LIKE_CORTEX_M4)
|
||||||
|
|
||||||
|
#include "MK64F12.h"
|
||||||
|
#include "core_cm4.h"
|
||||||
|
|
||||||
|
static unsigned long mbedtls_timing_hardclock( void )
|
||||||
|
{
|
||||||
|
static int dwt_started = 0;
|
||||||
|
|
||||||
|
if( dwt_started == 0 )
|
||||||
|
{
|
||||||
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||||
|
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( DWT->CYCCNT );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_TIMING_C) || defined(TARGET_LIKE_CORTEX_M4)
|
||||||
int mbedtls_hardclock_poll( void *data,
|
int mbedtls_hardclock_poll( void *data,
|
||||||
unsigned char *output, size_t len, size_t *olen )
|
unsigned char *output, size_t len, size_t *olen )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mbedtls",
|
"name": "mbedtls",
|
||||||
"version": "2.0.0-beta9",
|
"version": "2.0.0-beta9a",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "mbed partner license",
|
"license": "mbed partner license",
|
||||||
"extraIncludes": ["include"],
|
"extraIncludes": ["include"],
|
||||||
|
|
Loading…
Reference in a new issue