From f825fd9b75556caba1babbfb2607ed9025d31687 Mon Sep 17 00:00:00 2001 From: Mike Hamburg Date: Thu, 2 Jul 2015 18:02:57 -0700 Subject: [PATCH] gcc compat changes --- include/secure_buffer.hxx | 4 ++-- src/decaf_fast.c | 4 ++-- src/p25519/f_arithmetic.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/secure_buffer.hxx b/include/secure_buffer.hxx index 0db90ab..6db5a1d 100644 --- a/include/secure_buffer.hxx +++ b/include/secure_buffer.hxx @@ -66,7 +66,7 @@ protected: public: /** @brief Read into a Buffer */ - virtual inline void read(Buffer &buffer) NOEXCEPT = 0; + virtual void read(Buffer &buffer) NOEXCEPT = 0; /** @brief Read into a value-passed (eg temporary) TmpBuffer. */ inline void read(TmpBuffer buffer) NOEXCEPT; @@ -141,7 +141,7 @@ public: /* Content-wise comparison; constant-time if they are the same length. */ inline decaf_bool_t operator==(const Block &b) const NOEXCEPT { - return ~(*this == b); + return ~(*this != b); } /** Virtual destructor for SecureBlock. TODO: probably means vtable? Make bool? */ diff --git a/src/decaf_fast.c b/src/decaf_fast.c index 956ef24..1511874 100644 --- a/src/decaf_fast.c +++ b/src/decaf_fast.c @@ -67,7 +67,7 @@ extern const point_t API_NS(point_base); /* Projective Niels coordinates */ typedef struct { gf a, b, c; } niels_s, niels_t[1]; -typedef struct { niels_t n; gf z; } pniels_s, pniels_t[1]; +typedef struct { niels_t n; gf z; } __attribute__((aligned(32))) pniels_s, pniels_t[1]; /* MAGIC alignment */ /* Precomputed base */ struct precomputed_s { niels_t table [DECAF_COMBS_N<<(DECAF_COMBS_T-1)]; }; @@ -1387,7 +1387,7 @@ void API_NS(precomputed_scalarmul) ( constant_time_lookup_xx_niels(ni, &table->table[j<<(t-1)], 1<<(t-1), tab); cond_neg_niels(ni, invert); - if ((i!=s-1)||j) { + if ((i!=(int)s-1)||j) { add_niels_to_pt(out, ni, j==n-1 && i); } else { niels_to_pt(out, ni); diff --git a/src/p25519/f_arithmetic.c b/src/p25519/f_arithmetic.c index 768d864..5f01ac4 100644 --- a/src/p25519/f_arithmetic.c +++ b/src/p25519/f_arithmetic.c @@ -54,7 +54,7 @@ field_isr ( st[0][0] = st[1][0] = st[2][0] = x[0]; unsigned int i; for (i=0; i