mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
Merge pull request #7385 from daverodgman/timing_alignment
Fix cast alignment warning in timing.c
This commit is contained in:
commit
dd48c6e3df
@ -39,7 +39,7 @@ extern "C" {
|
||||
* \brief timer structure
|
||||
*/
|
||||
struct mbedtls_timing_hr_time {
|
||||
unsigned char MBEDTLS_PRIVATE(opaque)[32];
|
||||
uint64_t MBEDTLS_PRIVATE(opaque)[4];
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -20,8 +20,20 @@
|
||||
void timing_get_timer()
|
||||
{
|
||||
struct mbedtls_timing_hr_time time;
|
||||
|
||||
memset(&time, 0, sizeof(time));
|
||||
|
||||
(void) mbedtls_timing_get_timer(&time, 1);
|
||||
|
||||
/* Check that a non-zero time was written back */
|
||||
int all_zero = 1;
|
||||
for (size_t i = 0; i < sizeof(time); i++) {
|
||||
all_zero &= ((unsigned char *) &time)[i] == 0;
|
||||
}
|
||||
TEST_ASSERT(!all_zero);
|
||||
|
||||
(void) mbedtls_timing_get_timer(&time, 0);
|
||||
|
||||
/* This goto is added to avoid warnings from the generated code. */
|
||||
goto exit;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user