Saves having it in several places. Change-Id: I329e1bf4dd4a7f51396e36e2604280fcca32b58c Reviewed-on: https://boringssl-review.googlesource.com/16026 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>kris/onging/CECPQ3_patch15
@@ -95,14 +95,6 @@ | |||||
#if defined(BORINGSSL_FIPS) | #if defined(BORINGSSL_FIPS) | ||||
#if defined(__has_feature) | |||||
#if __has_feature(address_sanitizer) | |||||
/* Integrity tests cannot run under ASAN because it involves reading the full | |||||
* .text section, which triggers the global-buffer overflow detection. */ | |||||
#define OPENSSL_ASAN | |||||
#endif | |||||
#endif | |||||
static void hexdump(const uint8_t *in, size_t len) { | static void hexdump(const uint8_t *in, size_t len) { | ||||
for (size_t i = 0; i < len; i++) { | for (size_t i = 0; i < len; i++) { | ||||
printf("%02x", in[i]); | printf("%02x", in[i]); | ||||
@@ -296,7 +288,7 @@ static EC_KEY *self_test_ecdsa_key(void) { | |||||
return ec_key; | return ec_key; | ||||
} | } | ||||
#ifndef OPENSSL_ASAN | |||||
#if !defined(OPENSSL_ASAN) | |||||
/* These symbols are filled in by delocate.go. They point to the start and end | /* These symbols are filled in by delocate.go. They point to the start and end | ||||
* of the module, and the location of the integrity hash, respectively. */ | * of the module, and the location of the integrity hash, respectively. */ | ||||
extern const uint8_t BORINGSSL_bcm_text_start[]; | extern const uint8_t BORINGSSL_bcm_text_start[]; | ||||
@@ -309,7 +301,9 @@ static void BORINGSSL_bcm_power_on_self_test(void) __attribute__((constructor)); | |||||
static void BORINGSSL_bcm_power_on_self_test(void) { | static void BORINGSSL_bcm_power_on_self_test(void) { | ||||
CRYPTO_library_init(); | CRYPTO_library_init(); | ||||
#ifndef OPENSSL_ASAN | |||||
#if !defined(OPENSSL_ASAN) | |||||
/* Integrity tests cannot run under ASAN because it involves reading the full | |||||
* .text section, which triggers the global-buffer overflow detection. */ | |||||
const uint8_t *const start = BORINGSSL_bcm_text_start; | const uint8_t *const start = BORINGSSL_bcm_text_start; | ||||
const uint8_t *const end = BORINGSSL_bcm_text_end; | const uint8_t *const end = BORINGSSL_bcm_text_end; | ||||
@@ -18,12 +18,6 @@ | |||||
/* This file exists in order to give the fipsmodule target, in non-FIPS mode, | /* This file exists in order to give the fipsmodule target, in non-FIPS mode, | ||||
* something to compile. */ | * something to compile. */ | ||||
#if defined(__has_feature) | |||||
#if __has_feature(address_sanitizer) | |||||
#define OPENSSL_ASAN | |||||
#endif | |||||
#endif | |||||
int FIPS_mode(void) { | int FIPS_mode(void) { | ||||
#if defined(BORINGSSL_FIPS) && !defined(OPENSSL_ASAN) | #if defined(BORINGSSL_FIPS) && !defined(OPENSSL_ASAN) | ||||
return 1; | return 1; | ||||
@@ -16,7 +16,7 @@ | |||||
#if defined(__has_feature) | #if defined(__has_feature) | ||||
#if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) | #if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) | ||||
#define OPENSSL_ASAN | |||||
#define OPENSSL_ASAN_OR_MSAN | |||||
#endif | #endif | ||||
#endif | #endif | ||||
@@ -32,7 +32,7 @@ | |||||
// TODO(davidben): See if this and ASan's and MSan's interceptors can be made to | // TODO(davidben): See if this and ASan's and MSan's interceptors can be made to | ||||
// coexist. | // coexist. | ||||
#if defined(__linux__) && defined(OPENSSL_GLIBC) && !defined(OPENSSL_ARM) && \ | #if defined(__linux__) && defined(OPENSSL_GLIBC) && !defined(OPENSSL_ARM) && \ | ||||
!defined(OPENSSL_AARCH64) && !defined(OPENSSL_ASAN) | |||||
!defined(OPENSSL_AARCH64) && !defined(OPENSSL_ASAN_OR_MSAN) | |||||
#include <errno.h> | #include <errno.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
@@ -202,6 +202,12 @@ extern "C" { | |||||
#define BORINGSSL_UNSAFE_DETERMINISTIC_MODE | #define BORINGSSL_UNSAFE_DETERMINISTIC_MODE | ||||
#endif | #endif | ||||
#if defined(__has_feature) | |||||
#if __has_feature(address_sanitizer) | |||||
#define OPENSSL_ASAN | |||||
#endif | |||||
#endif | |||||
/* CRYPTO_THREADID is a dummy value. */ | /* CRYPTO_THREADID is a dummy value. */ | ||||
typedef int CRYPTO_THREADID; | typedef int CRYPTO_THREADID; | ||||