summaryrefslogtreecommitdiffstats
path: root/applypatch
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-04-24 20:42:37 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-04-24 20:42:37 +0200
commit4388c792422264660fab5e28d0e5216989674abd (patch)
tree9267b20d03ce80aa9bd0ac58eaf7666f47fee0a1 /applypatch
parentMerge "update_verifier: Move to Soong." am: ed022fccdf (diff)
parentMerge "Dump debug information for apply_patch unit tests" (diff)
downloadandroid_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar.gz
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar.bz2
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar.lz
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar.xz
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.tar.zst
android_bootable_recovery-4388c792422264660fab5e28d0e5216989674abd.zip
Diffstat (limited to 'applypatch')
-rw-r--r--applypatch/applypatch.cpp5
-rw-r--r--applypatch/imgpatch.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 7104abd67..db7530be9 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -630,6 +630,11 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
SHA_CTX ctx;
SHA1_Init(&ctx);
SinkFn sink = [&memory_sink_str, &ctx](const unsigned char* data, size_t len) {
+ if (len != 0) {
+ uint8_t digest[SHA_DIGEST_LENGTH];
+ SHA1(data, len, digest);
+ LOG(DEBUG) << "Appending " << len << " bytes data, sha1: " << short_sha1(digest);
+ }
SHA1_Update(&ctx, data, len);
memory_sink_str.append(reinterpret_cast<const char*>(data), len);
return len;
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index 2e4faaadf..9794a4878 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -182,6 +182,8 @@ int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const Value&
printf("Failed to apply bsdiff patch.\n");
return -1;
}
+
+ LOG(DEBUG) << "Processed chunk type normal";
} else if (type == CHUNK_RAW) {
const char* raw_header = patch_header + pos;
pos += 4;
@@ -201,6 +203,8 @@ int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const Value&
return -1;
}
pos += data_len;
+
+ LOG(DEBUG) << "Processed chunk type raw";
} else if (type == CHUNK_DEFLATE) {
// deflate chunks have an additional 60 bytes in their chunk header.
const char* deflate_header = patch_header + pos;
@@ -276,6 +280,7 @@ int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const Value&
return -1;
}
+ LOG(DEBUG) << "Processed chunk type deflate";
} else {
printf("patch chunk %d is unknown type %d\n", i, type);
return -1;