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 19, 2022
1 parent 1ddbf28 commit 3ed6fb8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ext/openssl/ossl_pkey_ec.c
Expand Up @@ -668,10 +668,13 @@ 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;
switch (EC_GROUP_cmp(group1, group2, ossl_bn_ctx)) {
case 0: return Qtrue;
case 1: return Qfalse;
default: ossl_raise(cEC_POINT, "EC_GROUP_cmp");
}

return Qtrue;
UNREACHABLE;
}

/*
Expand Down Expand Up @@ -1232,10 +1235,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(cEC_POINT, "EC_POINT_cmp");
}

return Qtrue;
UNREACHABLE;
}

/*
Expand Down

0 comments on commit 3ed6fb8

Please sign in to comment.