From ffea336ecce54f4c3dcecbb9c72b2fa7f4abd228 Mon Sep 17 00:00:00 2001 From: shchmue Date: Sat, 5 Nov 2022 16:47:21 -0700 Subject: [PATCH] keys: Use SE size definitions --- source/keys/crypto.h | 2 +- source/keys/nfc_crypto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/keys/crypto.h b/source/keys/crypto.h index 4ea954f..f4bf14f 100644 --- a/source/keys/crypto.h +++ b/source/keys/crypto.h @@ -27,7 +27,7 @@ #include // Sha256 hash of the null string. -static const u8 null_hash[0x20] __attribute__((aligned(4))) = { +static const u8 null_hash[SE_SHA_256_SIZE] __attribute__((aligned(4))) = { 0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC, 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24, 0x27, 0xAE, 0x41, 0xE4, 0x64, 0x9B, 0x93, 0x4C, 0xA4, 0x95, 0x99, 0x1B, 0x78, 0x52, 0xB8, 0x55}; diff --git a/source/keys/nfc_crypto.c b/source/keys/nfc_crypto.c index 078d5e7..b6caa5e 100644 --- a/source/keys/nfc_crypto.c +++ b/source/keys/nfc_crypto.c @@ -27,7 +27,7 @@ void nfc_decrypt_amiibo_keys(key_storage_t *keys, nfc_save_key_t out_nfc_save_ke decrypt_aes_key(KS_AES_ECB, keys, kek, nfc_key_source, 0, 0); nfc_keyblob_t __attribute__((aligned(4))) nfc_keyblob; - static const u8 nfc_iv[SE_KEY_128_SIZE] = { + static const u8 nfc_iv[SE_AES_IV_SIZE] = { 0xB9, 0x1D, 0xC1, 0xCF, 0x33, 0x5F, 0xA6, 0x13, 0x2A, 0xEF, 0x90, 0x99, 0xAA, 0xCA, 0x93, 0xC8}; se_aes_key_set(KS_AES_CTR, kek, SE_KEY_128_SIZE); se_aes_crypt_ctr(KS_AES_CTR, &nfc_keyblob, sizeof(nfc_keyblob), encrypted_keys, sizeof(nfc_keyblob), &nfc_iv);