Skip to content

Commit

Permalink
More span
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Nov 11, 2023
1 parent 879c4c5 commit 002f356
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion include/LIEF/MachO/VersionMin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class LIEF_API VersionMin : public LoadCommand {
const version_t& sdk() const;
void sdk(const version_t& sdk);


void accept(Visitor& visitor) const override;

std::ostream& print(std::ostream& os) const override;
Expand Down
3 changes: 2 additions & 1 deletion include/LIEF/PE/signature/attributes/GenericType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "LIEF/visibility.h"
#include "LIEF/errors.hpp"
#include "LIEF/span.hpp"
#include "LIEF/PE/signature/Attribute.hpp"
#include "LIEF/PE/signature/types.hpp"

Expand Down Expand Up @@ -51,7 +52,7 @@ class LIEF_API GenericType : public Attribute {
}

//! Original DER blob of the attribute
const std::vector<uint8_t>& raw_content() const {
span<const uint8_t> raw_content() const {
return raw_;
}

Expand Down
3 changes: 2 additions & 1 deletion include/LIEF/PE/signature/attributes/PKCS9MessageDigest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "LIEF/visibility.h"
#include "LIEF/errors.hpp"
#include "LIEF/PE/signature/Attribute.hpp"
#include "LIEF/span.hpp"

#include <vector>

Expand Down Expand Up @@ -58,7 +59,7 @@ class LIEF_API PKCS9MessageDigest : public Attribute {
std::unique_ptr<Attribute> clone() const override;

//! Message digeset as a blob of bytes as described in the RFC
const std::vector<uint8_t>& digest() const {
span<const uint8_t> digest() const {
return digest_;
}

Expand Down
4 changes: 2 additions & 2 deletions src/PE/signature/Signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Signature::VERIFICATION_FLAGS verify_ts_counter_signature(const SignerInfo& sign
LIEF_WARN("Missing MessageDigest in authenticated attributes in the counter signature's signer");
return flags | Signature::VERIFICATION_FLAGS::INVALID_SIGNER;
}
const std::vector<uint8_t>& dg_value = message_dg->digest();
const std::vector<uint8_t>& dg_value = as_vector(message_dg->digest());
const std::vector<uint8_t> dg_cs_hash = Signature::hash(signer.encrypted_digest(), cs_digest_algo);
if (dg_value != dg_cs_hash) {
LIEF_WARN("MessageDigest mismatch with Hash(signer ED)");
Expand Down Expand Up @@ -358,7 +358,7 @@ Signature::VERIFICATION_FLAGS Signature::check(VERIFICATION_CHECKS checks) const

const auto& digest_attr = reinterpret_cast<const PKCS9MessageDigest&>(*it_pkcs9_digest);
LIEF_DEBUG("pkcs9-message-digest:\n {}\n {}", hex_dump(digest_attr.digest()), hex_dump(content_info_hash));
if (digest_attr.digest() != content_info_hash) {
if (as_vector(digest_attr.digest()) != content_info_hash) {
return flags | VERIFICATION_FLAGS::BAD_DIGEST;
}
} else {
Expand Down

0 comments on commit 002f356

Please sign in to comment.