freemyipod r156 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r155‎ | r156 | r157 >
Date:14:18, 18 August 2010
Author:theseven
Status:new
Tags:
Comment:
Fix hardware key AES
Modified paths:
  • /embios/trunk/target/ipodnano2g/hwkeyaes.c (modified) (history)

Diff [purge]

Index: embios/trunk/target/ipodnano2g/hwkeyaes.c
@@ -42,7 +42,6 @@
4343 AESINSIZE = 0x10;
4444 AESSIZE3 = 0x10;
4545 ptr = direction == HWKEYAES_ENCRYPT ? 0 : (size >> 2) - 4;
46 - clean_dcache();
4746 while (true)
4847 {
4948 if (direction == HWKEYAES_ENCRYPT)
@@ -55,16 +54,20 @@
5655 AESOUTADDR = (uint32_t)data + (ptr << 2);
5756 AESINADDR = (uint32_t)data + (ptr << 2);
5857 AESAUXADDR = (uint32_t)data + (ptr << 2);
 58+ clean_dcache();
5959 AESSTATUS = 6;
6060 AESGO = go;
6161 go = 3;
6262 while ((AESSTATUS & 6) == 0) yield();
 63+ invalidate_dcache();
6364 if (direction == HWKEYAES_DECRYPT)
 65+ {
 66+ if (!ptr) break;
6467 for (i = 0; i < 4; i++)
6568 ((uint32_t*)data)[ptr + i] ^= ((uint32_t*)data)[ptr + i - 4];
 69+ }
6670 ptr += direction == HWKEYAES_ENCRYPT ? 4 : -4;
6771 }
68 - invalidate_dcache();
6972 AESCONTROL = 0;
7073 PWRCON(1) |= 0x400;
7174 }