summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-03-08 08:20:40 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-03-08 08:20:40 +0000
commit56d1eefe06387416d044caca6b6a175295b23e88 (patch)
tree8537e9a3df821cc8aa2d0c56e6f928fa32f1ac62
parentadcb5bbefa94dce9725f7ae186215691dbbb36c7 (diff)
parent3ef76b39e2b1b3ce091b518cb4f4b9f7a9d3abeb (diff)
downloadboringssl-56d1eefe06387416d044caca6b6a175295b23e88.tar.gz
Snap for 4641295 from 3ef76b39e2b1b3ce091b518cb4f4b9f7a9d3abeb to pi-release
Change-Id: I38be7922ad0ef75a99cca8c566e98ccce01c960b
-rw-r--r--src/crypto/fipsmodule/ec/ec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/crypto/fipsmodule/ec/ec.c b/src/crypto/fipsmodule/ec/ec.c
index 616df162..e45a7e34 100644
--- a/src/crypto/fipsmodule/ec/ec.c
+++ b/src/crypto/fipsmodule/ec/ec.c
@@ -768,7 +768,13 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
if (!EC_POINT_is_on_curve(group, point, ctx)) {
// In the event of an error, defend against the caller not checking the
// return value by setting a known safe value: the base point.
- EC_POINT_copy(point, EC_GROUP_get0_generator(group));
+ const EC_POINT *generator = EC_GROUP_get0_generator(group);
+ // The generator can be missing if the caller is in the process of
+ // constructing an arbitrary group. In this, we give up and hope they're
+ // checking the return value.
+ if (generator) {
+ EC_POINT_copy(point, generator);
+ }
OPENSSL_PUT_ERROR(EC, EC_R_POINT_IS_NOT_ON_CURVE);
return 0;
}