RT 4242: reject invalid EC point coordinates
authorEmilia Kasper <emilia@openssl.org>
Fri, 3 Jun 2016 12:42:04 +0000 (14:42 +0200)
committerMatt Caswell <matt@openssl.org>
Thu, 25 Apr 2019 12:09:22 +0000 (13:09 +0100)
commitcea83f9f7825309379db3fea77f19edf0c5b1e13
tree33e1e6638dfc9f7238f8dbcb4d70b67ff9db30a6
parentf937540ec40a5e838460b8f19d2eb722529126b8
RT 4242: reject invalid EC point coordinates

This is a backport of commit 1e2012b7 to 1.0.2. This hardening change
was made to 1.1.0 but was not backported to 1.0.2. Recent CVEs in user
applications have shown this additional hardening in 1.0.2 would be
beneficial.

E.g. see the patch for CVE-2019-9498
https://w1.fi/security/2019-4/0011-EAP-pwd-server-Verify-received-scalar-and-element.patch

and CVE-2019-9499
https://w1.fi/security/2019-4/0013-EAP-pwd-client-Verify-received-scalar-and-element.patch

The original commit had this description:

We already test in EC_POINT_oct2point that points are on the curve. To
be on the safe side, move this check to
EC_POINT_set_affine_coordinates_* so as to also check point coordinates
received through some other method.

We do not check projective coordinates, though, as
- it's unlikely that applications would be receiving this primarily
  internal representation from untrusted sources, and
- it's possible that the projective setters are used in a setting where
  performance matters.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8750)
crypto/ec/ec2_oct.c
crypto/ec/ec_lib.c
crypto/ec/ecp_oct.c
crypto/ec/ectest.c