TSEC: Difference between revisions
Line 592: | Line 592: | ||
// fuc5 crypt cxset instruction | // fuc5 crypt cxset instruction | ||
// | // The next 2 xfer instructions will be overridden | ||
// and target changes from DMA to crypto | |||
cxset(0x02); | |||
u32 | u32 crypt_reg_flag = 0x00060000; | ||
u32 blob2_hash_addr = key_buf + 0x30; | u32 blob2_hash_addr = key_buf + 0x30; | ||
// Transfer data | // Transfer data to crypto register c6 | ||
xdst(0, (blob2_hash_addr | | xdst(0, (blob2_hash_addr | crypt_reg_flag)); | ||
// Wait for all data loads/stores to finish | // Wait for all data loads/stores to finish | ||
Line 605: | Line 606: | ||
// Save previous cauth value | // Save previous cauth value | ||
u32 cauth_old | u32 c_old = cauth_old; | ||
// fuc5 crypt cauth instruction | // fuc5 crypt cauth instruction | ||
// Set auth_addr to blob2_virt_addr and auth_size to blob2_size | // Set auth_addr to blob2_virt_addr and auth_size to blob2_size | ||
cauth((blob2_virt_addr >> 0x08) | (blob2_size << 0x10)); | |||
u32 hovi_key_addr = 0; | u32 hovi_key_addr = 0; | ||
Line 630: | Line 631: | ||
memset(key_buf, 0, 0x7C); | memset(key_buf, 0, 0x7C); | ||
// fuc5 crypt cauth instruction | |||
// Restore previous cauth value | // Restore previous cauth value | ||
cauth(c_old); | |||
return res; | return res; |