exosphere: correct reencryption of rsa private keys

This commit is contained in:
Michael Scire 2020-04-24 17:36:37 -07:00
parent 524da78b0e
commit 7bc0250cea

View file

@ -205,10 +205,12 @@ void gcm_encrypt_key(void *dst, size_t dst_size, const void *src, size_t src_siz
se_generate_random(KEYSLOT_SWITCH_RNGKEY, intermediate_buf, 0x10); se_generate_random(KEYSLOT_SWITCH_RNGKEY, intermediate_buf, 0x10);
flush_dcache_range(intermediate_buf, intermediate_buf + 0x10); flush_dcache_range(intermediate_buf, intermediate_buf + 0x10);
/* Copy in the src. */
memcpy(intermediate_buf + 0x10, src, src_size);
/* Write Device ID. */ /* Write Device ID. */
write64be(intermediate_buf, src_size + 0x18, fuse_get_device_id() | (deviceid_high << 56)); write64be(intermediate_buf, src_size + 0x18, fuse_get_device_id() | (deviceid_high << 56));
/* J = GHASH(CTR); */ /* J = GHASH(CTR); */
uint8_t j_block[0x10]; uint8_t j_block[0x10];
ghash(j_block, intermediate_buf, 0x10, NULL, false); ghash(j_block, intermediate_buf, 0x10, NULL, false);