From 4d537956f0e07c9ee152d4d78f9404283a36ca00 Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 15 May 2018 21:26:40 +0800 Subject: [PATCH] [nx] Add proper padding to nx::sKeyDataArea (xci) --- lib/libnx/include/nx/xci.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libnx/include/nx/xci.h b/lib/libnx/include/nx/xci.h index 849a033..751e71d 100644 --- a/lib/libnx/include/nx/xci.h +++ b/lib/libnx/include/nx/xci.h @@ -115,9 +115,11 @@ namespace nx struct sKeyDataArea { sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]} - byte_t encrypted_00[0x200*6]; // AES128-CTR encrypted {titlekey[16]} - byte_t encrypted_00_aesctr_data[0x100]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]} - byte_t reserved_01[0x100]; + byte_t reserved_00[xci::kPageSize - sizeof(sInitialData)]; + byte_t encrypted_00[xci::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]} + byte_t encrypted_00_aesctr_data[crypto::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]} + byte_t reserved_01[xci::kPageSize - crypto::rsa::kRsa2048Size]; }; // sizeof() = 512*8 (8 pages) + #pragma pack(pop) }