summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ecp_mont.c
diff options
context:
space:
mode:
authorBilly Brumley <bbrumley@gmail.com>2018-07-19 11:16:07 +0300
committerAndy Polyakov <appro@openssl.org>2018-07-26 19:41:16 +0200
commit9d91530d2d7da1447b7be8631b269599023430e7 (patch)
treecf21727c4f3a8e8bac4f53388dd3eeb555e9d2f4 /crypto/ec/ecp_mont.c
parent793f19e47c69558e39c702da75c27e0509baf379 (diff)
EC GFp ladder
This commit leverages the Montgomery ladder scaffold introduced in #6690 (alongside a specialized Lopez-Dahab ladder for binary curves) to provide a specialized differential addition-and-double implementation to speedup prime curves, while keeping all the features of `ec_scalar_mul_ladder` against SCA attacks. The arithmetic in ladder_pre, ladder_step and ladder_post is auto generated with tooling, from the following formulae: - `ladder_pre`: Formula 3 for doubling from Izu-Takagi "A fast parallel elliptic curve multiplication resistant against side channel attacks", as described at https://hyperelliptic.org/EFD/g1p/auto-shortw-xz.html#doubling-dbl-2002-it-2 - `ladder_step`: differential addition-and-doubling Eq. (8) and (10) from Izu-Takagi "A fast parallel elliptic curve multiplication resistant against side channel attacks", as described at https://hyperelliptic.org/EFD/g1p/auto-shortw-xz.html#ladder-ladd-2002-it-3 - `ladder_post`: y-coordinate recovery using Eq. (8) from Brier-Joye "Weierstrass Elliptic Curves and Side-Channel Attacks", modified to work in projective coordinates. Co-authored-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6772)
Diffstat (limited to 'crypto/ec/ecp_mont.c')
-rw-r--r--crypto/ec/ecp_mont.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/ec/ecp_mont.c b/crypto/ec/ecp_mont.c
index fda9a231f6..36682e5cfb 100644
--- a/crypto/ec/ecp_mont.c
+++ b/crypto/ec/ecp_mont.c
@@ -64,9 +64,9 @@ const EC_METHOD *EC_GFp_mont_method(void)
ecdh_simple_compute_key,
0, /* field_inverse_mod_ord */
ec_GFp_simple_blind_coordinates,
- 0, /* ladder_pre */
- 0, /* ladder_step */
- 0 /* ladder_post */
+ ec_GFp_simple_ladder_pre,
+ ec_GFp_simple_ladder_step,
+ ec_GFp_simple_ladder_post
};
return &ret;