From 85748c99c5d3abacd377b77e637fb16d8de34f3d Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Tue, 7 Jul 2020 11:20:29 -0400 Subject: [PATCH] Small NCA0 change. --- source/nca.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/nca.c b/source/nca.c index d78834b..719ed5e 100644 --- a/source/nca.c +++ b/source/nca.c @@ -42,7 +42,7 @@ static const u8 g_nca0KeyAreaHash[SHA256_HASH_SIZE] = { static bool ncaDecryptHeader(NcaContext *ctx); static bool ncaDecryptKeyArea(NcaContext *ctx); -NX_INLINE bool ncaCheckIfVersion0KeyAreaIsEncrypted(NcaContext *ctx); +NX_INLINE bool ncaIsVersion0KeyAreaEncrypted(NcaContext *ctx); NX_INLINE u8 ncaGetKeyGenerationValue(NcaContext *ctx); NX_INLINE bool ncaCheckRightsIdAvailability(NcaContext *ctx); @@ -88,7 +88,7 @@ bool ncaEncryptKeyArea(NcaContext *ctx) Aes128Context key_area_ctx = {0}; /* Check if we're dealing with a NCA0 with a plain text key area. */ - if (ctx->format_version == NcaVersion_Nca0 && !ncaCheckIfVersion0KeyAreaIsEncrypted(ctx)) + if (ncaIsVersion0KeyAreaEncrypted(ctx)) { memcpy(ctx->header.encrypted_keys, ctx->decrypted_keys, 0x40); return true; @@ -806,7 +806,7 @@ static bool ncaDecryptKeyArea(NcaContext *ctx) u8 key_count, tmp_kek[0x10] = {0}; /* Check if we're dealing with a NCA0 with a plain text key area. */ - if (ctx->format_version == NcaVersion_Nca0 && !ncaCheckIfVersion0KeyAreaIsEncrypted(ctx)) + if (ncaIsVersion0KeyAreaEncrypted(ctx)) { memcpy(ctx->decrypted_keys, ctx->header.encrypted_keys, 0x40); return true; @@ -841,7 +841,7 @@ static bool ncaDecryptKeyArea(NcaContext *ctx) return true; } -NX_INLINE bool ncaCheckIfVersion0KeyAreaIsEncrypted(NcaContext *ctx) +NX_INLINE bool ncaIsVersion0KeyAreaEncrypted(NcaContext *ctx) { if (!ctx || ctx->format_version != NcaVersion_Nca0) return false;