Subversion Repositories freemyipod

Rev

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

Rev 550 Rev 722
Line 117... Line 117...
117
    data = emcore.read(addr, 0x50) + data + cert.ljust((len(cert) + 0xf) & ~0xf, "\0")
117
    data = emcore.read(addr, 0x50) + data + cert.ljust((len(cert) + 0xf) & ~0xf, "\0")
118
    emcore.free(addr)
118
    emcore.free(addr)
119
    return data
119
    return data
120
 
120
 
121
 
121
 
-
 
122
def s5l8720genpwnage(data):
-
 
123
    cert = open(os.path.dirname(__file__) + "/libipodcrypto/s5l8720pwnage.cer", "rb").read()
-
 
124
    data = data.ljust(max(0x640, (len(data) + 0xf) & ~0xf), "\0")
-
 
125
    header = ("87202.0\x03\0\0\0\0" + struct.pack("<IIII", len(data) - 0x630, len(data) - 0x2f2, len(data) - 0x5b0, 0x2be)).ljust(0x40, "\0")
-
 
126
    emcore = libemcore.Emcore()
-
 
127
    addr = emcore.memalign(0x10, len(data))
-
 
128
    emcore.write(addr, header + hashlib.sha1(header).digest()[:0x10])
-
 
129
    emcore.aesencrypt(addr + 0x40, 0x10, 1)
-
 
130
    data = emcore.read(addr, 0x50) + data + cert.ljust((len(cert) + 0xf) & ~0xf, "\0")
-
 
131
    emcore.free(addr)
-
 
132
    return data
-
 
133
 
-
 
134
 
122
def s5l8701cryptdfufile(infile, outfile):
135
def s5l8701cryptdfufile(infile, outfile):
123
    infile = open(infile, "rb")
136
    infile = open(infile, "rb")
124
    outfile = open(outfile, "wb")
137
    outfile = open(outfile, "wb")
125
    outfile.write(s5l8701cryptdfu(infile.read()))
138
    outfile.write(s5l8701cryptdfu(infile.read()))
126
    infile.close()
139
    infile.close()
Line 171... Line 184...
171
    infile = open(infile, "rb")
184
    infile = open(infile, "rb")
172
    outfile = open(outfile, "wb")
185
    outfile = open(outfile, "wb")
173
    outfile.write(s5l8702genpwnage(infile.read()))
186
    outfile.write(s5l8702genpwnage(infile.read()))
174
    infile.close()
187
    infile.close()
175
    outfile.close()
188
    outfile.close()
-
 
189
 
-
 
190
 
-
 
191
def s5l8720genpwnagefile(infile, outfile):
-
 
192
    infile = open(infile, "rb")
-
 
193
    outfile = open(outfile, "wb")
-
 
194
    outfile.write(s5l8720genpwnage(infile.read()))
-
 
195
    infile.close()
-
 
196
    outfile.close()