Rearrange terms in gf_mul to prevent segfault

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23512)
This commit is contained in:
Angel Baez 2024-02-07 10:34:48 -05:00 committed by Tomas Mraz
parent 9c7ad69891
commit 76cecff5e9

View File

@ -45,9 +45,9 @@ void ossl_gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs)
accum0 += widemul(a[j + 4], b[i - j + 4]);
}
for (; j < 4; j++) {
accum2 += widemul(a[j], b[i - j + 8]);
accum1 += widemul(aa[j], bbb[i - j + 4]);
accum0 += widemul(a[j + 4], bb[i - j + 4]);
accum2 += widemul(a[j], b[i + 8 - j]);
accum1 += widemul(aa[j], bbb[i + 4 - j]);
accum0 += widemul(a[j + 4], bb[i + 4 - j]);
}
accum1 -= accum2;