diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-12-02 09:00:33 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-12-06 18:18:52 +0100 |
commit | 8ca2a012c8e4acd44e613463c903d3c7c6b86727 (patch) | |
tree | cc1274e138ca8af5ff8f4856fbf37404d5e3ce8d | |
parent | a6e50030516378d5187b9fe52b921c2f96c8d437 (diff) |
timing_load_creds: Add timersub macro for platforms where it is missing
Fixes #19812
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19817)
(cherry picked from commit f2e4629608c3a2f5d93a91ef95abc25726eec44c)
-rw-r--r-- | test/timing_load_creds.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/timing_load_creds.c b/test/timing_load_creds.c index a293f3ece2..9be068986f 100644 --- a/test/timing_load_creds.c +++ b/test/timing_load_creds.c @@ -21,6 +21,20 @@ # include <openssl/bio.h> # include "internal/e_os.h" +# ifndef timersub +/* struct timeval * subtraction; a must be greater than or equal to b */ +# define timersub(a, b, res) \ + do { \ + (res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + if ((a)->tv_usec < (b)->tv_usec) { \ + (res)->tv_usec = (a)->tv_usec + 1000000 - (b)->tv_usec); \ + --(res)->tv_sec; \ + } else { \ + (res)->tv_usec = (a)->tv_usec - (b)->tv_usec); \ + } \ + } while(0) +# endif + static char *prog; static void readx509(const char *contents, int size) |