diff options
author | Sohaib ul Hassan <soh.19.hassan@gmail.com> | 2018-06-16 17:07:40 +0300 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-06-19 11:43:59 +0100 |
commit | f667820c16a44245a4a898a568936c47a9b0ee6e (patch) | |
tree | fb283e5052edca879596771fbe1cf8e9387bad1d /crypto/ec/ecp_mont.c | |
parent | ddb634fe6f9aeea34fe036cf804903b4240d38ac (diff) | |
download | openssl-new-f667820c16a44245a4a898a568936c47a9b0ee6e.tar.gz |
Implement coordinate blinding for EC_POINT
This commit implements coordinate blinding, i.e., it randomizes the
representative of an elliptic curve point in its equivalence class, for
prime curves implemented through EC_GFp_simple_method,
EC_GFp_mont_method, and EC_GFp_nist_method.
This commit is derived from the patch
https://marc.info/?l=openssl-dev&m=131194808413635 by Billy Brumley.
Coordinate blinding is a generally useful side-channel countermeasure
and is (mostly) free. The function itself takes a few field
multiplicationss, but is usually only necessary at the beginning of a
scalar multiplication (as implemented in the patch). When used this way,
it makes the values that variables take (i.e., field elements in an
algorithm state) unpredictable.
For instance, this mitigates chosen EC point side-channel attacks for
settings such as ECDH and EC private key decryption, for the
aforementioned curves.
For EC_METHODs using different coordinate representations this commit
does nothing, but the corresponding coordinate blinding function can be
easily added in the future to extend these changes to such curves.
Co-authored-by: Nicola Tuveri <nic.tuv@gmail.com>
Co-authored-by: Billy Brumley <bbrumley@gmail.com>
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6501)
Diffstat (limited to 'crypto/ec/ecp_mont.c')
-rw-r--r-- | crypto/ec/ecp_mont.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ec/ecp_mont.c b/crypto/ec/ecp_mont.c index 1a760d1239..27ece3b43c 100644 --- a/crypto/ec/ecp_mont.c +++ b/crypto/ec/ecp_mont.c @@ -61,7 +61,9 @@ const EC_METHOD *EC_GFp_mont_method(void) ec_key_simple_generate_public_key, 0, /* keycopy */ 0, /* keyfinish */ - ecdh_simple_compute_key + ecdh_simple_compute_key, + 0, /* field_inverse_mod_ord */ + ec_GFp_simple_blind_coordinates }; return &ret; |