summaryrefslogtreecommitdiff
path: root/src/crypto/fipsmodule/ec/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/fipsmodule/ec/ec.c')
-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;
}