]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Introduce internal storage for entry digests
authorJustin Brewer <jzb0012@auburn.edu>
Thu, 15 Nov 2018 00:36:56 +0000 (18:36 -0600)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 13 Mar 2020 19:05:59 +0000 (19:05 +0000)
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 <emil.l.velikov@gmail.com>
libarchive/archive_entry.c
libarchive/archive_entry_private.h

index a15e98c284256dff04de082982d4ea1c41eeef65..6db1eef7e12af13846c3b51feb9b64be653f7ff0 100644 (file)
@@ -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);
index a66804aa0080c29d67bfa6d3ed74b2772050bd76..abd89b591ecb0a87d5dbbdba7adec0f06467f9d5 100644 (file)
@@ -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;