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

@ -4790,6 +4790,20 @@ test_EC_inner(const char *sk, const char *sU,
exit(EXIT_FAILURE);
}
/*
* Also recomputed D = z*G with mulgen(). This must
* again match.
*/
memset(eD, 0, ulen);
if (impl->mulgen(eD, bz, nlen, cd->curve) != ulen) {
fprintf(stderr, "mulgen() failed: wrong length\n");
exit(EXIT_FAILURE);
}
if (memcmp(eC, eD, nlen) != 0) {
fprintf(stderr, "mulgen() / muladd() mismatch\n");
exit(EXIT_FAILURE);
}
/*
* Check with x*A = y*B. We do so by setting b = x and y = a.
*/