openpgp: fix gcc 5.4.0 compilation

This commit is contained in:
xiphon 2020-06-04 01:18:34 +00:00
parent 8354c251c5
commit 1e7d8293cb
2 changed files with 7 additions and 7 deletions

View file

@ -48,10 +48,10 @@ public:
hash &operator=(const hash &) = delete; hash &operator=(const hash &) = delete;
hash(uint8_t algorithm) hash(uint8_t algorithm)
: algorithm(algorithm) : algo(algorithm)
, consumed(0) , consumed(0)
{ {
if (gcry_md_open(&md, algorithm, 0) != GPG_ERR_NO_ERROR) if (gcry_md_open(&md, algo, 0) != GPG_ERR_NO_ERROR)
{ {
throw std::runtime_error("failed to create message digest object"); throw std::runtime_error("failed to create message digest object");
} }
@ -83,8 +83,8 @@ public:
std::vector<uint8_t> finish() const std::vector<uint8_t> finish() const
{ {
std::vector<uint8_t> result(gcry_md_get_algo_dlen(algorithm)); std::vector<uint8_t> result(gcry_md_get_algo_dlen(algo));
const void *digest = gcry_md_read(md, algorithm); const void *digest = gcry_md_read(md, algo);
if (digest == nullptr) if (digest == nullptr)
{ {
throw std::runtime_error("failed to read the digest"); throw std::runtime_error("failed to read the digest");
@ -99,7 +99,7 @@ public:
} }
private: private:
const uint8_t algorithm; const uint8_t algo;
gcry_md_hd_t md; gcry_md_hd_t md;
size_t consumed; size_t consumed;
}; };

View file

@ -139,7 +139,7 @@ public_key_block::public_key_block(const epee::span<const uint8_t> buffer)
/* const auto timestamp = */ serialized.read_big_endian<uint32_t>(); /* const auto timestamp = */ serialized.read_big_endian<uint32_t>();
const auto algorithm = serialized.read_big_endian<uint8_t>(); const auto algorithm = serialized.read_big_endian<uint8_t>();
if (algorithm != algorithm::rsa) if (algorithm != openpgp::algorithm::rsa)
{ {
throw std::runtime_error("unsupported public key algorithm"); throw std::runtime_error("unsupported public key algorithm");
} }
@ -219,7 +219,7 @@ signature_rsa signature_rsa::from_buffer(const epee::span<const uint8_t> input)
const auto signature_type = static_cast<type>(buffer.read_big_endian<uint8_t>()); const auto signature_type = static_cast<type>(buffer.read_big_endian<uint8_t>());
const auto algorithm = buffer.read_big_endian<uint8_t>(); const auto algorithm = buffer.read_big_endian<uint8_t>();
if (algorithm != algorithm::rsa) if (algorithm != openpgp::algorithm::rsa)
{ {
throw std::runtime_error("unsupported signature algorithm"); throw std::runtime_error("unsupported signature algorithm");
} }