Move OPENSSL_ASAN to base.h.

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>
This commit is contained in:
Adam Langley
2017-05-16 20:16:52 +00:00
committed by CQ bot account: commit-bot@chromium.org
parent 4dcc290eb0
commit 208e239371
4 changed files with 12 additions and 18 deletions
+4 -10
View File
@@ -95,14 +95,6 @@
#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) {
for (size_t i = 0; i < len; i++) {
printf("%02x", in[i]);
@@ -296,7 +288,7 @@ static EC_KEY *self_test_ecdsa_key(void) {
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
* of the module, and the location of the integrity hash, respectively. */
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) {
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 end = BORINGSSL_bcm_text_end;
-6
View File
@@ -18,12 +18,6 @@
/* This file exists in order to give the fipsmodule target, in non-FIPS mode,
* something to compile. */
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define OPENSSL_ASAN
#endif
#endif
int FIPS_mode(void) {
#if defined(BORINGSSL_FIPS) && !defined(OPENSSL_ASAN)
return 1;
+2 -2
View File
@@ -16,7 +16,7 @@
#if defined(__has_feature)
#if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer)
#define OPENSSL_ASAN
#define OPENSSL_ASAN_OR_MSAN
#endif
#endif
@@ -32,7 +32,7 @@
// TODO(davidben): See if this and ASan's and MSan's interceptors can be made to
// coexist.
#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 <signal.h>
+6
View File
@@ -202,6 +202,12 @@ extern "C" {
#define BORINGSSL_UNSAFE_DETERMINISTIC_MODE
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define OPENSSL_ASAN
#endif
#endif
/* CRYPTO_THREADID is a dummy value. */
typedef int CRYPTO_THREADID;