From: Tomas Mraz Date: Fri, 2 Dec 2022 08:00:33 +0000 (+0100) Subject: timing_load_creds: Add timersub macro for platforms where it is missing X-Git-Tag: openssl-3.2.0-alpha1~1624 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2e4629608c3a2f5d93a91ef95abc25726eec44c;p=thirdparty%2Fopenssl.git timing_load_creds: Add timersub macro for platforms where it is missing Fixes #19812 Reviewed-by: Matt Caswell Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/19817) --- diff --git a/test/timing_load_creds.c b/test/timing_load_creds.c index a293f3ece29..9be068986fe 100644 --- a/test/timing_load_creds.c +++ b/test/timing_load_creds.c @@ -21,6 +21,20 @@ # include # 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)