aboutsummaryrefslogtreecommitdiff
path: root/src/ext/ed25519/donna/ed25519-donna-portable.h
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2015-07-06 09:40:28 +0000
committerYawning Angel <yawning@schwanenlied.me>2015-07-06 09:40:28 +0000
commit0f3eeca9b80ff42cf17f9d8b1b4b45588ea9fbad (patch)
treebf5f5787dbc922bb4ee4c3bd994988d5b1a3ca2a /src/ext/ed25519/donna/ed25519-donna-portable.h
parent7b10741be4280d84a7ac9f41c54380cbc1f09c1b (diff)
downloadtor-0f3eeca9b80ff42cf17f9d8b1b4b45588ea9fbad.tar.gz
tor-0f3eeca9b80ff42cf17f9d8b1b4b45588ea9fbad.zip
Integrate ed25519-donna (Not yet used).
Integrate ed25519-donna into the build process, and provide an interface that matches the `ref10` code. Apart from the blinding and Curve25519 key conversion, this functions as a drop-in replacement for ref10 (verified by modifying crypto_ed25519.c). Tests pass, and the benchmarks claim it is quite a bit faster, however actually using the code requires additional integration work.
Diffstat (limited to 'src/ext/ed25519/donna/ed25519-donna-portable.h')
-rw-r--r--src/ext/ed25519/donna/ed25519-donna-portable.h15
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>