@@ -66,7 +66,7 @@ protected: | |||||
public: | public: | ||||
/** @brief Read into a Buffer */ | /** @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. */ | /** @brief Read into a value-passed (eg temporary) TmpBuffer. */ | ||||
inline void read(TmpBuffer buffer) NOEXCEPT; | inline void read(TmpBuffer buffer) NOEXCEPT; | ||||
@@ -141,7 +141,7 @@ public: | |||||
/* Content-wise comparison; constant-time if they are the same length. */ | /* Content-wise comparison; constant-time if they are the same length. */ | ||||
inline decaf_bool_t operator==(const Block &b) const NOEXCEPT { | 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? */ | /** Virtual destructor for SecureBlock. TODO: probably means vtable? Make bool? */ | ||||
@@ -67,7 +67,7 @@ extern const point_t API_NS(point_base); | |||||
/* Projective Niels coordinates */ | /* Projective Niels coordinates */ | ||||
typedef struct { gf a, b, c; } niels_s, niels_t[1]; | 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 */ | /* Precomputed base */ | ||||
struct precomputed_s { niels_t table [DECAF_COMBS_N<<(DECAF_COMBS_T-1)]; }; | 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); | constant_time_lookup_xx_niels(ni, &table->table[j<<(t-1)], 1<<(t-1), tab); | ||||
cond_neg_niels(ni, invert); | 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); | add_niels_to_pt(out, ni, j==n-1 && i); | ||||
} else { | } else { | ||||
niels_to_pt(out, ni); | niels_to_pt(out, ni); | ||||
@@ -54,7 +54,7 @@ field_isr ( | |||||
st[0][0] = st[1][0] = st[2][0] = x[0]; | st[0][0] = st[1][0] = st[2][0] = x[0]; | ||||
unsigned int i; | unsigned int i; | ||||
for (i=0; i<sizeof(ops)/sizeof(ops[0]); i++) { | for (i=0; i<sizeof(ops)/sizeof(ops[0]); i++) { | ||||
field_sqrn(tmp1, st[1^i&1], ops[i].sh); | |||||
field_sqrn(tmp1, st[1^(i&1)], ops[i].sh); | |||||
field_mul(tmp2, tmp1, st[ops[i].idx]); | field_mul(tmp2, tmp1, st[ops[i].idx]); | ||||
st[i&1][0] = tmp2[0]; | st[i&1][0] = tmp2[0]; | ||||
} | } | ||||