Merge pull request #5622 from paul-elliott-arm/timing_delay_accessor
Accessor for mbedtls_timing_delay_context final delay
This commit is contained in:
commit
cefa904759
5 changed files with 47 additions and 2 deletions
4
ChangeLog.d/add_final_delay_accessor
Normal file
4
ChangeLog.d/add_final_delay_accessor
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Features
|
||||||
|
* Add the function mbedtls_timing_get_final_delay() to access the private
|
||||||
|
final delay field in an mbedtls_timing_delay_context, as requested in
|
||||||
|
#5183
|
|
@ -90,6 +90,17 @@ void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
|
||||||
*/
|
*/
|
||||||
int mbedtls_timing_get_delay( void *data );
|
int mbedtls_timing_get_delay( void *data );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the final timing delay
|
||||||
|
*
|
||||||
|
* \param data Pointer to timing data
|
||||||
|
* Must point to a valid \c mbedtls_timing_delay_context struct.
|
||||||
|
*
|
||||||
|
* \return Final timing delay in milliseconds.
|
||||||
|
*/
|
||||||
|
uint32_t mbedtls_timing_get_final_delay(
|
||||||
|
const mbedtls_timing_delay_context *data );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -158,13 +158,28 @@ int mbedtls_timing_get_delay( void *data )
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int mbedtls_timing_get_delay( void *data )
|
/*
|
||||||
|
* Get the final delay.
|
||||||
|
*/
|
||||||
|
uint32_t mbedtls_timing_get_final_delay(
|
||||||
|
const mbedtls_timing_delay_context *data )
|
||||||
|
{
|
||||||
|
return( data->fin_ms );
|
||||||
|
}
|
||||||
|
#else /* MBEDTLS_HAVE_TIME */
|
||||||
|
uint32_t mbedtls_timing_get_final_delay(
|
||||||
|
const mbedtls_timing_delay_context *data )
|
||||||
{
|
{
|
||||||
(void) data;
|
(void) data;
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mbedtls_timing_get_delay( void *data )
|
||||||
|
{
|
||||||
|
(void) data;
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms )
|
void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms )
|
||||||
{
|
{
|
||||||
(void) data;
|
(void) data;
|
||||||
|
@ -178,6 +193,7 @@ unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int
|
||||||
(void) reset;
|
(void) reset;
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_HAVE_TIME */
|
#endif /* MBEDTLS_HAVE_TIME */
|
||||||
#endif /* !MBEDTLS_TIMING_ALT */
|
#endif /* !MBEDTLS_TIMING_ALT */
|
||||||
#endif /* MBEDTLS_TIMING_C */
|
#endif /* MBEDTLS_TIMING_C */
|
||||||
|
|
|
@ -3210,3 +3210,6 @@ conf_curve:
|
||||||
|
|
||||||
Test configuration of groups for DHE through mbedtls_ssl_conf_groups()
|
Test configuration of groups for DHE through mbedtls_ssl_conf_groups()
|
||||||
conf_group:
|
conf_group:
|
||||||
|
|
||||||
|
Test accessor into timing_delay_context
|
||||||
|
timing_final_delay_accessor
|
||||||
|
|
|
@ -5441,3 +5441,14 @@ void conf_group()
|
||||||
mbedtls_ssl_config_free( &conf );
|
mbedtls_ssl_config_free( &conf );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
/* BEGIN_CASE depends_on:MBEDTLS_TIMING_C:MBEDTLS_HAVE_TIME */
|
||||||
|
void timing_final_delay_accessor( )
|
||||||
|
{
|
||||||
|
mbedtls_timing_delay_context delay_context;
|
||||||
|
|
||||||
|
mbedtls_timing_set_delay( &delay_context, 50, 100 );
|
||||||
|
|
||||||
|
TEST_ASSERT( mbedtls_timing_get_final_delay( &delay_context ) == 100 );
|
||||||
|
}
|
||||||
|
/* END_CASE */
|
||||||
|
|
Loading…
Reference in a new issue