From 5e33b4f57d85e58b3c49bdd09b1f2688e5b08ec1 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 27 Apr 2018 04:33:55 -0600 Subject: [PATCH] Fix use-after-free in key derivation --- pki.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pki.c b/pki.c index 10c2c5b..4376d95 100644 --- a/pki.c +++ b/pki.c @@ -891,7 +891,7 @@ void pki_derive_keys(nca_keyset_t *keyset) { continue; } aes_ctx_t *mac_gen_ctx = new_aes_ctx(&keyset->keyblob_keys[i], 0x10, AES_MODE_ECB); - aes_decrypt(sbk_ctx, &keyset->keyblob_mac_keys[i], keyset->keyblob_mac_key_source, 0x10); + aes_decrypt(mac_gen_ctx, &keyset->keyblob_mac_keys[i], keyset->keyblob_mac_key_source, 0x10); free_aes_ctx(mac_gen_ctx); } for (unsigned int i = 0; i < 0x20; i++) {