Skip to content

Commit

Permalink
raise when EC_POINT_cmp or EC_GROUP_cmp error instead of returning true
Browse files Browse the repository at this point in the history
  • Loading branch information
bannable committed Nov 23, 2022
1 parent de8a644 commit e1e8f3c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ext/openssl/ossl_pkey_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,11 @@ static VALUE ossl_ec_group_eql(VALUE a, VALUE b)
GetECGroup(a, group1);
GetECGroup(b, group2);

if (EC_GROUP_cmp(group1, group2, ossl_bn_ctx) == 1)
return Qfalse;

return Qtrue;
switch (EC_GROUP_cmp(group1, group2, ossl_bn_ctx)) {
case 0: return Qtrue;
case 1: return Qfalse;
default: ossl_raise(eEC_GROUP, "EC_GROUP_cmp");
}
}

/*
Expand Down Expand Up @@ -1424,10 +1425,13 @@ static VALUE ossl_ec_point_eql(VALUE a, VALUE b)
GetECPoint(b, point2);
GetECGroup(group_v1, group);

if (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx) == 1)
return Qfalse;
switch (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx)) {
case 0: return Qtrue;
case 1: return Qfalse;
default: ossl_raise(eEC_POINT, "EC_POINT_cmp");
}

return Qtrue;
UNREACHABLE;
}

/*
Expand Down

0 comments on commit e1e8f3c

Please sign in to comment.