]> git.cameronkatri.com Git - ldid.git/blobdiff - ldid.cpp
Fix CDHash in -h
[ldid.git] / ldid.cpp
index 1f20275d368b5ba27d788e4d9e7d28497fbacc4c..1703da026ef65d06dc2f1e8c4e77228a1540f979 100644 (file)
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -3577,7 +3577,7 @@ int main(int argc, char *argv[]) {
                         auto &algorithm(*algorithms[type - 1]);
                         uint8_t hash[algorithm.size_];
                         algorithm(hash, blob + begin, end - begin);
-                        candidates.insert({type, {directory, end - begin, algorithm, Hex(hash, 20), begin}});
+                        candidates.insert({type, {directory, end - begin, algorithm, Hex(hash, algorithm.size_), begin}});
                     } else if (type == CSSLOT_SIGNATURESLOT) {
                         cmsBegin = Swap(super->index[index].offset);
                         cmsEnd = index + 1 == Swap(super->count) ? Swap(super->blob.length) : Swap(super->index[index + 1].offset);
@@ -3622,11 +3622,12 @@ int main(int argc, char *argv[]) {
                     auto choice(candidate.second.algorithm_.name());
                     choices += ',';
                     choices += choice;
-                    printf("CandidateCDHash %s=%s\n", choice, candidate.second.hash_.c_str());
+                    printf("CandidateCDHash %s=%.40s\n", choice, candidate.second.hash_.c_str());
+                    printf("CandidateCDHashFull %s=%s\n", choice, candidate.second.hash_.c_str());
                 }
                 printf("Hash choices=%s\n", choices.c_str() + 1);
 
-                printf("CDHash=%s\n", best->second.hash_.c_str());
+                printf("CDHash=%.40s\n", best->second.hash_.c_str());
 
                 if (cmsBegin != 0 && cmsEnd != 0) {
                     // This loads the CMS blob and parses each X509 cert in the blob to extract the