Subversion Repositories freemyipod

Rev

Rev 180 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 180 Rev 186
Line 50... Line 50...
50
    return embios.read(0x08000800, len(data) - 0x800)
50
    return embios.read(0x08000800, len(data) - 0x800)
51
 
51
 
52
 
52
 
53
def nano2gcryptfirmware(data):
53
def nano2gcryptfirmware(data):
54
    data = data.ljust((len(data) + 0x3f) & ~0x3f, "\0")
54
    data = data.ljust((len(data) + 0x3f) & ~0x3f, "\0")
55
    header = "\0\0\0\0\0x02\0\0\0\0x01\0\0\0\0x40\0\0\0\0\0\0\0" + struct.pack("<I", len(data))
55
    header = "\0\0\0\0\x02\0\0\0\x01\0\0\0\x40\0\0\0\0\0\0\0" + struct.pack("<I", len(data))
56
    embios = libembios.Embios()
56
    embios = libembios.Embios()
57
    embios.write(0x08000000, header.ljust(0x800, "\0") + data)
57
    embios.write(0x08000000, header.ljust(0x800, "\0") + data)
58
    embios.lib.dev.timeout = 20000
58
    embios.lib.dev.timeout = 20000
59
    embios.hmac_sha1(0x08000800, len(data), 0x0800001c)
59
    embios.hmac_sha1(0x08000800, len(data), 0x0800001c)
60
    embios.hmac_sha1(0x08000000, 0x200, 0x080001d4)
60
    embios.hmac_sha1(0x08000000, 0x200, 0x080001d4)