X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fec%2Fcurve448%2Farch_ref64%2Ff_impl.h;h=2575c05719d12ecde0bfed6db0095259e99b0139;hp=031000873796daeda3abd8eb027fdb7f736267e5;hb=8d55f844b08199e0ac6a2ddc501de39f3237c5e9;hpb=205fd6388175704bd7597dbfb571c84f868ce6da diff --git a/crypto/ec/curve448/arch_ref64/f_impl.h b/crypto/ec/curve448/arch_ref64/f_impl.h index 0310008737..2575c05719 100644 --- a/crypto/ec/curve448/arch_ref64/f_impl.h +++ b/crypto/ec/curve448/arch_ref64/f_impl.h @@ -17,18 +17,17 @@ void gf_add_RAW(gf out, const gf a, const gf b) { - for (unsigned int i = 0; i < 8; i++) { + for (unsigned int i = 0; i < 8; i++) out->limb[i] = a->limb[i] + b->limb[i]; - } gf_weak_reduce(out); } void gf_sub_RAW(gf out, const gf a, const gf b) { uint64_t co1 = ((1ull << 56) - 1) * 2, co2 = co1 - 2; - for (unsigned int i = 0; i < 8; i++) { + + for (unsigned int i = 0; i < 8; i++) out->limb[i] = a->limb[i] - b->limb[i] + ((i == 4) ? co2 : co1); - } gf_weak_reduce(out); } @@ -42,9 +41,9 @@ void gf_weak_reduce(gf a) { uint64_t mask = (1ull << 56) - 1; uint64_t tmp = a->limb[7] >> 56; + a->limb[4] += tmp; - for (unsigned int i = 7; i > 0; i--) { + for (unsigned int i = 7; i > 0; i--) a->limb[i] = (a->limb[i] & mask) + (a->limb[i - 1] >> 56); - } a->limb[0] = (a->limb[0] & mask) + tmp; }