More optimisations for EC P-256 "i15" (specialised squaring function, mixed coordinates addition with a 4-bit window when the base point is the conventional generator).

This commit is contained in:
Thomas Pornin 2017-01-13 05:10:43 +01:00
parent 21743ae69e
commit 44c79c1add
14 changed files with 804 additions and 56 deletions

View file

@ -133,18 +133,8 @@ br_ecdsa_i15_sign_raw(const br_ec_impl *impl,
* prime order, that reduction is only a matter of computing
* a subtraction.
*/
ulen = cd->generator_len;
memcpy(eU, cd->generator, ulen);
br_i15_encode(tt, nlen, k);
if (!impl->mul(eU, ulen, tt, nlen, sk->curve)) {
/*
* Point multiplication may fail here only if the
* EC implementation does not support the curve, or the
* private key is incorrect (x is a multiple of the curve
* order).
*/
return 0;
}
ulen = impl->mulgen(eU, tt, nlen, sk->curve);
br_i15_zero(r, n[0]);
br_i15_decode(r, &eU[1], ulen >> 1);
r[0] = n[0];