From 707027e8135f04290a6714afb72653be05499509 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 13 Nov 2015 00:19:12 -0800 Subject: [PATCH] Make the sha1 interface also work for std::vector. --- ldid.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ldid.cpp b/ldid.cpp index c0fde4c..a95c897 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -798,6 +798,11 @@ static void sha1(uint8_t *hash, const void *data, size_t size) { LDID_SHA1(static_cast(data), size, hash); } +static void sha1(std::vector &hash, const void *data, size_t size) { + hash.resize(LDID_SHA1_DIGEST_LENGTH); + sha1(reinterpret_cast(hash.data()), data, size); +} + struct CodesignAllocation { FatMachHeader mach_header_; uint32_t offset_; @@ -2051,9 +2056,7 @@ int main(int argc, char *argv[]) { char *arge; unsigned number(strtoul(slot, &arge, 0)); _assert(arge == colon); - std::vector &hash(slots[number]); - hash.resize(LDID_SHA1_DIGEST_LENGTH); - sha1(reinterpret_cast(hash.data()), file.data(), file.size()); + sha1(slots[number], file.data(), file.size()); } break; case 'D': flag_D = true; break; -- 2.45.2