From: Pauli Date: Mon, 5 Feb 2018 21:16:26 +0000 (+1000) Subject: Make OPENSSL_rdtsc universally available. X-Git-Tag: OpenSSL_1_1_1-pre1~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=360fc9f412f1f60a4644228d9b6d386161aad406;p=oweals%2Fopenssl.git Make OPENSSL_rdtsc universally available. If such a timer/counter register is not available, the return value is always zero. This matches the assembly implementations' behaviour. Reviewed-by: Richard Levitte Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/5231) --- diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index a4f2fb8035..a4d96d868e 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -355,4 +355,12 @@ int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len) return x; } + +/* + * For systems that don't provide an instruction counter register or equivalent. + */ +uint32_t OPENSSL_rdtsc(void) +{ + return 0; +} #endif diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h index 25ccdb1001..8a96de9847 100644 --- a/include/internal/cryptlib.h +++ b/include/internal/cryptlib.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -94,9 +94,7 @@ FILE *openssl_fopen(const char *filename, const char *mode); void *openssl_fopen(const char *filename, const char *mode); # endif -#ifdef OPENSSL_CPUID_OBJ -uint32_t OPENSSL_rdtsc(); -#endif +uint32_t OPENSSL_rdtsc(void); #ifdef __cplusplus }