summaryrefslogtreecommitdiff
path: root/utils/imxtools/sbtools/rsrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools/sbtools/rsrc.c')
-rw-r--r--utils/imxtools/sbtools/rsrc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/utils/imxtools/sbtools/rsrc.c b/utils/imxtools/sbtools/rsrc.c
index 1d20c5fce8..49d2158483 100644
--- a/utils/imxtools/sbtools/rsrc.c
+++ b/utils/imxtools/sbtools/rsrc.c
@@ -26,6 +26,10 @@
26#include "crypto.h" 26#include "crypto.h"
27#include "rsrc.h" 27#include "rsrc.h"
28 28
29#ifndef MIN
30#define MIN(a,b) ((a) < (b) ? (a) : (b))
31#endif
32
29const char crypto_key[16] = "SanDiskSlotRadi"; 33const char crypto_key[16] = "SanDiskSlotRadi";
30 34
31static void rsrc_crypt(void *buf, int size) 35static void rsrc_crypt(void *buf, int size)
@@ -144,9 +148,19 @@ static bool read_entries(struct rsrc_file_t *f, void *u,
144 148
145 augment_array_ex((void **)&f->entries, sizeof(ent), &f->nr_entries, &f->capacity, &ent, 1); 149 augment_array_ex((void **)&f->entries, sizeof(ent), &f->nr_entries, &f->capacity, &ent, 1);
146 150
147 printf(OFF, "%s+-%s%#08x %s[%s]%s[size=%#x]\n", prefix, YELLOW, index, BLUE, 151 printf(OFF, "%s+-%s%#08x %s[%s]%s[size=%#x]", prefix, YELLOW, index, BLUE,
148 rsrc_table_entry_type_str(RSRC_TABLE_ENTRY_TYPE(te)), 152 rsrc_table_entry_type_str(RSRC_TABLE_ENTRY_TYPE(te)),
149 GREEN, sz); 153 GREEN, sz);
154
155 if(RSRC_TABLE_ENTRY_TYPE(te) != RSRC_TYPE_VALUE &&
156 RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED)
157 {
158 uint8_t *p = f->data + ent.offset;
159 printf(OFF, " ");
160 for(int i = 0; i < MIN(sz, 16); i++)
161 printf(RED, "%c", isprint(p[i]) ? p[i] : '.');
162 }
163 printf(OFF, "\n");
150 164
151 if(RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED) 165 if(RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED)
152 { 166 {