Skip to content

Commit

Permalink
updated function to something more meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Hewett committed Jul 31, 2023
1 parent 121dd13 commit 9a0c036
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions lib/hpke/src/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ struct ECKeyGroup : public EVPGroup
}

// EC Key
void get_coordinates(const Group::PublicKey& pk,
bytes& x,
bytes& y) const override
void get_coordinates_from_public_key(const Group::PublicKey& pk,
bytes& x,
bytes& y) const override
{
auto bnX = make_typed_unique(BN_new());
auto bnY = make_typed_unique(BN_new());
Expand Down Expand Up @@ -610,7 +610,7 @@ struct ECKeyGroup : public EVPGroup
}

// EC Key
std::unique_ptr<Group::PublicKey> set_coordinates(
std::unique_ptr<Group::PublicKey> get_public_key_from_coordinates(
const bytes& x,
const bytes& y) const override
{
Expand Down Expand Up @@ -808,9 +808,9 @@ struct RawKeyGroup : public EVPGroup
}

// Raw Key
void get_coordinates(const Group::PublicKey& pk,
bytes& x,
bytes& /*unused*/) const override
void get_coordinates_from_public_key(const Group::PublicKey& pk,
bytes& x,
bytes& /*unused*/) const override
{
const auto& rpk = dynamic_cast<const PublicKey&>(pk);
auto raw = bytes(pk_size);
Expand All @@ -824,7 +824,7 @@ struct RawKeyGroup : public EVPGroup
}

// Raw Key
std::unique_ptr<Group::PublicKey> set_coordinates(
std::unique_ptr<Group::PublicKey> get_public_key_from_coordinates(
const bytes& x,
const bytes& /*unused*/) const override
{
Expand Down
8 changes: 4 additions & 4 deletions lib/hpke/src/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ struct Group
const bytes& sig,
const PublicKey& pk) const = 0;

virtual void get_coordinates(const Group::PublicKey& pk,
bytes& x,
bytes& y) const = 0;
virtual std::unique_ptr<Group::PublicKey> set_coordinates(
virtual void get_coordinates_from_public_key(const Group::PublicKey& pk,
bytes& x,
bytes& y) const = 0;
virtual std::unique_ptr<Group::PublicKey> get_public_key_from_coordinates(
const bytes& x,
const bytes& y) const = 0;

Expand Down
6 changes: 3 additions & 3 deletions lib/hpke/src/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct GroupSignature : public Signature
if (jwk_json.contains("y")) {
y = from_base64url(jwk_json["y"]);
}
return group.set_coordinates(x, y);
return group.get_public_key_from_coordinates(x, y);
}

std::string export_jwk(const bytes& enc) const override
Expand All @@ -162,7 +162,7 @@ struct GroupSignature : public Signature
std::unique_ptr<hpke::Signature::PublicKey> pk = deserialize(enc);
const auto& rpk =
dynamic_cast<const hpke::Group::PublicKey&>(*(pk.release()));
group.get_coordinates(rpk, x, y);
group.get_coordinates_from_public_key(rpk, x, y);

if (!x.empty()) {
json_jwk["x"] = to_base64url(x);
Expand All @@ -188,7 +188,7 @@ struct GroupSignature : public Signature
const auto priv = group.deserialize_private(enc);
const auto& rpk =
dynamic_cast<const Group::PublicKey&>(*(priv->public_key().release()));
group.get_coordinates(rpk, x, y);
group.get_coordinates_from_public_key(rpk, x, y);

if (!x.empty()) {
json_jwk["x"] = to_base64url(x);
Expand Down

0 comments on commit 9a0c036

Please sign in to comment.