From bfdd9e056e96748606e19974b61f7d9da4d651f7 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Sun, 17 Dec 2023 19:03:08 +0100 Subject: [PATCH] poc: enable update option on ExeFS sections. --- code_templates/nxdt_rw_poc.c | 5 ++--- host/nxdt_host.py | 4 ++-- source/core/rsa.c | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/code_templates/nxdt_rw_poc.c b/code_templates/nxdt_rw_poc.c index bbea7f3..7050425 100644 --- a/code_templates/nxdt_rw_poc.c +++ b/code_templates/nxdt_rw_poc.c @@ -1970,8 +1970,7 @@ void updateNcaBasePatchList(TitleUserApplicationData *user_app_data, TitleInfo * freeNcaBasePatchList(); /* Only enable base/patch list if we're dealing with supported content types and/or FS section types. */ - if ((content_type == NcmContentType_Program || content_type == NcmContentType_Data || content_type == NcmContentType_HtmlDocument) && \ - section_type < NcaFsSectionType_Nca0RomFs && (section_type != NcaFsSectionType_PartitionFs || nca_fs_ctx->has_sparse_layer)) + if ((content_type == NcmContentType_Program || content_type == NcmContentType_Data || content_type == NcmContentType_HtmlDocument) && section_type < NcaFsSectionType_Nca0RomFs) { /* Retrieve corresponding TitleInfo linked list for the current title type. */ switch(title_type) @@ -2684,7 +2683,7 @@ static bool saveGameCardUid(void *userdata) u32 crc = 0; char *filename = NULL; - if (!gamecardGetSecurityInformation(&gc_security_information)) + if (!gamecardGetSecurityInformation(&gc_security_information)) { consolePrint("failed to get gamecard security information\n"); goto end; diff --git a/host/nxdt_host.py b/host/nxdt_host.py index f838262..860a67f 100644 --- a/host/nxdt_host.py +++ b/host/nxdt_host.py @@ -629,10 +629,10 @@ def usbGetDeviceEndpoints() -> bool: if not g_cliMode: utilsLogException(traceback.format_exc()) - g_logger.error('\nFatal error ocurred while enumerating USB devices.') + g_logger.error('Fatal error ocurred while enumerating USB devices.') if g_isWindows: - g_logger.error('\nTry reinstalling the libusbK driver using Zadig.') + g_logger.error('Try reinstalling the libusbK driver using Zadig.') return False diff --git a/source/core/rsa.c b/source/core/rsa.c index 9b9074a..74632dc 100644 --- a/source/core/rsa.c +++ b/source/core/rsa.c @@ -53,9 +53,9 @@ bool rsa2048OaepDecrypt(void *dst, size_t dst_size, const void *signature, const return false; } - mbedtls_entropy_context entropy; - mbedtls_ctr_drbg_context ctr_drbg; - mbedtls_rsa_context rsa; + mbedtls_entropy_context entropy = {0}; + mbedtls_ctr_drbg_context ctr_drbg = {0}; + mbedtls_rsa_context rsa = {0}; const char *pers = __func__; int mbedtls_ret = 0; @@ -118,12 +118,12 @@ static bool rsa2048VerifySha256BasedSignature(const void *data, size_t data_size } int mbedtls_ret = 0; - mbedtls_rsa_context rsa; + mbedtls_rsa_context rsa = {0}; u8 hash[SHA256_HASH_SIZE] = {0}; bool ret = false; /* Initialize RSA context. */ - mbedtls_rsa_init(&rsa, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); + mbedtls_rsa_init(&rsa, use_pss ? MBEDTLS_RSA_PKCS_V21 : MBEDTLS_RSA_PKCS_V15, MBEDTLS_MD_SHA256); /* Import RSA parameters. */ mbedtls_ret = mbedtls_rsa_import_raw(&rsa, (const u8*)modulus, RSA2048_BYTES, NULL, 0, NULL, 0, NULL, 0, (const u8*)public_exponent, public_exponent_size);