diff options
Diffstat (limited to 'src/ext/ed25519/donna/ed25519-donna-portable.h')
-rw-r--r-- | src/ext/ed25519/donna/ed25519-donna-portable.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ext/ed25519/donna/ed25519-donna-portable.h b/src/ext/ed25519/donna/ed25519-donna-portable.h index 0a0f7fc3af..44fa8407e2 100644 --- a/src/ext/ed25519/donna/ed25519-donna-portable.h +++ b/src/ext/ed25519/donna/ed25519-donna-portable.h @@ -20,6 +20,8 @@ #include <sys/param.h> #define DONNA_INLINE inline __attribute__((always_inline)) #define DONNA_NOINLINE __attribute__((noinline)) + /* Tor: OSX pollutes the global namespace with an ALIGN macro. */ + #undef ALIGN #define ALIGN(x) __attribute__((aligned(x))) #define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b))) #define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b))) @@ -129,6 +131,19 @@ static inline void U64TO8_LE(unsigned char *p, const uint64_t v) { } #endif +/* Tor: Detect and disable inline assembly when clang's AddressSanitizer + * is present, due to compilation failing because it runs out of registers. + * + * The alternative is to annotate `ge25519_scalarmult_base_choose_niels` + * and selectively disable AddressSanitizer insturmentation, however doing + * things this way results in a "more sanitized" binary. + */ +#if defined(__has_feature) + #if __has_feature(address_sanitizer) + #define ED25519_NO_INLINE_ASM + #endif +#endif + #include <stdlib.h> #include <string.h> |