Define CRYPTO_once_t as LONG on Windows.

This is used with a platform API, so it should use the corresponding
platform type, saving us the size assert. It's ever defined in an
internal header, so we can freely use windows.h and friends.

Change-Id: Idc979309436adcf54524c835ddc2c98c3870d2e2
Reviewed-on: https://boringssl-review.googlesource.com/4680
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-05-08 12:45:40 -04:00 committed by Adam Langley
parent 0d107e183e
commit dfb67134dc
2 changed files with 2 additions and 3 deletions

View File

@ -336,7 +336,7 @@ static inline int constant_time_select_int(unsigned int mask, int a, int b) {
typedef pthread_once_t CRYPTO_once_t;
#define CRYPTO_ONCE_INIT PTHREAD_ONCE_INIT
#else
typedef int32_t CRYPTO_once_t;
typedef LONG CRYPTO_once_t;
#define CRYPTO_ONCE_INIT 0
#endif

View File

@ -32,9 +32,8 @@ OPENSSL_COMPILE_ASSERT(sizeof(CRYPTO_MUTEX) >= sizeof(CRITICAL_SECTION),
CRYPTO_MUTEX_too_small);
static void run_once(CRYPTO_once_t *in_once, void (*init)(void *), void *arg) {
volatile LONG *once = (LONG*) in_once;
volatile LONG *once = in_once;
assert(sizeof(LONG) == sizeof(CRYPTO_once_t));
/* Values must be aligned. */
assert((((uintptr_t) once) & 3) == 0);