Line 383:
Line 383:
memcpy(key_buf, key_data_buf, 0x7C);
memcpy(key_buf, key_data_buf, 0x7C);
β
u32 xfer_size_flag = 0x00060000;
+
u32 crypt_reg_flag = 0x00060000;
u32 blob1_hash_addr = key_buf + 0x20;
u32 blob1_hash_addr = key_buf + 0x20;
// fuc5 crypt cauth instruction
// fuc5 crypt cauth instruction
// Set auth_addr to 0x300 and auth_size to blob1_size
// Set auth_addr to 0x300 and auth_size to blob1_size
β
*(u32 *)cauth = ((blob1_size << 0x10) | (0x300 >> 0x08));
+
cauth((blob1_size << 0x10) | (0x300 >> 0x08));
// fuc5 crypt cxset instruction
// fuc5 crypt cxset instruction
β
// Set crypto transfer mode
+
// The next 2 xfer instructions will be overridden
β
*(u32 *)cx = 0x02;
+
// and target changes from DMA to crypto
+
cxset(0x02);
β
// Transfer data from/to Falcon
+
// Transfer data to crypto register c6
β
xdst(0, (blob1_hash_addr | xfer_size_flag));
+
xdst(0, (blob1_hash_addr | crypt_reg_flag));
// Wait for all data loads/stores to finish
// Wait for all data loads/stores to finish