aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/curve448
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-02-14 14:35:01 +0000
committerMatt Caswell <matt@openssl.org>2018-02-20 12:59:31 +0000
commit8e32ec7a568b377f7fbcbee6b1bcf7fd8bbe2e88 (patch)
tree155ad0d8edd6014719238d2bf893cd7b9828db7f /crypto/ec/curve448
parentcb5ed32665ffb3a5ed6f631343d9c5302eaf7478 (diff)
downloadopenssl-8e32ec7a568b377f7fbcbee6b1bcf7fd8bbe2e88.tar.gz
Improve readability of f_impl.c and f_impl.h
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/5105)
Diffstat (limited to 'crypto/ec/curve448')
-rw-r--r--crypto/ec/curve448/arch_32/f_impl.c2
-rw-r--r--crypto/ec/curve448/arch_32/f_impl.h6
2 files changed, 4 insertions, 4 deletions
diff --git a/crypto/ec/curve448/arch_32/f_impl.c b/crypto/ec/curve448/arch_32/f_impl.c
index 423e8a803a..8a89d276ed 100644
--- a/crypto/ec/curve448/arch_32/f_impl.c
+++ b/crypto/ec/curve448/arch_32/f_impl.c
@@ -69,7 +69,7 @@ void gf_mulw_unsigned(gf_s * RESTRICT cs, const gf as, uint32_t b)
uint32_t mask = (1 << 28) - 1;
int i;
- assert(b < 1 << 28);
+ assert(b <= mask);
for (i = 0; i < 8; i++) {
accum0 += widemul(b, a[i]);
diff --git a/crypto/ec/curve448/arch_32/f_impl.h b/crypto/ec/curve448/arch_32/f_impl.h
index a8b2662182..1543d10663 100644
--- a/crypto/ec/curve448/arch_32/f_impl.h
+++ b/crypto/ec/curve448/arch_32/f_impl.h
@@ -42,16 +42,16 @@ void gf_bias(gf a, int amt)
uint32_t co1 = ((1 << 28) - 1) * amt, co2 = co1 - amt;
for (i = 0; i < NLIMBS; i++)
- a->limb[i] += (i == sizeof(*a) / sizeof(a->limb[0]) / 2) ? co2 : co1;
+ a->limb[i] += (i == NLIMBS / 2) ? co2 : co1;
}
void gf_weak_reduce(gf a)
{
uint32_t mask = (1 << 28) - 1;
- uint32_t tmp = a->limb[15] >> 28;
+ uint32_t tmp = a->limb[NLIMBS - 1] >> 28;
unsigned int i;
- a->limb[8] += tmp;
+ a->limb[NLIMBS / 2] += tmp;
for (i = 15; i > 0; i--)
a->limb[i] = (a->limb[i] & mask) + (a->limb[i - 1] >> 28);
a->limb[0] = (a->limb[0] & mask) + tmp;