mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 14:18:10 +00:00
Fixes time() abstraction for custom configs
Added platform abstraction of time() to ChangeLog, version features, and fixed the build for dynamic configuration.
This commit is contained in:
parent
d5800b7761
commit
3fe6cd3a2d
4 changed files with 13 additions and 5 deletions
|
@ -2,6 +2,10 @@ mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
= mbed TLS 2.x branch
|
= mbed TLS 2.x branch
|
||||||
|
|
||||||
|
Features
|
||||||
|
* Support for platform abstraction of the standard C library time()
|
||||||
|
function.
|
||||||
|
|
||||||
Bugfix
|
Bugfix
|
||||||
* Fix bug in mbedtls_mpi_add_mpi() that caused wrong results when the three
|
* Fix bug in mbedtls_mpi_add_mpi() that caused wrong results when the three
|
||||||
arguments where the same (in-place doubling). Found and fixed by Janos
|
arguments where the same (in-place doubling). Found and fixed by Janos
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern "C" {
|
||||||
#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
|
#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
|
#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf /**< Default snprintf to use */
|
#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf /**< Default snprintf to use */
|
||||||
|
@ -243,7 +244,7 @@ int mbedtls_platform_set_exit( void (*exit_func)( int status ) );
|
||||||
* The function pointers for time
|
* The function pointers for time
|
||||||
*/
|
*/
|
||||||
#if defined(MBEDTLS_PLATFORM_TIME_ALT)
|
#if defined(MBEDTLS_PLATFORM_TIME_ALT)
|
||||||
extern time_t (*mbedtls_time)( mbedtls_time_t* time );
|
extern mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* time );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set your own time function pointer
|
* \brief Set your own time function pointer
|
||||||
|
@ -252,7 +253,7 @@ extern time_t (*mbedtls_time)( mbedtls_time_t* time );
|
||||||
*
|
*
|
||||||
* \return 0
|
* \return 0
|
||||||
*/
|
*/
|
||||||
int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t time ) );
|
int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* time ) );
|
||||||
#else
|
#else
|
||||||
#if defined(MBEDTLS_PLATFORM_TIME_MACRO)
|
#if defined(MBEDTLS_PLATFORM_TIME_MACRO)
|
||||||
#define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO
|
#define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO
|
||||||
|
|
|
@ -198,15 +198,15 @@ int mbedtls_platform_set_exit( void (*exit_func)( int status ) )
|
||||||
static mbedtls_time_t platform_time_uninit( mbedtls_time_t* timer )
|
static mbedtls_time_t platform_time_uninit( mbedtls_time_t* timer )
|
||||||
{
|
{
|
||||||
((void) timer);
|
((void) timer);
|
||||||
return( NULL );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MBEDTLS_PLATFORM_STD_TIME platform_time_uninit
|
#define MBEDTLS_PLATFORM_STD_TIME platform_time_uninit
|
||||||
#endif /* !MBEDTLS_PLATFORM_STD_TIME */
|
#endif /* !MBEDTLS_PLATFORM_STD_TIME */
|
||||||
|
|
||||||
time_t (*mbedtls_time)( mbedtls_time_t* timer ) = MBEDTLS_PLATFORM_STD_TIME;
|
mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* timer ) = MBEDTLS_PLATFORM_STD_TIME;
|
||||||
|
|
||||||
int mbedtls_platform_set_exit( mbedtls_time_t (*time_func)( mbedtls_time_t timer ) )
|
int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* timer ) )
|
||||||
{
|
{
|
||||||
mbedtls_time = time_func;
|
mbedtls_time = time_func;
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
|
@ -54,6 +54,9 @@ static const char *features[] = {
|
||||||
#if defined(MBEDTLS_PLATFORM_EXIT_ALT)
|
#if defined(MBEDTLS_PLATFORM_EXIT_ALT)
|
||||||
"MBEDTLS_PLATFORM_EXIT_ALT",
|
"MBEDTLS_PLATFORM_EXIT_ALT",
|
||||||
#endif /* MBEDTLS_PLATFORM_EXIT_ALT */
|
#endif /* MBEDTLS_PLATFORM_EXIT_ALT */
|
||||||
|
#if defined(MBEDTLS_PLATFORM_TIME_ALT)
|
||||||
|
"MBEDTLS_PLATFORM_TIME_ALT",
|
||||||
|
#endif /* MBEDTLS_PLATFORM_TIME_ALT */
|
||||||
#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
|
#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
|
||||||
"MBEDTLS_PLATFORM_FPRINTF_ALT",
|
"MBEDTLS_PLATFORM_FPRINTF_ALT",
|
||||||
#endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */
|
#endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */
|
||||||
|
|
Loading…
Reference in a new issue