aboutsummaryrefslogtreecommitdiff
path: root/crypto/crypto.c
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2018-11-27 14:07:12 -0800
committerCQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>2019-01-22 20:22:53 +0000
commitc1615719cec110640e2408c78272c0f8db21882f (patch)
treeca376fff7ff2de25bf7d9262df63bb756a165e5e /crypto/crypto.c
parenteadef4730e66f914d7b9cbb2f38ecf7989f992ed (diff)
downloadboringssl-c1615719cec110640e2408c78272c0f8db21882f.zip
boringssl-c1615719cec110640e2408c78272c0f8db21882f.tar.gz
boringssl-c1615719cec110640e2408c78272c0f8db21882f.tar.bz2
Add test of assembly code dispatch.
The first attempt involved using Linux's support for hardware breakpoints to detect when assembly code was run. However, this doesn't work with SDE, which is a problem. This version has the assembly code update a global flags variable when it's run, but only in non-FIPS and non-debug builds. Update-Note: Assembly files now pay attention to the NDEBUG preprocessor symbol. Ensure the build passes the symbol in. (If release builds fail to link due to missing BORINGSSL_function_hit, this is the cause.) Change-Id: I6b7ced442b7a77d0b4ae148b00c351f68af89a6e Reviewed-on: https://boringssl-review.googlesource.com/c/33384 Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/crypto.c')
-rw-r--r--crypto/crypto.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/crypto.c b/crypto/crypto.c
index f7ac255..c86206a 100644
--- a/crypto/crypto.c
+++ b/crypto/crypto.c
@@ -36,8 +36,8 @@
#define BORINGSSL_NO_STATIC_INITIALIZER
#endif
-#endif /* !OPENSSL_NO_ASM && (OPENSSL_X86 || OPENSSL_X86_64 ||
- OPENSSL_ARM || OPENSSL_AARCH64) */
+#endif // !NO_ASM && !STATIC_ARMCAP &&
+ // (X86 || X86_64 || ARM || AARCH64 || PPC64LE)
// Our assembly does not use the GOT to reference symbols, which means
@@ -60,8 +60,7 @@
// that tests the capability values will still skip the constructor but, so
// far, the init constructor function only sets the capability variables.
-#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
-
+#if !defined(NDEBUG) && !defined(BORINGSSL_FIPS)
// This value must be explicitly initialised to zero in order to work around a
// bug in libtool or the linker on OS X.
//
@@ -69,6 +68,12 @@
// archive, linking on OS X will fail to resolve common symbols. By
// initialising it to zero, it becomes a "data symbol", which isn't so
// affected.
+HIDDEN uint8_t BORINGSSL_function_hit[7] = {0};
+#endif
+
+#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
+
+// This value must be explicitly initialized to zero. See similar comment above.
HIDDEN uint32_t OPENSSL_ia32cap_P[4] = {0};
#elif defined(OPENSSL_PPC64LE)