summaryrefslogtreecommitdiff
path: root/methods/gpgv.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2025-01-14 08:26:23 +0000
committerJulian Andres Klode <jak@debian.org>2025-01-14 08:26:23 +0000
commitce452d40f499fa56f6ddc15e8871b1262d4e1418 (patch)
treecca88ab8b56520eec386921aa51906d7bdf4f385 /methods/gpgv.cc
parentf9a59225c3b1e025ad93116773cc7825621809c8 (diff)
parentaa4c681f09f06359c0892329b9e39da77e4f9fda (diff)
Merge branch 'fix/cleanup' into 'main'
Drop unused and obsolete macros as well as documentation See merge request apt-team/apt!428
Diffstat (limited to 'methods/gpgv.cc')
-rw-r--r--methods/gpgv.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index e5554b1e2..1a6356dee 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -68,7 +68,7 @@ struct Digest {
}
};
-static constexpr Digest Digests[] = {
+static constexpr std::array<Digest,12> Digests = {{
{Digest::State::Untrusted, "Invalid digest"},
{Digest::State::Untrusted, "MD5"},
{Digest::State::Untrusted, "SHA1"},
@@ -81,17 +81,14 @@ static constexpr Digest Digests[] = {
{Digest::State::Trusted, "SHA384"},
{Digest::State::Trusted, "SHA512"},
{Digest::State::Trusted, "SHA224"},
-};
+}};
-static Digest FindDigest(std::string const & Digest)
+static Digest FindDigest(std::string const &Digest)
{
int id = atoi(Digest.c_str());
- if (id >= 0 && static_cast<unsigned>(id) < APT_ARRAY_SIZE(Digests))
- {
+ if (id >= 0 && static_cast<unsigned>(id) < Digests.size())
return Digests[id];
- } else {
- return Digests[0];
- }
+ return Digests[0];
}
struct Signer {
@@ -130,7 +127,7 @@ class GPGVMethod : public aptMethod
SignersStorage &Signers);
protected:
- virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE;
+ bool URIAcquire(std::string const &Message, FetchItem *Itm) override;
public:
GPGVMethod() : aptMethod("gpgv", "1.1", SingleInstance | SendConfig | SendURIEncoded){};
};
@@ -214,7 +211,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
FILE *pipein = fdopen(fd[0], "r");
- // Loop over the output of apt-key (which really is gnupg), and check the signatures.
+ // Loop over the output of gpgv, and check the signatures.
std::vector<std::string> ErrSigners;
std::map<std::string, std::vector<std::string>> SubKeyMapping;
size_t buffersize = 0;
@@ -340,7 +337,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
for (auto errSigner : ErrSigners)
Signers.Worthless.push_back({errSigner, ""});
- // apt-key has a --keyid parameter, but this requires gpg, so we call it without it
+ // gpgv has no --keyid parameter, so we call it without it
// and instead check after the fact which keyids where used for verification
if (keyFpts.empty() == false)
{
@@ -565,7 +562,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
keyFpts.emplace_back(std::move(key));
}
- // Run apt-key on file, extract contents and get the key ID of the signer
+ // Run gpgv on file, extract contents and get the key ID of the signer
string const msg = VerifyGetSignersWithLegacy(Path.c_str(), Itm->DestFile.c_str(), keyFpts, keyFiles, Signers);
if (_error->PendingError())
return false;
@@ -660,7 +657,7 @@ bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
Dequeue();
if (DebugEnabled())
- std::clog << "apt-key succeeded\n";
+ std::clog << "gpgv succeeded\n";
return true;
}