From 9a0c036a03464a757d5be8178a4f7f39685105ec Mon Sep 17 00:00:00 2001 From: Greg Hewett Date: Mon, 31 Jul 2023 17:09:19 -0500 Subject: [PATCH] updated function to something more meaningful --- lib/hpke/src/group.cpp | 16 ++++++++-------- lib/hpke/src/group.h | 8 ++++---- lib/hpke/src/signature.cpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/hpke/src/group.cpp b/lib/hpke/src/group.cpp index 47dc441e..ff1802d0 100644 --- a/lib/hpke/src/group.cpp +++ b/lib/hpke/src/group.cpp @@ -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()); @@ -610,7 +610,7 @@ struct ECKeyGroup : public EVPGroup } // EC Key - std::unique_ptr set_coordinates( + std::unique_ptr get_public_key_from_coordinates( const bytes& x, const bytes& y) const override { @@ -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(pk); auto raw = bytes(pk_size); @@ -824,7 +824,7 @@ struct RawKeyGroup : public EVPGroup } // Raw Key - std::unique_ptr set_coordinates( + std::unique_ptr get_public_key_from_coordinates( const bytes& x, const bytes& /*unused*/) const override { diff --git a/lib/hpke/src/group.h b/lib/hpke/src/group.h index efb33245..0e6016bb 100644 --- a/lib/hpke/src/group.h +++ b/lib/hpke/src/group.h @@ -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 set_coordinates( + virtual void get_coordinates_from_public_key(const Group::PublicKey& pk, + bytes& x, + bytes& y) const = 0; + virtual std::unique_ptr get_public_key_from_coordinates( const bytes& x, const bytes& y) const = 0; diff --git a/lib/hpke/src/signature.cpp b/lib/hpke/src/signature.cpp index 78b7d580..3fa993f8 100644 --- a/lib/hpke/src/signature.cpp +++ b/lib/hpke/src/signature.cpp @@ -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 @@ -162,7 +162,7 @@ struct GroupSignature : public Signature std::unique_ptr pk = deserialize(enc); const auto& rpk = dynamic_cast(*(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); @@ -188,7 +188,7 @@ struct GroupSignature : public Signature const auto priv = group.deserialize_private(enc); const auto& rpk = dynamic_cast(*(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);