mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
pp bootloader: speed up loading of the OF in the mi4 format
This change replaces an odd way to increment tea key in a function responsible for finding the proper key (it doesn't have to be done in a for loop, it's just adding a 32bit number to a 128bit number). It reduces the time needed to find the key practically to zero and it gives in the best case 2 seconds of overall speedup in loading the OF. Change-Id: I0632526c3dfeb4d0603e77239f298a89076b630b Reviewed-on: http://gerrit.rockbox.org/230 Tested-by: Szymon Dziok <b0hoon@o2.pl> Reviewed-by: Thomas Martitz <kugel@rockbox.org> Reviewed-by: Szymon Dziok <b0hoon@o2.pl>
This commit is contained in:
parent
e359202aa1
commit
ba3b6ceb4b
1 changed files with 13 additions and 20 deletions
|
@ -170,7 +170,7 @@ struct tea_key tea_keytable[] = {
|
|||
{ "c200_106", { 0xa913d139, 0xf842f398, 0x3e03f1a6, 0x060ee012 } },
|
||||
{ "view", { 0x70e19bda, 0x0c69ea7d, 0x2b8b1ad1, 0xe9767ced } },
|
||||
{ "sa9200", { 0x33ea0236, 0x9247bdc5, 0xdfaedf9f, 0xd67c9d30 } },
|
||||
{ "hdd1630", { 0x04543ced, 0xcebfdbad, 0xf7477872, 0x0d12342e } },
|
||||
{ "hdd1630/hdd63x0", { 0x04543ced, 0xcebfdbad, 0xf7477872, 0x0d12342e } },
|
||||
{ "vibe500", { 0xe3a66156, 0x77c6b67a, 0xe821dca5, 0xca8ca37c } },
|
||||
};
|
||||
|
||||
|
@ -247,8 +247,8 @@ static int tea_find_key(struct mi4header_t *mi4header, int fd)
|
|||
{
|
||||
unsigned int i;
|
||||
int rc;
|
||||
unsigned int j;
|
||||
uint32_t key[4];
|
||||
uint32_t keyinc;
|
||||
unsigned char magic_enc[8];
|
||||
int key_found = -1;
|
||||
unsigned int magic_location = mi4header->length-4;
|
||||
|
@ -275,18 +275,11 @@ static int tea_find_key(struct mi4header_t *mi4header, int fd)
|
|||
key[3] = tea_keytable[i].key[3];
|
||||
|
||||
/* Now increment the key */
|
||||
for(j=0; j<((magic_location-mi4header->plaintext)/8); j++){
|
||||
key[0]++;
|
||||
if (key[0]==0) {
|
||||
key[1]++;
|
||||
if (key[1]==0) {
|
||||
key[2]++;
|
||||
if (key[2]==0) {
|
||||
key[3]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
keyinc = (magic_location-mi4header->plaintext)/8;
|
||||
if ((key[0]+keyinc) < key[0]) key[1]++;
|
||||
key[0] += keyinc;
|
||||
if (key[1]==0) key[2]++;
|
||||
if (key[2]==0) key[3]++;
|
||||
|
||||
if (tea_test_key(magic_enc,key,unaligned))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue