From: Justin Brewer Date: Thu, 15 Nov 2018 00:36:56 +0000 (-0600) Subject: Introduce internal storage for entry digests X-Git-Tag: v3.5.0~29^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb888e202e36d45a006a947a3190eb48f50b052a;p=thirdparty%2Flibarchive.git Introduce internal storage for entry digests This commits introduces the basic internal storage for digests. Those will be used to expose a set/get API, which users can utilise for integrity checking. Signed-off-by: Emil Velikov --- diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index a15e98c28..6db1eef7e 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -208,6 +208,19 @@ archive_entry_clone(struct archive_entry *entry) /* Copy encryption status */ entry2->encryption = entry->encryption; + + /* Copy digests */ +#define copy_digest(_e2, _e, _t) \ + memcpy(_e2->digest._t, _e->digest._t, sizeof(_e2->digest._t)) + + copy_digest(entry2, entry, md5); + copy_digest(entry2, entry, rmd160); + copy_digest(entry2, entry, sha1); + copy_digest(entry2, entry, sha256); + copy_digest(entry2, entry, sha384); + copy_digest(entry2, entry, sha512); + +#undef copy_digest /* Copy ACL data over. */ archive_acl_copy(&entry2->acl, &entry->acl); diff --git a/libarchive/archive_entry_private.h b/libarchive/archive_entry_private.h index a66804aa0..abd89b591 100644 --- a/libarchive/archive_entry_private.h +++ b/libarchive/archive_entry_private.h @@ -171,6 +171,9 @@ struct archive_entry { void *mac_metadata; size_t mac_metadata_size; + /* Digest support. */ + struct ae_digest digest; + /* ACL support. */ struct archive_acl acl;