diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-06-15 22:19:52 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-06-15 22:27:34 +0200 |
commit | 7c7fa369186536adaf9ff35ec356525b5c5a8379 (patch) | |
tree | bc70e26ffcc48a7d0a0a40e7c33e0cd48bd265fa /utils/imxtools/sbtools/sb.c | |
parent | 58e27b9fa1e9ea058eb5161f140e0909c4821c92 (diff) | |
download | rockbox-7c7fa369186536adaf9ff35ec356525b5c5a8379.tar.gz rockbox-7c7fa369186536adaf9ff35ec356525b5c5a8379.zip |
sbtools,mkximboot: fix whitespace
Change-Id: I8d8adb783707172d1aaef302366c240310350ed8
Diffstat (limited to 'utils/imxtools/sbtools/sb.c')
-rw-r--r-- | utils/imxtools/sbtools/sb.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/utils/imxtools/sbtools/sb.c b/utils/imxtools/sbtools/sb.c index 2625d770c2..f64da8ff84 100644 --- a/utils/imxtools/sbtools/sb.c +++ b/utils/imxtools/sbtools/sb.c | |||
@@ -63,7 +63,7 @@ static void compute_sb_offsets(struct sb_file_t *sb) | |||
63 | if((i + 1) < sb->nr_sections) | 63 | if((i + 1) < sb->nr_sections) |
64 | alignment = sb->sections[i + 1].alignment; | 64 | alignment = sb->sections[i + 1].alignment; |
65 | alignment /= BLOCK_SIZE; /* alignment in block sizes */ | 65 | alignment /= BLOCK_SIZE; /* alignment in block sizes */ |
66 | 66 | ||
67 | struct sb_section_t *sec = &sb->sections[i]; | 67 | struct sb_section_t *sec = &sb->sections[i]; |
68 | sec->sec_size = 0; | 68 | sec->sec_size = 0; |
69 | 69 | ||
@@ -75,7 +75,7 @@ static void compute_sb_offsets(struct sb_file_t *sb) | |||
75 | printf(" (cleartext)"); | 75 | printf(" (cleartext)"); |
76 | printf("\n"); | 76 | printf("\n"); |
77 | } | 77 | } |
78 | 78 | ||
79 | sec->file_offset = sb->image_size; | 79 | sec->file_offset = sb->image_size; |
80 | for(int j = 0; j < sec->nr_insts; j++) | 80 | for(int j = 0; j < sec->nr_insts; j++) |
81 | { | 81 | { |
@@ -203,7 +203,7 @@ static void fix_version(struct sb_version_t *ver) | |||
203 | static void produce_sb_header(struct sb_file_t *sb, struct sb_header_t *sb_hdr) | 203 | static void produce_sb_header(struct sb_file_t *sb, struct sb_header_t *sb_hdr) |
204 | { | 204 | { |
205 | struct sha_1_params_t sha_1_params; | 205 | struct sha_1_params_t sha_1_params; |
206 | 206 | ||
207 | sb_hdr->signature[0] = 'S'; | 207 | sb_hdr->signature[0] = 'S'; |
208 | sb_hdr->signature[1] = 'T'; | 208 | sb_hdr->signature[1] = 'T'; |
209 | sb_hdr->signature[2] = 'M'; | 209 | sb_hdr->signature[2] = 'M'; |
@@ -227,7 +227,7 @@ static void produce_sb_header(struct sb_file_t *sb, struct sb_header_t *sb_hdr) | |||
227 | * Version 1.1 requires the last 4 bytes to be 'sgtl' */ | 227 | * Version 1.1 requires the last 4 bytes to be 'sgtl' */ |
228 | if(sb->minor_version >= 1) | 228 | if(sb->minor_version >= 1) |
229 | memcpy(&sb_hdr->rand_pad0[2], "sgtl", 4); | 229 | memcpy(&sb_hdr->rand_pad0[2], "sgtl", 4); |
230 | 230 | ||
231 | sb_hdr->timestamp = generate_timestamp(); | 231 | sb_hdr->timestamp = generate_timestamp(); |
232 | sb_hdr->product_ver = sb->product_ver; | 232 | sb_hdr->product_ver = sb->product_ver; |
233 | fix_version(&sb_hdr->product_ver); | 233 | fix_version(&sb_hdr->product_ver); |
@@ -333,17 +333,17 @@ enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename) | |||
333 | byte *buf = xmalloc(sb_hdr.image_size * BLOCK_SIZE); | 333 | byte *buf = xmalloc(sb_hdr.image_size * BLOCK_SIZE); |
334 | byte *buf_p = buf; | 334 | byte *buf_p = buf; |
335 | #define write(p, sz) do { memcpy(buf_p, p, sz); buf_p += sz; } while(0) | 335 | #define write(p, sz) do { memcpy(buf_p, p, sz); buf_p += sz; } while(0) |
336 | 336 | ||
337 | sha_1_update(&file_sha1, (byte *)&sb_hdr, sizeof(sb_hdr)); | 337 | sha_1_update(&file_sha1, (byte *)&sb_hdr, sizeof(sb_hdr)); |
338 | write(&sb_hdr, sizeof(sb_hdr)); | 338 | write(&sb_hdr, sizeof(sb_hdr)); |
339 | 339 | ||
340 | memcpy(crypto_iv, &sb_hdr, 16); | 340 | memcpy(crypto_iv, &sb_hdr, 16); |
341 | 341 | ||
342 | /* update CBC-MACs */ | 342 | /* update CBC-MACs */ |
343 | for(int i = 0; i < g_nr_keys; i++) | 343 | for(int i = 0; i < g_nr_keys; i++) |
344 | crypto_cbc((byte *)&sb_hdr, NULL, sizeof(sb_hdr) / BLOCK_SIZE, &g_key_array[i], | 344 | crypto_cbc((byte *)&sb_hdr, NULL, sizeof(sb_hdr) / BLOCK_SIZE, &g_key_array[i], |
345 | cbc_macs[i], &cbc_macs[i], 1); | 345 | cbc_macs[i], &cbc_macs[i], 1); |
346 | 346 | ||
347 | /* produce and write section headers */ | 347 | /* produce and write section headers */ |
348 | for(int i = 0; i < sb_hdr.nr_sections; i++) | 348 | for(int i = 0; i < sb_hdr.nr_sections; i++) |
349 | { | 349 | { |
@@ -363,7 +363,7 @@ enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename) | |||
363 | memcpy(entry.hdr_cbc_mac, cbc_macs[i], 16); | 363 | memcpy(entry.hdr_cbc_mac, cbc_macs[i], 16); |
364 | crypto_cbc(real_key.u.key, entry.key, 1, &g_key_array[i], | 364 | crypto_cbc(real_key.u.key, entry.key, 1, &g_key_array[i], |
365 | crypto_iv, NULL, 1); | 365 | crypto_iv, NULL, 1); |
366 | 366 | ||
367 | write(&entry, sizeof(entry)); | 367 | write(&entry, sizeof(entry)); |
368 | sha_1_update(&file_sha1, (byte *)&entry, sizeof(entry)); | 368 | sha_1_update(&file_sha1, (byte *)&entry, sizeof(entry)); |
369 | } | 369 | } |
@@ -447,7 +447,7 @@ enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename) | |||
447 | printf("SB image buffer was not entirely filled !"); | 447 | printf("SB image buffer was not entirely filled !"); |
448 | return SB_ERROR; | 448 | return SB_ERROR; |
449 | } | 449 | } |
450 | 450 | ||
451 | FILE *fd = fopen(filename, "wb"); | 451 | FILE *fd = fopen(filename, "wb"); |
452 | if(fd == NULL) | 452 | if(fd == NULL) |
453 | return SB_OPEN_ERROR; | 453 | return SB_OPEN_ERROR; |
@@ -472,13 +472,13 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
472 | sb_free_section(*sec); \ | 472 | sb_free_section(*sec); \ |
473 | free(sec); \ | 473 | free(sec); \ |
474 | return NULL; } while(0) | 474 | return NULL; } while(0) |
475 | 475 | ||
476 | struct sb_section_t *sec = xmalloc(sizeof(struct sb_section_t)); | 476 | struct sb_section_t *sec = xmalloc(sizeof(struct sb_section_t)); |
477 | memset(sec, 0, sizeof(struct sb_section_t)); | 477 | memset(sec, 0, sizeof(struct sb_section_t)); |
478 | sec->identifier = id; | 478 | sec->identifier = id; |
479 | sec->is_data = data_sec; | 479 | sec->is_data = data_sec; |
480 | sec->sec_size = ROUND_UP(size, BLOCK_SIZE) / BLOCK_SIZE; | 480 | sec->sec_size = ROUND_UP(size, BLOCK_SIZE) / BLOCK_SIZE; |
481 | 481 | ||
482 | if(data_sec) | 482 | if(data_sec) |
483 | { | 483 | { |
484 | sec->nr_insts = 1; | 484 | sec->nr_insts = 1; |
@@ -499,7 +499,7 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
499 | 499 | ||
500 | struct sb_instruction_header_t *hdr = (struct sb_instruction_header_t *)&buf[pos]; | 500 | struct sb_instruction_header_t *hdr = (struct sb_instruction_header_t *)&buf[pos]; |
501 | inst.inst = hdr->opcode; | 501 | inst.inst = hdr->opcode; |
502 | 502 | ||
503 | printf(OFF, "%s", indent); | 503 | printf(OFF, "%s", indent); |
504 | uint8_t checksum = instruction_checksum(hdr); | 504 | uint8_t checksum = instruction_checksum(hdr); |
505 | if(checksum != hdr->checksum) | 505 | if(checksum != hdr->checksum) |
@@ -516,7 +516,7 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
516 | inst.size = load->len; | 516 | inst.size = load->len; |
517 | inst.addr = load->addr; | 517 | inst.addr = load->addr; |
518 | inst.data = memdup(load + 1, load->len); | 518 | inst.data = memdup(load + 1, load->len); |
519 | 519 | ||
520 | printf(RED, "LOAD"); | 520 | printf(RED, "LOAD"); |
521 | printf(OFF, " | "); | 521 | printf(OFF, " | "); |
522 | printf(BLUE, "addr=0x%08x", load->addr); | 522 | printf(BLUE, "addr=0x%08x", load->addr); |
@@ -543,7 +543,7 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
543 | inst.pattern = fill->pattern; | 543 | inst.pattern = fill->pattern; |
544 | inst.size = fill->len; | 544 | inst.size = fill->len; |
545 | inst.addr = fill->addr; | 545 | inst.addr = fill->addr; |
546 | 546 | ||
547 | printf(RED, "FILL"); | 547 | printf(RED, "FILL"); |
548 | printf(OFF, " | "); | 548 | printf(OFF, " | "); |
549 | printf(BLUE, "addr=0x%08x", fill->addr); | 549 | printf(BLUE, "addr=0x%08x", fill->addr); |
@@ -561,7 +561,7 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
561 | struct sb_instruction_call_t *call = (struct sb_instruction_call_t *)&buf[pos]; | 561 | struct sb_instruction_call_t *call = (struct sb_instruction_call_t *)&buf[pos]; |
562 | inst.addr = call->addr; | 562 | inst.addr = call->addr; |
563 | inst.argument = call->arg; | 563 | inst.argument = call->arg; |
564 | 564 | ||
565 | if(is_call) | 565 | if(is_call) |
566 | printf(RED, "CALL"); | 566 | printf(RED, "CALL"); |
567 | else | 567 | else |
@@ -577,11 +577,11 @@ static struct sb_section_t *read_section(bool data_sec, uint32_t id, byte *buf, | |||
577 | { | 577 | { |
578 | struct sb_instruction_mode_t *mode = (struct sb_instruction_mode_t *)hdr; | 578 | struct sb_instruction_mode_t *mode = (struct sb_instruction_mode_t *)hdr; |
579 | inst.argument = mode->mode; | 579 | inst.argument = mode->mode; |
580 | 580 | ||
581 | printf(RED, "MODE"); | 581 | printf(RED, "MODE"); |
582 | printf(OFF, " | "); | 582 | printf(OFF, " | "); |
583 | printf(BLUE, "mod=0x%08x\n", mode->mode); | 583 | printf(BLUE, "mod=0x%08x\n", mode->mode); |
584 | 584 | ||
585 | pos += sizeof(struct sb_instruction_mode_t); | 585 | pos += sizeof(struct sb_instruction_mode_t); |
586 | } | 586 | } |
587 | else if(hdr->opcode == SB_INST_NOP) | 587 | else if(hdr->opcode == SB_INST_NOP) |
@@ -671,7 +671,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
671 | { | 671 | { |
672 | struct sb_file_t *sb_file = NULL; | 672 | struct sb_file_t *sb_file = NULL; |
673 | uint8_t *buf = _buf; | 673 | uint8_t *buf = _buf; |
674 | 674 | ||
675 | #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) | 675 | #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) |
676 | #define fatal(e, ...) \ | 676 | #define fatal(e, ...) \ |
677 | do { if(err) *err = e; \ | 677 | do { if(err) *err = e; \ |
@@ -680,7 +680,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
680 | return NULL; } while(0) | 680 | return NULL; } while(0) |
681 | #define print_hex(c, p, len, nl) \ | 681 | #define print_hex(c, p, len, nl) \ |
682 | do { printf(c, ""); print_hex(p, len, nl); } while(0) | 682 | do { printf(c, ""); print_hex(p, len, nl); } while(0) |
683 | 683 | ||
684 | struct sha_1_params_t sha_1_params; | 684 | struct sha_1_params_t sha_1_params; |
685 | sb_file = xmalloc(sizeof(struct sb_file_t)); | 685 | sb_file = xmalloc(sizeof(struct sb_file_t)); |
686 | memset(sb_file, 0, sizeof(struct sb_file_t)); | 686 | memset(sb_file, 0, sizeof(struct sb_file_t)); |
@@ -730,7 +730,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
730 | printf(YELLOW, "%x\n", sb_header->flags); | 730 | printf(YELLOW, "%x\n", sb_header->flags); |
731 | printf(GREEN, " Total file size : "); | 731 | printf(GREEN, " Total file size : "); |
732 | printf(YELLOW, "%ld\n", filesize); | 732 | printf(YELLOW, "%ld\n", filesize); |
733 | 733 | ||
734 | /* Sizes and offsets */ | 734 | /* Sizes and offsets */ |
735 | printf(BLUE, "Sizes and offsets:\n"); | 735 | printf(BLUE, "Sizes and offsets:\n"); |
736 | printf(GREEN, " # of encryption keys = "); | 736 | printf(GREEN, " # of encryption keys = "); |
@@ -745,7 +745,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
745 | print_hex(YELLOW, sb_header->rand_pad0, sizeof(sb_header->rand_pad0), true); | 745 | print_hex(YELLOW, sb_header->rand_pad0, sizeof(sb_header->rand_pad0), true); |
746 | printf(GREEN, " Random 2: "); | 746 | printf(GREEN, " Random 2: "); |
747 | print_hex(YELLOW, sb_header->rand_pad1, sizeof(sb_header->rand_pad1), true); | 747 | print_hex(YELLOW, sb_header->rand_pad1, sizeof(sb_header->rand_pad1), true); |
748 | 748 | ||
749 | uint64_t micros = sb_header->timestamp; | 749 | uint64_t micros = sb_header->timestamp; |
750 | time_t seconds = (micros / (uint64_t)1000000L); | 750 | time_t seconds = (micros / (uint64_t)1000000L); |
751 | struct tm tm_base; | 751 | struct tm tm_base; |
@@ -770,7 +770,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
770 | printf(YELLOW, "%X.%X.%X\n", product_ver.major, product_ver.minor, product_ver.revision); | 770 | printf(YELLOW, "%X.%X.%X\n", product_ver.major, product_ver.minor, product_ver.revision); |
771 | printf(GREEN, " Component version = "); | 771 | printf(GREEN, " Component version = "); |
772 | printf(YELLOW, "%X.%X.%X\n", component_ver.major, component_ver.minor, component_ver.revision); | 772 | printf(YELLOW, "%X.%X.%X\n", component_ver.major, component_ver.minor, component_ver.revision); |
773 | 773 | ||
774 | printf(GREEN, " Drive tag = "); | 774 | printf(GREEN, " Drive tag = "); |
775 | printf(YELLOW, "%x\n", sb_header->drive_tag); | 775 | printf(YELLOW, "%x\n", sb_header->drive_tag); |
776 | printf(GREEN, " First boot tag offset = "); | 776 | printf(GREEN, " First boot tag offset = "); |
@@ -781,7 +781,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
781 | /* encryption cbc-mac */ | 781 | /* encryption cbc-mac */ |
782 | byte real_key[16]; | 782 | byte real_key[16]; |
783 | bool valid_key = false; /* false until a matching key was found */ | 783 | bool valid_key = false; /* false until a matching key was found */ |
784 | 784 | ||
785 | if(sb_header->nr_keys > 0) | 785 | if(sb_header->nr_keys > 0) |
786 | { | 786 | { |
787 | byte (*cbcmacs)[16] = xmalloc(16 * g_nr_keys); | 787 | byte (*cbcmacs)[16] = xmalloc(16 * g_nr_keys); |
@@ -905,14 +905,14 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
905 | { | 905 | { |
906 | uint32_t ofs = sb_header->header_size * BLOCK_SIZE + i * sizeof(struct sb_section_header_t); | 906 | uint32_t ofs = sb_header->header_size * BLOCK_SIZE + i * sizeof(struct sb_section_header_t); |
907 | struct sb_section_header_t *sec_hdr = (struct sb_section_header_t *)&buf[ofs]; | 907 | struct sb_section_header_t *sec_hdr = (struct sb_section_header_t *)&buf[ofs]; |
908 | 908 | ||
909 | char name[5]; | 909 | char name[5]; |
910 | sb_fill_section_name(name, sec_hdr->identifier); | 910 | sb_fill_section_name(name, sec_hdr->identifier); |
911 | int pos = sec_hdr->offset * BLOCK_SIZE; | 911 | int pos = sec_hdr->offset * BLOCK_SIZE; |
912 | int size = sec_hdr->size * BLOCK_SIZE; | 912 | int size = sec_hdr->size * BLOCK_SIZE; |
913 | int data_sec = !(sec_hdr->flags & SECTION_BOOTABLE); | 913 | int data_sec = !(sec_hdr->flags & SECTION_BOOTABLE); |
914 | int encrypted = !(sec_hdr->flags & SECTION_CLEARTEXT) && sb_header->nr_keys > 0; | 914 | int encrypted = !(sec_hdr->flags & SECTION_CLEARTEXT) && sb_header->nr_keys > 0; |
915 | 915 | ||
916 | printf(GREEN, " Section "); | 916 | printf(GREEN, " Section "); |
917 | printf(YELLOW, "'%s'\n", name); | 917 | printf(YELLOW, "'%s'\n", name); |
918 | printf(GREEN, " pos = "); | 918 | printf(GREEN, " pos = "); |
@@ -935,7 +935,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
935 | printf(GREY, " Skipping section content (no valid key)\n"); | 935 | printf(GREY, " Skipping section content (no valid key)\n"); |
936 | continue; | 936 | continue; |
937 | } | 937 | } |
938 | 938 | ||
939 | /* save it */ | 939 | /* save it */ |
940 | byte *sec = xmalloc(size); | 940 | byte *sec = xmalloc(size); |
941 | if(encrypted) | 941 | if(encrypted) |
@@ -954,7 +954,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
954 | } | 954 | } |
955 | else | 955 | else |
956 | fatal(*err, "Error reading section\n"); | 956 | fatal(*err, "Error reading section\n"); |
957 | 957 | ||
958 | free(sec); | 958 | free(sec); |
959 | } | 959 | } |
960 | } | 960 | } |
@@ -979,7 +979,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
979 | uint8_t checksum = instruction_checksum(hdr); | 979 | uint8_t checksum = instruction_checksum(hdr); |
980 | if(checksum != hdr->checksum) | 980 | if(checksum != hdr->checksum) |
981 | printf(GREY, "[Bad checksum']"); | 981 | printf(GREY, "[Bad checksum']"); |
982 | 982 | ||
983 | if(hdr->opcode == SB_INST_NOP) | 983 | if(hdr->opcode == SB_INST_NOP) |
984 | { | 984 | { |
985 | printf(RED, "NOOP\n"); | 985 | printf(RED, "NOOP\n"); |
@@ -1009,7 +1009,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
1009 | int size = tag->len * BLOCK_SIZE; | 1009 | int size = tag->len * BLOCK_SIZE; |
1010 | int data_sec = !(tag->flags & SECTION_BOOTABLE); | 1010 | int data_sec = !(tag->flags & SECTION_BOOTABLE); |
1011 | int encrypted = !(tag->flags & SECTION_CLEARTEXT) && sb_header->nr_keys > 0; | 1011 | int encrypted = !(tag->flags & SECTION_CLEARTEXT) && sb_header->nr_keys > 0; |
1012 | 1012 | ||
1013 | printf(GREEN, "%sSection ", indent); | 1013 | printf(GREEN, "%sSection ", indent); |
1014 | printf(YELLOW, "'%s'\n", name); | 1014 | printf(YELLOW, "'%s'\n", name); |
1015 | printf(GREEN, "%s pos = ", indent); | 1015 | printf(GREEN, "%s pos = ", indent); |
@@ -1032,7 +1032,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
1032 | cbc_mac(buf + pos, sec, size / BLOCK_SIZE, real_key, buf, NULL, 0); | 1032 | cbc_mac(buf + pos, sec, size / BLOCK_SIZE, real_key, buf, NULL, 0); |
1033 | else | 1033 | else |
1034 | memcpy(sec, buf + pos, size); | 1034 | memcpy(sec, buf + pos, size); |
1035 | 1035 | ||
1036 | struct sb_section_t *s = read_section(data_sec, tag->identifier, | 1036 | struct sb_section_t *s = read_section(data_sec, tag->identifier, |
1037 | sec, size, " ", u, cprintf, err); | 1037 | sec, size, " ", u, cprintf, err); |
1038 | if(s) | 1038 | if(s) |
@@ -1064,7 +1064,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
1064 | { | 1064 | { |
1065 | printf(GREY, "Cannot read content in raw mode without a valid key\n"); | 1065 | printf(GREY, "Cannot read content in raw mode without a valid key\n"); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | /* final signature */ | 1068 | /* final signature */ |
1069 | printf(BLUE, "Final signature:\n"); | 1069 | printf(BLUE, "Final signature:\n"); |
1070 | byte decrypted_block[32]; | 1070 | byte decrypted_block[32]; |
@@ -1095,7 +1095,7 @@ struct sb_file_t *sb_read_memory(void *_buf, size_t filesize, bool raw_mode, voi | |||
1095 | printf(RED, " Failed\n"); | 1095 | printf(RED, " Failed\n"); |
1096 | fatal(SB_CHECKSUM_ERROR, "File SHA-1 error\n"); | 1096 | fatal(SB_CHECKSUM_ERROR, "File SHA-1 error\n"); |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | return sb_file; | 1099 | return sb_file; |
1100 | #undef printf | 1100 | #undef printf |
1101 | #undef fatal | 1101 | #undef fatal |
@@ -1131,13 +1131,13 @@ void sb_dump(struct sb_file_t *file, void *u, sb_color_printf cprintf) | |||
1131 | #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) | 1131 | #define printf(c, ...) cprintf(u, false, c, __VA_ARGS__) |
1132 | #define print_hex(c, p, len, nl) \ | 1132 | #define print_hex(c, p, len, nl) \ |
1133 | do { printf(c, ""); print_hex(p, len, nl); } while(0) | 1133 | do { printf(c, ""); print_hex(p, len, nl); } while(0) |
1134 | 1134 | ||
1135 | #define TREE RED | 1135 | #define TREE RED |
1136 | #define HEADER GREEN | 1136 | #define HEADER GREEN |
1137 | #define TEXT YELLOW | 1137 | #define TEXT YELLOW |
1138 | #define TEXT2 BLUE | 1138 | #define TEXT2 BLUE |
1139 | #define SEP OFF | 1139 | #define SEP OFF |
1140 | 1140 | ||
1141 | printf(BLUE, "SB File\n"); | 1141 | printf(BLUE, "SB File\n"); |
1142 | printf(TREE, "+-"); | 1142 | printf(TREE, "+-"); |
1143 | printf(HEADER, "Version: "); | 1143 | printf(HEADER, "Version: "); |
@@ -1153,7 +1153,7 @@ void sb_dump(struct sb_file_t *file, void *u, sb_color_printf cprintf) | |||
1153 | char name[5]; | 1153 | char name[5]; |
1154 | sb_fill_section_name(name, file->first_boot_sec_id); | 1154 | sb_fill_section_name(name, file->first_boot_sec_id); |
1155 | printf(TEXT, "%08x (%s)\n", file->first_boot_sec_id, name); | 1155 | printf(TEXT, "%08x (%s)\n", file->first_boot_sec_id, name); |
1156 | 1156 | ||
1157 | if(file->override_real_key) | 1157 | if(file->override_real_key) |
1158 | { | 1158 | { |
1159 | printf(TREE, "+-"); | 1159 | printf(TREE, "+-"); |
@@ -1174,7 +1174,7 @@ void sb_dump(struct sb_file_t *file, void *u, sb_color_printf cprintf) | |||
1174 | printf(HEADER, "Component Version: "); | 1174 | printf(HEADER, "Component Version: "); |
1175 | printf(TEXT, "%X.%X.%X\n", file->component_ver.major, file->component_ver.minor, | 1175 | printf(TEXT, "%X.%X.%X\n", file->component_ver.major, file->component_ver.minor, |
1176 | file->component_ver.revision); | 1176 | file->component_ver.revision); |
1177 | 1177 | ||
1178 | for(int i = 0; i < file->nr_sections; i++) | 1178 | for(int i = 0; i < file->nr_sections; i++) |
1179 | { | 1179 | { |
1180 | struct sb_section_t *sec = &file->sections[i]; | 1180 | struct sb_section_t *sec = &file->sections[i]; |
@@ -1241,7 +1241,7 @@ void sb_dump(struct sb_file_t *file, void *u, sb_color_printf cprintf) | |||
1241 | } | 1241 | } |
1242 | } | 1242 | } |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | #undef printf | 1245 | #undef printf |
1246 | #undef print_hex | 1246 | #undef print_hex |
1247 | } | 1247 | } |