mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 19:21:09 +01:00
Fix a build error with MSVC
Also fixes a minor bug on Windows with timers running over ~49 days. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -360,7 +360,9 @@ static unsigned elapsed_time(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mbedtls_timing_get_timer(&hires, 0);
|
||||
/* Wraps after ~49.7 days (assuming 32-bit int).
|
||||
* Don't run udp_proxy that long! */
|
||||
return (unsigned) mbedtls_timing_get_timer(&hires, 0);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||
unsigned i, j;
|
||||
struct mbedtls_timing_hr_time timer;
|
||||
unsigned long ms;
|
||||
unsigned long long ms;
|
||||
|
||||
psa_status_t status = psa_crypto_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
mbedtls_printf(".");
|
||||
}
|
||||
ms = mbedtls_timing_get_timer(&timer, 0);
|
||||
mbedtls_printf("\n%u iterations -> %lu ms\n", opt.iterations, ms);
|
||||
mbedtls_printf("\n%u iterations -> %llu ms\n", opt.iterations, ms);
|
||||
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user