diff --git a/src/libaktualizr/uptane/imagesrepository.cc b/src/libaktualizr/uptane/imagesrepository.cc index 5e308229c7..2b743c74e4 100644 --- a/src/libaktualizr/uptane/imagesrepository.cc +++ b/src/libaktualizr/uptane/imagesrepository.cc @@ -65,7 +65,7 @@ bool ImagesRepository::verifySnapshot(const std::string& snapshot_raw) { return true; } -bool ImagesRepository::verifyTargets(const std::string& targets_raw, const Uptane::Role role) { +bool ImagesRepository::verifyTargets(const std::string& targets_raw, const Uptane::Role& role) { try { const Json::Value targets_json = Utils::parseJSON(targets_raw); const std::string canonical = Utils::jsonToCanonicalStr(targets_json); diff --git a/src/libaktualizr/uptane/imagesrepository.h b/src/libaktualizr/uptane/imagesrepository.h index 46a7c8ff03..c23975687d 100644 --- a/src/libaktualizr/uptane/imagesrepository.h +++ b/src/libaktualizr/uptane/imagesrepository.h @@ -14,7 +14,7 @@ class ImagesRepository : public RepositoryCommon { void resetMeta(); - bool verifyTargets(const std::string& targets_raw, Uptane::Role role); + bool verifyTargets(const std::string& targets_raw, const Uptane::Role& role); bool targetsExpired(const std::string& role_name) { return targets[role_name].isExpired(TimeStamp::Now()); } int64_t targetsSize() { return snapshot.targets_size(); } std::set delegations(const std::string& role_name) { return targets[role_name].delegated_role_names_; } diff --git a/src/libaktualizr/uptane/metawithkeys.cc b/src/libaktualizr/uptane/metawithkeys.cc index 1b6c975ac7..f292407d8e 100644 --- a/src/libaktualizr/uptane/metawithkeys.cc +++ b/src/libaktualizr/uptane/metawithkeys.cc @@ -5,7 +5,7 @@ using Uptane::MetaWithKeys; MetaWithKeys::MetaWithKeys(const Json::Value &json) : BaseMeta(json) {} -MetaWithKeys::MetaWithKeys(RepositoryType repo, const Role role, const Json::Value &json, +MetaWithKeys::MetaWithKeys(RepositoryType repo, const Role &role, const Json::Value &json, const std::shared_ptr &signer) : BaseMeta(repo, role, json, signer) {} @@ -55,7 +55,7 @@ void Uptane::MetaWithKeys::ParseRole(const RepositoryType repo, const Json::Valu } } -void Uptane::MetaWithKeys::UnpackSignedObject(const RepositoryType repo, const Role role, +void Uptane::MetaWithKeys::UnpackSignedObject(const RepositoryType repo, const Role &role, const Json::Value &signed_object) { const std::string repository = repo; diff --git a/src/libaktualizr/uptane/root.cc b/src/libaktualizr/uptane/root.cc index 99b71a0eea..d1ca94b59e 100644 --- a/src/libaktualizr/uptane/root.cc +++ b/src/libaktualizr/uptane/root.cc @@ -26,7 +26,7 @@ Root::Root(const RepositoryType repo, const Json::Value &json) : MetaWithKeys(js } } -void Uptane::Root::UnpackSignedObject(const RepositoryType repo, const Role role, const Json::Value &signed_object) { +void Uptane::Root::UnpackSignedObject(const RepositoryType repo, const Role &role, const Json::Value &signed_object) { const std::string repository = repo; if (policy_ == Policy::kAcceptAll) { diff --git a/src/libaktualizr/uptane/tuf.cc b/src/libaktualizr/uptane/tuf.cc index a2b1bead31..4691fc7be0 100644 --- a/src/libaktualizr/uptane/tuf.cc +++ b/src/libaktualizr/uptane/tuf.cc @@ -250,7 +250,7 @@ void Uptane::BaseMeta::init(const Json::Value &json) { } Uptane::BaseMeta::BaseMeta(const Json::Value &json) { init(json); } -Uptane::BaseMeta::BaseMeta(RepositoryType repo, const Role role, const Json::Value &json, +Uptane::BaseMeta::BaseMeta(RepositoryType repo, const Role &role, const Json::Value &json, const std::shared_ptr &signer) { if (!json.isObject() || !json.isMember("signed")) { throw Uptane::InvalidMetadata("", "", "invalid metadata json"); @@ -303,7 +303,7 @@ void Uptane::Targets::init(const Json::Value &json) { Uptane::Targets::Targets(const Json::Value &json) : MetaWithKeys(json) { init(json); } -Uptane::Targets::Targets(RepositoryType repo, const Role role, const Json::Value &json, +Uptane::Targets::Targets(RepositoryType repo, const Role &role, const Json::Value &json, const std::shared_ptr &signer) : MetaWithKeys(repo, role, json, signer), name_(role.ToString()) { init(json); diff --git a/src/libaktualizr/uptane/tuf.h b/src/libaktualizr/uptane/tuf.h index 0d13dd9679..b9bc41ba69 100644 --- a/src/libaktualizr/uptane/tuf.h +++ b/src/libaktualizr/uptane/tuf.h @@ -309,7 +309,7 @@ class BaseMeta { public: BaseMeta() = default; explicit BaseMeta(const Json::Value &json); - BaseMeta(RepositoryType repo, Role role, const Json::Value &json, const std::shared_ptr &signer); + BaseMeta(RepositoryType repo, const Role &role, const Json::Value &json, const std::shared_ptr &signer); int version() const { return version_; } TimeStamp expiry() const { return expiry_; } bool isExpired(const TimeStamp &now) const { return expiry_.IsExpiredAt(now); } @@ -339,7 +339,8 @@ class MetaWithKeys : public BaseMeta { * @param json - The contents of the 'signed' portion */ MetaWithKeys(const Json::Value &json); - MetaWithKeys(RepositoryType repo, Role role, const Json::Value &json, const std::shared_ptr &signer); + MetaWithKeys(RepositoryType repo, const Role &role, const Json::Value &json, + const std::shared_ptr &signer); virtual ~MetaWithKeys() = default; @@ -361,7 +362,7 @@ class MetaWithKeys : public BaseMeta { * @param signed_object * @return */ - virtual void UnpackSignedObject(RepositoryType repo, Role role, const Json::Value &signed_object); + virtual void UnpackSignedObject(RepositoryType repo, const Role &role, const Json::Value &signed_object); bool operator==(const MetaWithKeys &rhs) const { return version_ == rhs.version_ && expiry_ == rhs.expiry_ && keys_ == rhs.keys_ && @@ -407,7 +408,7 @@ class Root : public MetaWithKeys { * @param signed_object * @return */ - void UnpackSignedObject(RepositoryType repo, Role role, const Json::Value &signed_object) override; + void UnpackSignedObject(RepositoryType repo, const Role &role, const Json::Value &signed_object) override; bool operator==(const Root &rhs) const { return version_ == rhs.version_ && expiry_ == rhs.expiry_ && keys_ == rhs.keys_ && @@ -423,7 +424,7 @@ class Root : public MetaWithKeys { class Targets : public MetaWithKeys { public: explicit Targets(const Json::Value &json); - Targets(RepositoryType repo, Role role, const Json::Value &json, const std::shared_ptr &signer); + Targets(RepositoryType repo, const Role &role, const Json::Value &json, const std::shared_ptr &signer); Targets() = default; ~Targets() override = default;