diff options
Diffstat (limited to 'utils/imxtools/sbtools/sb.c')
-rw-r--r-- | utils/imxtools/sbtools/sb.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/utils/imxtools/sbtools/sb.c b/utils/imxtools/sbtools/sb.c index ff8e0da3ee..cbeacf9c3f 100644 --- a/utils/imxtools/sbtools/sb.c +++ b/utils/imxtools/sbtools/sb.c | |||
@@ -802,7 +802,11 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo | |||
802 | if(memcmp(hdr_sha1, computed_sha1, 20) == 0) | 802 | if(memcmp(hdr_sha1, computed_sha1, 20) == 0) |
803 | printf(RED, " Ok\n"); | 803 | printf(RED, " Ok\n"); |
804 | else | 804 | else |
805 | { | ||
805 | printf(RED, " Failed\n"); | 806 | printf(RED, " Failed\n"); |
807 | if(!(flags & SB_IGNORE_SHA1)) | ||
808 | fatal(SB_FORMAT_ERROR, "Bad header checksum\n"); | ||
809 | } | ||
806 | printf(GREEN, " Flags: "); | 810 | printf(GREEN, " Flags: "); |
807 | printf(YELLOW, "%x\n", sb_header->flags); | 811 | printf(YELLOW, "%x\n", sb_header->flags); |
808 | printf(GREEN, " Total file size : "); | 812 | printf(GREEN, " Total file size : "); |
@@ -1045,7 +1049,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo | |||
1045 | printf(OFF, "%s", indent); | 1049 | printf(OFF, "%s", indent); |
1046 | uint8_t checksum = instruction_checksum(hdr); | 1050 | uint8_t checksum = instruction_checksum(hdr); |
1047 | if(checksum != hdr->checksum) | 1051 | if(checksum != hdr->checksum) |
1048 | printf(GREY, "[Bad checksum']"); | 1052 | printf(GREY, "[Bad checksum]"); |
1049 | 1053 | ||
1050 | if(hdr->opcode == SB_INST_NOP) | 1054 | if(hdr->opcode == SB_INST_NOP) |
1051 | { | 1055 | { |
@@ -1093,6 +1097,14 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo | |||
1093 | printf(RED, " (Encrypted)"); | 1097 | printf(RED, " (Encrypted)"); |
1094 | printf(OFF, "\n"); | 1098 | printf(OFF, "\n"); |
1095 | 1099 | ||
1100 | /* skip it if we cannot decrypt it */ | ||
1101 | if(encrypted && !valid_key) | ||
1102 | { | ||
1103 | printf(GREY, " Skipping section content (no valid key)\n"); | ||
1104 | offset += size; | ||
1105 | continue; | ||
1106 | } | ||
1107 | |||
1096 | /* save it */ | 1108 | /* save it */ |
1097 | byte *sec = xmalloc(size); | 1109 | byte *sec = xmalloc(size); |
1098 | if(encrypted) | 1110 | if(encrypted) |
@@ -1161,7 +1173,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, unsigned flags, vo | |||
1161 | else if(flags & SB_IGNORE_SHA1) | 1173 | else if(flags & SB_IGNORE_SHA1) |
1162 | { | 1174 | { |
1163 | /* some weird images produced by some buggy tools have wrong SHA-1, | 1175 | /* some weird images produced by some buggy tools have wrong SHA-1, |
1164 | * this probably gone unnoticed because the bootloader ignores the SH1-1 | 1176 | * this probably gone unnoticed because the bootloader ignores the SHA-1 |
1165 | * anyway */ | 1177 | * anyway */ |
1166 | printf(RED, " Failed\n"); | 1178 | printf(RED, " Failed\n"); |
1167 | cprintf(u, true, GREY, "Warning: SHA-1 mismatch ignored per flags\n"); | 1179 | cprintf(u, true, GREY, "Warning: SHA-1 mismatch ignored per flags\n"); |