Create a prototype for OPENSSL_rdtsc

Switch to make it return an uint32_t instead of the various different
types it returns now.

Fixes: #3125

Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #4757
This commit is contained in:
Kurt Roeckx 2017-11-19 17:40:56 +01:00
parent 9279364894
commit d807db26a4
6 changed files with 16 additions and 9 deletions

View file

@ -13,6 +13,7 @@
#include <setjmp.h>
#include <signal.h>
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
#include "arm_arch.h"
@ -23,7 +24,7 @@ void OPENSSL_cpuid_setup(void)
{
}
unsigned long OPENSSL_rdtsc(void)
uint32_t OPENSSL_rdtsc(void)
{
return 0;
}
@ -45,9 +46,9 @@ void _armv8_aes_probe(void);
void _armv8_sha1_probe(void);
void _armv8_sha256_probe(void);
void _armv8_pmull_probe(void);
unsigned long _armv7_tick(void);
uint32_t _armv7_tick(void);
unsigned long OPENSSL_rdtsc(void)
uint32_t OPENSSL_rdtsc(void)
{
if (OPENSSL_armcap_P & ARMV7_TICK)
return _armv7_tick();

View file

@ -15,6 +15,7 @@
#include <sys/time.h>
#include <unistd.h>
#include <openssl/bn.h>
#include "internal/cryptlib.h"
#include "sparc_arch.h"
@ -98,7 +99,7 @@ unsigned long _sparcv9_random(void);
size_t _sparcv9_vis1_instrument_bus(unsigned int *, size_t);
size_t _sparcv9_vis1_instrument_bus2(unsigned int *, size_t, size_t);
unsigned long OPENSSL_rdtsc(void)
uint32_t OPENSSL_rdtsc(void)
{
if (OPENSSL_sparcv9cap_P[0] & SPARCV9_TICK_PRIVILEGED)
#if defined(__sun) && defined(__SVR4)

View file

@ -94,6 +94,10 @@ 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
#ifdef __cplusplus
}
#endif

View file

@ -17,6 +17,7 @@
#include "../crypto/modes/modes_lcl.h"
#include "testutil.h"
#include "internal/nelem.h"
#include "internal/cryptlib.h"
typedef struct {
size_t size;
@ -889,7 +890,7 @@ static void benchmark_gcm128(const unsigned char *K, size_t Klen,
#ifdef OPENSSL_CPUID_OBJ
GCM128_CONTEXT ctx;
AES_KEY key;
size_t start, gcm_t, ctr_t, OPENSSL_rdtsc();
uint32_t start, gcm_t, ctr_t;
union {
u64 u;
u8 c[1024];

View file

@ -16,6 +16,7 @@
#include "internal/poly1305.h"
#include "../crypto/poly1305/poly1305_local.h"
#include "internal/nelem.h"
#include "internal/cryptlib.h"
typedef struct {
size_t size;
@ -40,8 +41,7 @@ static void benchmark_poly1305()
POLY1305 poly1305;
unsigned char key[32];
unsigned char buf[8192];
unsigned long long stopwatch;
unsigned long long OPENSSL_rdtsc();
uint32_t stopwatch;
unsigned int i;
memset (buf,0x55,sizeof(buf));

View file

@ -17,6 +17,7 @@
#include "internal/siphash.h"
#include "../crypto/siphash/siphash_local.h"
#include "internal/nelem.h"
#include "internal/cryptlib.h"
static BIO* b_stderr = NULL;
static BIO* b_stdout = NULL;
@ -43,8 +44,7 @@ static int benchmark_siphash(void)
SIPHASH siphash;
unsigned char key[SIPHASH_KEY_SIZE];
unsigned char buf[8192];
unsigned long long stopwatch;
unsigned long long OPENSSL_rdtsc();
uint32_t stopwatch;
unsigned int i;
memset (buf,0x55,sizeof(buf));