Commit 360fc9f4 authored by Pauli's avatar Pauli
Browse files

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: default avatarRichard Levitte <levitte@openssl.org>
Reviewed-by: default avatarMatthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5231)
parent 2ad2281a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+2 −4
Original line number Diff line number Diff line
/*
 * 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
}