LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
xb360.c
Go to the documentation of this file.
1/*
2 * xb360.c
3 *
4 * Created on: Sep 4, 2008
5 */
6
7#include <string.h>
8#include <stdio.h>
9#include <stdlib.h>
10#include <sys/stat.h>
11#include <pci/io.h>
12#include <time/time.h>
16#include <xenon_smc/xenon_smc.h>
17#include <crypt/hmac_sha1.h>
18#include <crypt/rc4.h>
19
20#include "xb360.h"
21
23
24extern struct sfc sfc;
25
26static const kventry kvlookup[] =
27 {
28 {XEKEY_MANUFACTURING_MODE, 0x18, 0x01},
29 {XEKEY_ALTERNATE_KEY_VAULT, 0x19, 0x01},
30 {XEKEY_RESERVED_BYTE2, 0x1A, 0x01},
31 {XEKEY_RESERVED_BYTE3, 0x1B, 0x01},
32 {XEKEY_RESERVED_WORD1, 0x1C, 0x02},
33 {XEKEY_RESERVED_WORD2, 0x1E, 0x02},
35 {XEKEY_RESERVED_DWORD2, 0x24, 0x04},
36 {XEKEY_RESERVED_DWORD3, 0x28, 0x04},
37 {XEKEY_RESERVED_DWORD4, 0x2c, 0x04},
38 {XEKEY_RESTRICTED_PRIVILEDGES, 0x30, 0x08},
39 {XEKEY_RESERVED_QWORD2, 0x38, 0x08},
40 {XEKEY_RESERVED_QWORD3, 0x40, 0x08},
41 {XEKEY_RESERVED_QWORD4, 0x48, 0x08},
42 {XEKEY_RESERVED_KEY1, 0x50, 0x10},
43 {XEKEY_RESERVED_KEY2, 0x60, 0x10},
44 {XEKEY_RESERVED_KEY3, 0x70, 0x10},
45 {XEKEY_RESERVED_KEY4, 0x80, 0x10},
46 {XEKEY_RESERVED_RANDOM_KEY1, 0x90, 0x10},
47 {XEKEY_RESERVED_RANDOM_KEY2, 0xA0, 0x10},
48 {XEKEY_CONSOLE_SERIAL_NUMBER, 0xB0, 0x0C},
49 {XEKEY_MOBO_SERIAL_NUMBER, 0xBC, 0x0C},
50 {XEKEY_GAME_REGION, 0xC8, 0x02},
52 {XEKEY_KEY_OBFUSCATION_KEY, 0xE0, 0x10},
54 {XEKEY_DVD_KEY, 0x100, 0x10},
55 {XEKEY_PRIMARY_ACTIVATION_KEY, 0x110, 0x18},
56 {XEKEY_SECONDARY_ACTIVATION_KEY, 0x128, 0x10},
57 {XEKEY_GLOBAL_DEVICE_2DES_KEY1, 0x138, 0x10},
58 {XEKEY_GLOBAL_DEVICE_2DES_KEY2, 0x148, 0x10},
65 {XEKEY_MEMORY_UNIT_MS_2DES_KEY1, 0x1B8, 0x10},
66 {XEKEY_MEMORY_UNIT_MS_2DES_KEY2, 0x1C8, 0x10},
75 {XEKEY_MEMORY_UNIT_3P_2DES_KEY1, 0x258, 0x10},
76 {XEKEY_MEMORY_UNIT_3P_2DES_KEY2, 0x268, 0x10},
79 {XEKEY_CONSOLE_PRIVATE_KEY, 0x298, 0x1D0},
80 {XEKEY_XEIKA_PRIVATE_KEY, 0x468, 0x390},
81 {XEKEY_CARDEA_PRIVATE_KEY, 0x7F8, 0x1D0},
82 {XEKEY_CONSOLE_CERTIFICATE, 0x9C8, 0x1A8},
83 {XEKEY_XEIKA_CERTIFICATE, 0xB70, 0x1388},
84 {XEKEY_CARDEA_CERTIFICATE, 0x1EF8, 0x2108}
85 };
86
87void print_key(char *name, unsigned char *data)
88{
89 int i=0;
90 printf("%s: ", name);
91 for(i=0; i<16; i++)
92 printf("%02X",data[i]);
93 printf("\n");
94}
95
96int cpu_get_key(unsigned char *data)
97{
98 *(unsigned long long*)&data[0] = xenon_secotp_read_line(3) | xenon_secotp_read_line(4);
99 *(unsigned long long*)&data[8] = xenon_secotp_read_line(5) | xenon_secotp_read_line(6);
100 return 0;
101}
102
103int get_virtual_cpukey(unsigned char *data)
104{
105 unsigned char buffer[VFUSES_SIZE];
106
108 {
109 return 2; //Unable to read NAND data...
110 }
111
112 //if we got here then it was at least able to read from nand
113 //now we need to verify the data somehow
114 if(buffer[0]==0xC0 && buffer[1]==0xFF && buffer[2]==0xFF && buffer[3]==0xFF)
115 {
116 memcpy(data,&buffer[0x20],0x10);
117 return 0;
118 }
119 else
120 {
121 // No Virtual Fuses were found at 0x95000, check again at 0xC0000 (Zero fuse DevGL consoles)
123 {
124 return 2; //Unable to read NAND data...
125 }
126
127 //if we got here then it was at least able to read from nand
128 //now we need to verify the data somehow
129 if(buffer[0]==0xC0 && buffer[1]==0xFF && buffer[2]==0xFF && buffer[3]==0xFF)
130 {
131 memcpy(data,&buffer[0x20],0x10);
132 return 0;
133 }
134
135 // No virtual fuses at 0x95000 or 0xC0000
136 return 1;
137 }
138}
139
140
141int kv_get_key(unsigned char keyid, unsigned char *keybuf, int *keybuflen, unsigned char *keyvault)
142{
143 if (keyid > 0x38)
144 return 1;
145
146 if (*keybuflen != kvlookup[keyid].length)
147 {
148 *keybuflen = kvlookup[keyid].length;
149 return 2;
150 }
151 memcpy(keybuf, keyvault + kvlookup[keyid].offset, kvlookup[keyid].length);
152
153 return 0;
154}
155
156
157int kv_read(unsigned char *data, int virtualcpukey)
158{
160 return -1;
161
162 unsigned char cpu_key[0x10];
163 if (virtualcpukey)
164 get_virtual_cpukey(cpu_key);
165 else
166 cpu_get_key(cpu_key);
167 //print_key("kv_read: cpu key", cpu_key);
168
169 unsigned char hmac_key[0x10];
170 memcpy(hmac_key, data, 0x10);
171 //print_key("kv_read: hmac key", hmac_key);
172
173 unsigned char rc4_key[0x10];
174 memset(rc4_key, 0, 0x10);
175
176 HMAC_SHA1(cpu_key, hmac_key, rc4_key, 0x10);
177 //print_key("kv_read: rc4 key", rc4_key);
178
179 unsigned char rc4_state[0x100];
180 memset(rc4_state, 0, 0x100);
181
182 rc4_init(rc4_state, rc4_key ,0x10);
183 rc4_crypt(rc4_state, (unsigned char*) &data[0x10], KV_FLASH_SIZE - 0x10);
184
185 //Now then do a little check to make sure it is somewhat correct
186 //We check the hmac_sha1 of the data and compare that to
187 //the hmac_sha1 key in the header of the keyvault
188 //basically the reverse of what we did to generate the key for rc4
189 unsigned char data2[KV_FLASH_SIZE];
190 unsigned char out[20];
191 unsigned char tmp[] = {0x07, 0x12};
192 HMAC_SHA1_CTX ctx;
193
194 //the hmac_sha1 seems destructive
195 //so we make a copy of the data
196 memcpy(data2, data, KV_FLASH_SIZE);
197
198 HMAC_SHA1_Init(&ctx);
199 HMAC_SHA1_UpdateKey(&ctx, (unsigned char *) cpu_key, 0x10);
200 HMAC_SHA1_EndKey(&ctx);
201
203
204 HMAC_SHA1_UpdateMessage(&ctx, (unsigned char*) &data2[0x10], KV_FLASH_SIZE - 0x10);
205 HMAC_SHA1_UpdateMessage(&ctx, (unsigned char*) &tmp[0x00], 0x02); //Special appendage
206
207 HMAC_SHA1_EndMessage(out, &ctx);
208 HMAC_SHA1_Done(&ctx);
209
210 int index = 0;
211 while (index < 0x10)
212 {
213 if (data[index] != out[index])
214 {
215 // Hmm something is wrong, hmac is not matching
216 //printf(" ! kv_read: kv hash check failed\n");
217 return 2;
218 }
219 index += 1;
220 }
221
222 return 0;
223}
224
225int kv_get_dvd_key(unsigned char *dvd_key)
226{
227 if (KV_FLASH_SIZE == 0)
228 return -1; //It's bad data!
229 unsigned char buffer[KV_FLASH_SIZE], tmp[0x10];
230 int result = 0;
231 int keylen = 0x10;
232
233 result = kv_read(buffer, 0);
234 if (result == 2 && get_virtual_cpukey(tmp) == 0){
235 printf("! Attempting to decrypt DVDKey with Virtual CPU Key !\n");
236 result = kv_read(buffer, 1);
237 }
238 if (result != 0){
239 printf(" ! kv_get_dvd_key Failure: kv_read\n");
240 if (result == 2){ //Hash failure
241 printf(" ! the hash check failed probably as a result of decryption failure\n");
242 printf(" ! make sure that the CORRECT key vault for this console is in flash\n");
243 printf(" ! the key vault should be at offset 0x4200 for a length of 0x4200\n");
244 printf(" ! in the 'raw' flash binary from THIS console\n");
245 }
246 return 1;
247 }
248
249 result = kv_get_key(XEKEY_DVD_KEY, dvd_key, &keylen, buffer);
250 if (result != 0){
251 printf(" ! kv_get_dvd_key Failure: kv_get_key %d\n", result);
252 return result;
253 }
254
255 //print_key("dvd key", dvd_key);
256 return 0;
257
258}
259
261{
262 unsigned char key[0x10];
263
264 printf("\n");
265
266 memset(key, '\0', sizeof(key));
267 if (cpu_get_key(key)==0)
268 print_key(" * your cpu key", key);
270 {
271 memset(key, '\0',sizeof(key));
272 if (get_virtual_cpukey(key)==0)
273 print_key(" * your virtual cpu key", key);
274
275 memset(key, '\0', sizeof(key));
276 if (kv_get_dvd_key(key)==0)
277 print_key(" * your dvd key", key);
278 }
279 else
280 printf(" ! Unable to read Keyvault data from NAND\n");
281 printf("\n");
282}
283
284//This version crashes... dunno why... but... old one works perfectly fine so, why change it?!
285
286//int updateXeLL(void * addr, unsigned len)
287//{
288// int i, j, k, startblock, current, offsetinblock, blockcnt;
289// unsigned char *user, *spare;
290//
291// if (sfc.initialized != SFCX_INITIALIZED){
292// printf(" ! sfcx is not initialized! Unable to update XeLL in NAND!\n");
293// return -1;
294// }
295//
296// printf("\n * found XeLL update. press power NOW if you don't want to update.\n");
297// delay(15);
298//
299// for (k = 0; k < XELL_OFFSET_COUNT; k++)
300// {
301// current = xelloffsets[k];
302// offsetinblock = current % sfc.block_sz;
303// startblock = current/sfc.block_sz;
304// blockcnt = offsetinblock ? (XELL_SIZE/sfc.block_sz)+1 : (XELL_SIZE/sfc.block_sz);
305//
306//
307// spare = (unsigned char*)malloc(blockcnt*sfc.pages_in_block*sfc.meta_sz);
308// if(!spare){
309// printf(" ! Error while memallocating filebuffer (spare)\n");
310// return -1;
311// }
312// user = (unsigned char*)malloc(blockcnt*sfc.block_sz);
313// if(!user){
314// printf(" ! Error while memallocating filebuffer (user)\n");
315// return -1;
316// }
317// j = 0;
318// unsigned char pagebuf[MAX_PAGE_SZ];
319//
320// for (i = (startblock*sfc.pages_in_block); i< (startblock+blockcnt)*sfc.pages_in_block; i++)
321// {
322// sfcx_read_page(pagebuf, (i*sfc.page_sz), 1);
323// //Split rawpage into user & spare
324// memcpy(&user[j*sfc.page_sz],pagebuf,sfc.page_sz);
325// memcpy(&spare[j*sfc.meta_sz],&pagebuf[sfc.page_sz],sfc.meta_sz);
326// j++;
327// }
328//
329// if (memcmp(&user[offsetinblock+(XELL_FOOTER_OFFSET)],XELL_FOOTER,XELL_FOOTER_LENGTH) == 0){
330// printf(" * XeLL Binary in NAND found @ 0x%08X\n", (startblock*sfc.block_sz)+offsetinblock);
331//
332// memcpy(&user[offsetinblock], addr,len); //Copy over updxell.bin
333// printf(" * Writing to NAND!\n");
334// j = 0;
335// for (i = startblock*sfc.pages_in_block; i < (startblock+blockcnt)*sfc.pages_in_block; i ++)
336// {
337// if (!(i%sfc.pages_in_block))
338// sfcx_erase_block(i*sfc.page_sz);
339//
340// /* Copy user & spare data together in a single rawpage */
341// memcpy(pagebuf,&user[j*sfc.page_sz],sfc.page_sz);
342// memcpy(&pagebuf[sfc.page_sz],&spare[j*sfc.meta_sz],sfc.meta_sz);
343// j++;
344//
345// if (!(sfcx_is_pageerased(pagebuf))) // We dont need to write to erased pages
346// {
347// memset(&pagebuf[sfc.page_sz+0x0C],0x0, 4); //zero only EDC bytes
348// sfcx_calcecc((unsigned int *)pagebuf); //recalc EDC bytes
349// sfcx_write_page(pagebuf, i*sfc.page_sz);
350// }
351// }
352// printf(" * XeLL flashed! Reboot the xbox to enjoy the new build\n");
353// for(;;);
354//
355// }
356// }
357// printf(" ! Couldn't locate XeLL binary in NAND. Aborting!\n");
358// return -1; // if this point is reached, updating xell failed
359//}
360
361int updateXeLL(char *path)
362{
363 FILE *f;
364 int i, j, k, status, startblock, current, offsetinblock, blockcnt, filelength;
365 unsigned char *updxell, *user, *spare;
366 struct stat s;
367
368 memset(&s, 0, sizeof(struct stat));
369 stat(path, &s);
370 long size = s.st_size;
371 if (size <= 0)
372 return -1; //Invalid Filesize
373
374 /* Check if updxell.bin is present */
375 f = fopen(path, "rb");
376 if (!f){
377 return -1; //Can't find/open updxell.bin
378 }
379
381 fclose(f);
382 printf(" ! sfcx is not initialized! Unable to update XeLL in NAND!\n");
383 return -1;
384 }
385
386 /* Check filesize of updxell.bin, only accept full 256kb binaries */
387 fseek(f, 0, SEEK_END);
388 filelength=ftell(f);
389 fseek(f, 0, SEEK_SET);
390 if (filelength != XELL_SIZE){
391 fclose(f);
392 printf(" ! %s does not have the correct size of 256kb. Aborting update!\n", path);
393 return -1;
394 }
395
396 printf("\n * found XeLL update. press power NOW if you don't want to update.\n");
397 delay(15);
398
399 for (k = 0; k < XELL_OFFSET_COUNT; k++)
400 {
401 current = xelloffsets[k];
402 offsetinblock = current % sfc.block_sz;
403 startblock = current/sfc.block_sz;
404 blockcnt = offsetinblock ? (XELL_SIZE/sfc.block_sz)+1 : (XELL_SIZE/sfc.block_sz);
405
406
407 spare = (unsigned char*)malloc(blockcnt*sfc.pages_in_block*sfc.meta_sz);
408 if(!spare){
409 printf(" ! Error while memallocating filebuffer (spare)\n");
410 return -1;
411 }
412 user = (unsigned char*)malloc(blockcnt*sfc.block_sz);
413 if(!user){
414 printf(" ! Error while memallocating filebuffer (user)\n");
415 return -1;
416 }
417 j = 0;
418 unsigned char pagebuf[MAX_PAGE_SZ];
419
420 for (i = (startblock*sfc.pages_in_block); i< (startblock+blockcnt)*sfc.pages_in_block; i++)
421 {
423 //Split rawpage into user & spare
424 memcpy(&user[j*sfc.page_sz],pagebuf,sfc.page_sz);
425 memcpy(&spare[j*sfc.meta_sz],&pagebuf[sfc.page_sz],sfc.meta_sz);
426 j++;
427 }
428
429 if (memcmp(&user[offsetinblock+(XELL_FOOTER_OFFSET)],XELL_FOOTER,XELL_FOOTER_LENGTH) == 0){
430 printf(" * XeLL Binary in NAND found @ 0x%08X\n", (startblock*sfc.block_sz)+offsetinblock);
431
432 updxell = (unsigned char*)malloc(XELL_SIZE);
433 if(!updxell){
434 printf(" ! Error while memallocating filebuffer (updxell)\n");
435 return -1;
436 }
437
438 status = fread(updxell,1,XELL_SIZE,f);
439 if (status != XELL_SIZE){
440 fclose(f);
441 printf(" ! Error reading file from %s\n", path);
442 return -1;
443 }
444
445 if (memcmp(&updxell[XELL_FOOTER_OFFSET],XELL_FOOTER, XELL_FOOTER_LENGTH)){
446 printf(" ! XeLL does not seem to have matching footer, Aborting update!\n");
447 return -1;
448 }
449
450 fclose(f);
451 memcpy(&user[offsetinblock], updxell,XELL_SIZE); //Copy over updxell.bin
452 printf(" * Writing to NAND!\n");
453 j = 0;
454 for (i = startblock*sfc.pages_in_block; i < (startblock+blockcnt)*sfc.pages_in_block; i ++)
455 {
456 if (!(i%sfc.pages_in_block))
458
459 /* Copy user & spare data together in a single rawpage */
460 memcpy(pagebuf,&user[j*sfc.page_sz],sfc.page_sz);
461 memcpy(&pagebuf[sfc.page_sz],&spare[j*sfc.meta_sz],sfc.meta_sz);
462 j++;
463
464 if (!(sfcx_is_pageerased(pagebuf))) // We dont need to write to erased pages
465 {
466 memset(&pagebuf[sfc.page_sz+0x0C],0x0, 4); //zero only EDC bytes
467 sfcx_calcecc((unsigned int *)pagebuf); //recalc EDC bytes
469 }
470 }
471 printf(" * XeLL flashed! Reboot the xbox to enjoy the new build\n");
472 for(;;);
473
474 }
475 }
476 printf(" ! Couldn't locate XeLL binary in NAND. Aborting!\n");
477 return -1;
478}
479
480unsigned int xenon_get_DVE()
481{
482 unsigned int DVEversion, tmp;
483 xenon_smc_ana_read(0xfe, &DVEversion);
484 tmp = DVEversion;
485 tmp = (tmp & ~0xF0) | ((DVEversion >> 12) & 0xF0);
486 return (tmp & 0xFF);
487}
488
490{
491 return ((read32(0xd0000008) << 24) >> 24);
492}
493
494unsigned int xenon_get_CPU_PVR()
495{
496 unsigned int PVR;
497 asm volatile("mfpvr %0" : "=r" (PVR));
498 return PVR;
499}
500
501unsigned int xenon_get_XenosID()
502{
503 return ((read32(0xd0010000) >> 16) & 0xFFFF);
504}
505
507{
508 unsigned int PVR, PCIBridgeRevisionID, consoleVersion, DVEversion;
509
510 PCIBridgeRevisionID = xenon_get_PCIBridgeRevisionID();
511 consoleVersion = xenon_get_XenosID();
512 DVEversion = xenon_get_DVE();
513 PVR = xenon_get_CPU_PVR();
514 if(PVR == 0x710200 || PVR == 0x710300) //TODO: Add XenosID check also!
515 return REV_ZEPHYR;
516 if(consoleVersion < 0x5821)
517 return REV_XENON;
518 else if(consoleVersion >= 0x5821 && consoleVersion < 0x5831)
519 {
520 return REV_FALCON;
521 }
522 else if(consoleVersion >= 0x5831 && consoleVersion < 0x5841)
523 return REV_JASPER;
524 else if(consoleVersion >= 0x5841 && consoleVersion < 0x5851)
525 {
526 //TODO: If PVR is always the same for trinity, move it to the if statement above...
527 if (DVEversion >= 0x20 && PVR == 0x710800)
528 {
529 if (PCIBridgeRevisionID >= 0x70 && sfcx_readreg(SFCX_PHISON) != 0)
530 return REV_CORONA_PHISON;
531 return REV_CORONA;
532 }
533 else
534 return REV_TRINITY;
535 }
536 else if(consoleVersion >= 0x5851)
537 {
538 if (PCIBridgeRevisionID >= 0x70 && sfcx_readreg(SFCX_PHISON) != 0)
539 return REV_WINCHESTER_MMC;
540 return REV_WINCHESTER;
541 }
542 return REV_UNKNOWN;
543}
544
546{
547 uint16_t tmp;
548 memcpy(&tmp, (const void*)(0x80000200C8000000ULL), 2);
549 if (tmp != 0xFF4F)
550 return -1;
551 return 0;
552}
553
554int xenon_get_logical_nand_data(void* buf, unsigned int offset, unsigned int len)
555{
557 memcpy(buf, (const void*)(0x80000200C8000000ULL + offset), len);
558 else
559 return -1;
560 return 0;
561}
562
563unsigned int xenon_get_kv_size()
564{
565 unsigned int ret;
566 if (xenon_get_logical_nand_data(&ret, 0x60, 4) == 0)
567 return ret;
568 return 0;
569}
570
572{
573 unsigned int ret;
574 if (xenon_get_logical_nand_data(&ret, 0x6C, 4) == 0)
575 return ret;
576 return 0;
577}
uint16_t length
Definition: ata.h:4
u32 status
Definition: ehci_defs.h:15
void HMAC_SHA1_EndMessage(unsigned char *out, HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:170
void HMAC_SHA1(void *secret, void *data, void *res, int len)
Definition: hmac_sha1.c:190
void HMAC_SHA1_UpdateMessage(HMAC_SHA1_CTX *ctx, unsigned char *data, unsigned int datalen)
Definition: hmac_sha1.c:166
void HMAC_SHA1_Done(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:181
void HMAC_SHA1_Init(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:71
void HMAC_SHA1_StartMessage(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:161
void HMAC_SHA1_UpdateKey(HMAC_SHA1_CTX *ctx, unsigned char *key, unsigned int keylen)
Definition: hmac_sha1.c:79
void HMAC_SHA1_EndKey(HMAC_SHA1_CTX *ctx)
Definition: hmac_sha1.c:133
u32 size
Definition: iso9660.c:537
u16 uint16_t
Definition: libfdt_env.h:10
int stat(const char *file, struct stat *st)
Definition: newlib.c:643
void rc4_init(unsigned char *state, unsigned char *key, int len)
Definition: rc4.c:5
void rc4_crypt(unsigned char *state, unsigned char *data, int len)
Definition: rc4.c:22
Definition: xb360.h:102
int length
Definition: xb360.h:105
Definition: xenon_sfcx.h:84
int page_sz
Definition: xenon_sfcx.h:88
int meta_sz
Definition: xenon_sfcx.h:89
int block_sz
Definition: xenon_sfcx.h:93
int initialized
Definition: xenon_sfcx.h:85
int pages_in_block
Definition: xenon_sfcx.h:92
void delay(int u)
Definition: time.c:22
int xenon_get_logical_nand_data(void *buf, unsigned int offset, unsigned int len)
Definition: xb360.c:554
unsigned int xenon_get_CPU_PVR()
Definition: xb360.c:494
void print_key(char *name, unsigned char *data)
Definition: xb360.c:87
int get_virtual_cpukey(unsigned char *data)
Definition: xb360.c:103
int updateXeLL(char *path)
Definition: xb360.c:361
unsigned int xenon_get_PCIBridgeRevisionID()
Definition: xb360.c:489
unsigned int xenon_get_kv_offset()
Definition: xb360.c:571
unsigned int xenon_get_XenosID()
Definition: xb360.c:501
int kv_read(unsigned char *data, int virtualcpukey)
Definition: xb360.c:157
void print_cpu_dvd_keys(void)
Definition: xb360.c:260
struct XCONFIG_SECURED_SETTINGS secured_settings
Definition: xenon_config.c:17
int kv_get_key(unsigned char keyid, unsigned char *keybuf, int *keybuflen, unsigned char *keyvault)
Definition: xb360.c:141
unsigned int xenon_get_DVE()
Definition: xb360.c:480
unsigned int xenon_get_kv_size()
Definition: xb360.c:563
int xenon_logical_nand_data_ok()
Definition: xb360.c:545
int xenon_get_console_type()
Definition: xb360.c:506
int cpu_get_key(unsigned char *data)
Definition: xb360.c:96
int kv_get_dvd_key(unsigned char *dvd_key)
Definition: xb360.c:225
#define XEKEY_RESERVED_WORD2
Definition: xb360.h:15
#define XEKEY_RESERVED_QWORD2
Definition: xb360.h:21
#define XELL_SIZE
Definition: xb360.h:78
#define XEKEY_RESERVED_KEY4
Definition: xb360.h:27
#define KV_FLASH_SIZE
Definition: xb360.h:71
#define XEKEY_WIRELESS_CONTROLLER_3P_2DES_KEY1
Definition: xb360.h:51
#define XEKEY_WIRED_CONTROLLER_3P_2DES_KEY2
Definition: xb360.h:56
#define KV_FLASH_OFFSET
Definition: xb360.h:72
#define XEKEY_KEY_OBFUSCATION_KEY
Definition: xb360.h:34
#define XEKEY_RESERVED_BYTE3
Definition: xb360.h:13
#define REV_XENON
Definition: xb360.h:91
#define XEKEY_GLOBAL_DEVICE_2DES_KEY1
Definition: xb360.h:39
#define XEKEY_ROAMABLE_OBFUSCATION_KEY
Definition: xb360.h:35
#define REV_CORONA
Definition: xb360.h:96
#define VFUSES_SIZE
Definition: xb360.h:75
#define XEKEY_WIRELESS_CONTROLLER_MS_2DES_KEY1
Definition: xb360.h:41
#define VFUSES_OFFSET
Definition: xb360.h:76
#define REV_ZEPHYR
Definition: xb360.h:92
#define REV_CORONA_PHISON
Definition: xb360.h:97
#define XEKEY_PRIMARY_ACTIVATION_KEY
Definition: xb360.h:37
#define XEKEY_RESERVED_DWORD4
Definition: xb360.h:19
#define XEKEY_WIRELESS_CONTROLLER_MS_2DES_KEY2
Definition: xb360.h:42
#define XEKEY_WIRED_WEBCAM_3P_2DES_KEY1
Definition: xb360.h:53
#define XEKEY_SECONDARY_ACTIVATION_KEY
Definition: xb360.h:38
#define XEKEY_MEMORY_UNIT_3P_2DES_KEY2
Definition: xb360.h:58
#define XEKEY_RESERVED_KEY1
Definition: xb360.h:24
#define XEKEY_CARDEA_PRIVATE_KEY
Definition: xb360.h:63
#define XELL_OFFSET_COUNT
Definition: xb360.h:83
#define XEKEY_RESERVED_KEY3
Definition: xb360.h:26
#define XEKEY_RESTRICTED_HVEXT_LOADER
Definition: xb360.h:16
#define XEKEY_WIRED_CONTROLLER_3P_2DES_KEY1
Definition: xb360.h:55
#define XEKEY_RESERVED_RANDOM_KEY1
Definition: xb360.h:28
#define XEKEY_OTHER_XSM3_DEVICE_MS_2DES_KEY1
Definition: xb360.h:49
#define XEKEY_MEMORY_UNIT_MS_2DES_KEY2
Definition: xb360.h:48
#define REV_WINCHESTER_MMC
Definition: xb360.h:99
#define XEKEY_MANUFACTURING_MODE
Definition: xb360.h:10
#define XEKEY_MEMORY_UNIT_MS_2DES_KEY1
Definition: xb360.h:47
#define XEKEY_WIRED_CONTROLLER_MS_2DES_KEY1
Definition: xb360.h:45
#define XEKEY_RESERVED_QWORD3
Definition: xb360.h:22
#define XEKEY_XEIKA_PRIVATE_KEY
Definition: xb360.h:62
#define XEKEY_MEMORY_UNIT_3P_2DES_KEY1
Definition: xb360.h:57
#define XEKEY_CONSOLE_SERIAL_NUMBER
Definition: xb360.h:30
#define XEKEY_WIRED_WEBCAM_MS_2DES_KEY1
Definition: xb360.h:43
#define XEKEY_CONSOLE_OBFUSCATION_KEY
Definition: xb360.h:33
#define XEKEY_RESERVED_WORD1
Definition: xb360.h:14
#define XEKEY_RESTRICTED_PRIVILEDGES
Definition: xb360.h:20
#define XEKEY_DVD_KEY
Definition: xb360.h:36
#define XEKEY_WIRELESS_CONTROLLER_3P_2DES_KEY2
Definition: xb360.h:52
#define REV_TRINITY
Definition: xb360.h:95
#define XEKEY_WIRED_WEBCAM_3P_2DES_KEY2
Definition: xb360.h:54
#define XEKEY_CONSOLE_CERTIFICATE
Definition: xb360.h:64
#define XEKEY_RESERVED_DWORD2
Definition: xb360.h:17
#define REV_FALCON
Definition: xb360.h:93
#define REV_JASPER
Definition: xb360.h:94
#define XEKEY_RESERVED_DWORD3
Definition: xb360.h:18
#define REV_WINCHESTER
Definition: xb360.h:98
#define XEKEY_RESERVED_QWORD4
Definition: xb360.h:23
#define XEKEY_CONSOLE_PRIVATE_KEY
Definition: xb360.h:61
#define XEKEY_WIRED_WEBCAM_MS_2DES_KEY2
Definition: xb360.h:44
#define XEKEY_RESERVED_RANDOM_KEY2
Definition: xb360.h:29
#define XEKEY_OTHER_XSM3_DEVICE_3P_2DES_KEY1
Definition: xb360.h:59
#define XEKEY_ALTERNATE_KEY_VAULT
Definition: xb360.h:11
#define XEKEY_XEIKA_CERTIFICATE
Definition: xb360.h:65
#define XEKEY_GAME_REGION
Definition: xb360.h:32
#define XEKEY_RESERVED_KEY2
Definition: xb360.h:25
#define XEKEY_OTHER_XSM3_DEVICE_3P_2DES_KEY2
Definition: xb360.h:60
#define ZFUSES_OFFSET
Definition: xb360.h:77
#define XEKEY_OTHER_XSM3_DEVICE_MS_2DES_KEY2
Definition: xb360.h:50
#define REV_UNKNOWN
Definition: xb360.h:100
#define XEKEY_RESERVED_BYTE2
Definition: xb360.h:12
#define XEKEY_GLOBAL_DEVICE_2DES_KEY2
Definition: xb360.h:40
#define XEKEY_MOBO_SERIAL_NUMBER
Definition: xb360.h:31
#define XEKEY_CARDEA_CERTIFICATE
Definition: xb360.h:66
#define XEKEY_WIRED_CONTROLLER_MS_2DES_KEY2
Definition: xb360.h:46
unsigned char pagebuf[MAX_PAGE_SZ]
Definition: xenon_config.c:20
uint64_t xenon_secotp_read_line(int nr)
Definition: xenon_secotp.c:3
unsigned long sfcx_readreg(int addr)
Definition: xenon_sfcx.c:20
int sfcx_is_pageerased(unsigned char *data)
Definition: xenon_sfcx.c:361
int sfcx_read_page(unsigned char *data, int address, int raw)
Definition: xenon_sfcx.c:25
int sfcx_write_page(unsigned char *data, int address)
Definition: xenon_sfcx.c:74
void sfcx_calcecc(unsigned int *data)
Definition: xenon_sfcx.c:211
int sfcx_erase_block(int address)
Definition: xenon_sfcx.c:150
#define SFCX_INITIALIZED
Definition: xenon_sfcx.h:76
#define SFCX_PHISON
Definition: xenon_sfcx.h:14
#define MAX_PAGE_SZ
Definition: xenon_sfcx.h:61
int xenon_smc_ana_read(uint8_t addr, uint32_t *val)
Definition: xenon_smc.c:149
#define XELL_FOOTER
#define XELL_FOOTER_LENGTH
#define XELL_FOOTER_OFFSET
union @15 data
u8 j
Definition: xenos_edid.h:10
u8 k
Definition: xenos_edid.h:9