summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshirsh-kumar <shirsh.kumar@samsung.com>2019-10-18 15:10:21 +0530
committerJeon Sang-Heon <sh95.jeon@samsung.com>2019-10-25 10:40:25 +0900
commit1c3e69f4143a6416e8d14bed8b110abc6f955571 (patch)
tree2ace5934abe855359651a614bb8f0fe5e9ee0a82
parent610db4b5992376b72d5ab50d0556ad7231eaa5a8 (diff)
downloadlibtota-1c3e69f4143a6416e8d14bed8b110abc6f955571.tar.gz
libtota-1c3e69f4143a6416e8d14bed8b110abc6f955571.tar.bz2
libtota-1c3e69f4143a6416e8d14bed8b110abc6f955571.zip
Change format of log output in case of error for SHA
Change-Id: I25cefb5a3f42743e2bfd4fffc04a35dde85e6707 Signed-off-by: shirsh-kumar <shirsh.kumar@samsung.com>
-rwxr-xr-xss_engine/SS_UPI.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/ss_engine/SS_UPI.c b/ss_engine/SS_UPI.c
index 745c0c8..cbfac8f 100755
--- a/ss_engine/SS_UPI.c
+++ b/ss_engine/SS_UPI.c
@@ -94,7 +94,13 @@ int SS_Do_Memory_Profiling()
}
}
#endif
-
+static void hex_digest(char * sha1, char *buffer, int size)
+{
+ int i = 0;
+ for ( i = 0; i < size; i++){
+ snprintf(&buffer[i * 2], (size * 2) - (i * 2) + 1, "%02x", sha1[i]);
+ }
+}
#ifdef TIME_PROFILING
static char ts1[256];
static double ts2;
@@ -365,7 +371,9 @@ int SS_verify_DELTA_image(char *filename)
goto Cleanup;
if (memcmp(file.sha1, target_sha1, SHA_DIGEST_SIZE) != 0) {
- LOGE("SHA mismatch -[%s] actual [%x] target [%x]\n", filename, file.sha1, target_sha1);
+ unsigned char actualShaBuffer[41] = { 0, };
+ hex_digest(file.sha1, actualShaBuffer, SHA_DIGEST_SIZE);
+ LOGE("SHA mismatch -[%s] actual [%s] target [%s]\n", filename, actualShaBuffer, sha1trg);
SS_SetUpgradeState(E_SS_FSBADDELTA);
ulResult = E_SS_FAILURE;
goto Cleanup;
@@ -566,8 +574,10 @@ int SS_FSVerifyNode(const char *path, const char *patchname, const char *sha1src
if (SS_LoadFile(path, &source_file) == 0) {
if (memcmp(source_file.sha1, source_sha1, SHA_DIGEST_SIZE) != 0) {
SS_Free(source_file.data);
- LOGE("SS_FSVerifyNode - SHA mismatch with SRC - PATH [%s] Expected [%x] Actual [%x]\n",
- path, source_sha1, source_file.sha1);
+ unsigned char actualShaBuffer[41] = { 0, };
+ hex_digest(source_file.sha1, actualShaBuffer, SHA_DIGEST_SIZE);
+ LOGE("SS_FSVerifyNode - SHA mismatch with SRC - PATH [%s] Expected [%s] Actual [%s]\n",
+ path, sha1src, actualShaBuffer);
SS_SetUpgradeState(E_SS_FSSRCCURRUPTED); // Define other error
return E_SS_FAILURE;
}
@@ -2262,8 +2272,10 @@ int SS_IMGVerfiyPartition(ua_dataSS_t * ua_dataSS)
LOGL(LOG_SSENGINE, "SS_IMGVerfiyPartition - SHA matches with source [%s] \n",
ua_dataSS->parti_info->ua_blk_name);
} else { // Need not compare with Target sha as once upgraded, it should NOT verify same partition again.
- LOGE("SS_IMGVerfiyPartition - SHA mismatch with SRC [%s] Expected [%x] Actual [%x]\n",
- ua_dataSS->parti_info->ua_blk_name, source_sha1, source_file.sha1);
+ unsigned char actualShaBuffer[41] = { 0, };
+ hex_digest(source_file.sha1, actualShaBuffer, SHA_DIGEST_SIZE);
+ LOGE("SS_IMGVerfiyPartition - SHA mismatch with SRC [%s] Expected [%s] Actual [%s]\n",
+ ua_dataSS->parti_info->ua_blk_name, ua_dataSS->update_cfg->soure_sha1, actualShaBuffer);
SS_SetUpgradeState(E_SS_IMGSRCCURRUPTED);
ulResult = E_SS_FAILURE;
}