summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/mi4-loader.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/firmware/export/mi4-loader.h b/firmware/export/mi4-loader.h
new file mode 100644
index 0000000000..1b4a4b93b2
--- /dev/null
+++ b/firmware/export/mi4-loader.h
@@ -0,0 +1,51 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2006 by Barry Wardell
10 *
11 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
12 * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24#include <stdint.h>
25
26#define MI4_HEADER_SIZE 0x200
27
28/* mi4 header structure */
29struct mi4header_t {
30 unsigned char magic[4];
31 uint32_t version;
32 uint32_t length;
33 uint32_t crc32;
34 uint32_t enctype;
35 uint32_t mi4size;
36 uint32_t plaintext;
37 uint32_t dsa_key[10];
38 uint32_t pad[109];
39 unsigned char type[4];
40 unsigned char model[4];
41};
42
43struct tea_key {
44 const char * name;
45 uint32_t key[4];
46};
47
48#define NUM_KEYS (sizeof(tea_keytable)/sizeof(tea_keytable[0]))
49
50int load_mi4(unsigned char* buf, const char* firmware, unsigned int buffer_size);
51const char *mi4_strerror(int8_t errno);