diff options
author | Adam Langley <agl@chromium.org> | 2014-08-01 05:46:35 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-08-01 21:17:21 +0400 |
commit | cf052cf7328478d46c78dc67dd4f5ac44db02c20 (patch) | |
tree | 037b03e22b63706422048bc7a0f794ed73591582 /crypto/mem.c | |
parent | 581a17f5c874758ec60c1256423c15842edc68f2 (diff) |
Fix build for PNaCl.
PNaCl builds BoringSSL with OPENSSL_NO_ASM, but the new OPENSSL_cleanse
was using inline assembly anyway. It appears that even though the inline
asm was empty, it still breaks the PNaCl build:
disallowed: inline assembly: call void asm sideeffect "", "r,~{memory}"(i8* %.asptr319), !dbg !96986
With this change, we don't have any compiler scarecrows for
OPENSSL_cleanse any longer when using OPENSSL_NO_ASM :( Maybe, one day,
we'll get memset_s in our base platform.
Change-Id: Ia359f6bcc2000be18a6f15de10fc683452151741
Reviewed-on: https://boringssl-review.googlesource.com/1353
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/mem.c')
-rw-r--r-- | crypto/mem.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/mem.c b/crypto/mem.c index e9c035e5..e35d98b9 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -96,6 +96,7 @@ void *OPENSSL_realloc_clean(void *ptr, size_t old_size, size_t new_size) { void OPENSSL_cleanse(void *ptr, size_t len) { memset(ptr, 0, len); +#if !defined(OPENSSL_NO_ASM) /* As best as we can tell, this is sufficient to break any optimisations that might try to eliminate "superfluous" memsets. If there's an easy way to detect memset_s, it would be better to use that. */ @@ -104,6 +105,7 @@ void OPENSSL_cleanse(void *ptr, size_t len) { #else __asm__ __volatile__("" : : "r"(ptr) : "memory"); #endif +#endif /* !OPENSSL_NO_ASM */ } int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) { |