From e4dd514e6ffed290f07eff20b586b704008d0a8a Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sat, 16 Apr 2011 18:22:42 +0000 Subject: sbinfo: move more things to sb.h, rewrite code to use structures instead of hardcoded offsets git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29723 a1c6a512-1295-4272-9138-f99709370657 --- utils/sbinfo/sb.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'utils/sbinfo/sb.h') diff --git a/utils/sbinfo/sb.h b/utils/sbinfo/sb.h index c4d705c14b..1d62aa4daa 100644 --- a/utils/sbinfo/sb.h +++ b/utils/sbinfo/sb.h @@ -23,6 +23,8 @@ #include #include +#define BLOCK_SIZE 16 + struct sb_version_t { uint16_t major; @@ -56,6 +58,23 @@ struct sb_header_t uint8_t rand_pad1[6]; /* Random padding */ } __attribute__((packed)); +struct sb_section_header_t +{ + uint32_t identifier; + uint32_t offset; /* In blocks */ + uint32_t size; /* In blocks */ + uint32_t flags; +} __attribute__((packed)); + +struct sb_key_dictionary_entry_t +{ + uint8_t hdr_cbc_mac[16]; /* CBC-MAC of the header */ + uint8_t key[16]; /* Actual AES Key (encrypted by the global key) */ +} __attribute__((packed)); + +#define ROM_SECTION_BOOTABLE (1 << 0) +#define ROM_SECTION_CLEARTEXT (1 << 1) + #define SB_INST_NOP 0x0 #define SB_INST_TAG 0x1 #define SB_INST_LOAD 0x2 @@ -64,9 +83,6 @@ struct sb_header_t #define SB_INST_CALL 0x5 #define SB_INST_MODE 0x6 -#define ROM_SECTION_BOOTABLE (1 << 0) -#define ROM_SECTION_CLEARTEXT (1 << 1) - struct sb_instruction_header_t { uint8_t checksum; -- cgit v1.2.3