mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-12-23 09:02:06 +00:00
Trivial changes.
This commit is contained in:
parent
e7f2c927c2
commit
ee5a08f5d9
2 changed files with 8 additions and 4 deletions
11
source/nca.c
11
source/nca.c
|
@ -320,10 +320,10 @@ void ncaWriteHierarchicalIntegrityPatchToMemoryBuffer(NcaContext *ctx, NcaHierar
|
|||
|
||||
void ncaRemoveTitlekeyCrypto(NcaContext *ctx)
|
||||
{
|
||||
if (!ctx || !ctx->rights_id_available || !ctx->titlekey_retrieved) return;
|
||||
if (!ctx || ctx->content_size < NCA_FULL_HEADER_LENGTH || !ctx->rights_id_available || !ctx->titlekey_retrieved) return;
|
||||
|
||||
/* Copy decrypted titlekey to the decrypted NCA key area. */
|
||||
/* This will be reecrypted at a later stage. */
|
||||
/* This will be reencrypted at a later stage. */
|
||||
for(u8 i = 0; i < NCA_FS_HEADER_COUNT; i++)
|
||||
{
|
||||
/* AES-128-XTS is not used in FS sections from NCAs with titlekey crypto. */
|
||||
|
@ -342,12 +342,15 @@ void ncaRemoveTitlekeyCrypto(NcaContext *ctx)
|
|||
|
||||
bool ncaEncryptHeader(NcaContext *ctx)
|
||||
{
|
||||
if (!ctx || !strlen(ctx->content_id_str))
|
||||
if (!ctx || !strlen(ctx->content_id_str) || ctx->content_size < NCA_FULL_HEADER_LENGTH)
|
||||
{
|
||||
LOGFILE("Invalid NCA context!");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Safety check: don't encrypt the header if we don't need to. */
|
||||
if (!ctx->dirty_header) return true;
|
||||
|
||||
size_t crypt_res = 0;
|
||||
const u8 *header_key = keysGetNcaHeaderKey();
|
||||
Aes128XtsContext hdr_aes_ctx = {0}, nca0_fs_header_ctx = {0};
|
||||
|
@ -406,7 +409,7 @@ NX_INLINE bool ncaIsFsInfoEntryValid(NcaFsInfo *fs_info)
|
|||
|
||||
static bool ncaDecryptHeader(NcaContext *ctx)
|
||||
{
|
||||
if (!ctx || !strlen(ctx->content_id_str))
|
||||
if (!ctx || !strlen(ctx->content_id_str) || ctx->content_size < NCA_FULL_HEADER_LENGTH)
|
||||
{
|
||||
LOGFILE("Invalid NCA context!");
|
||||
return false;
|
||||
|
|
1
todo.txt
1
todo.txt
|
@ -1,6 +1,7 @@
|
|||
todo:
|
||||
|
||||
nca: function to write re-encrypted nca headers / nca fs headers (don't forget nca0 please)
|
||||
nca: function to patch the private npdm acid signature from a program nca + patch the acid signature from the nca header
|
||||
|
||||
tik: make sure the common crypto cert (XS20, XS22) is available when fakesigning a ticket
|
||||
tik: automatically dump tickets to the SD card?
|
||||
|
|
Loading…
Reference in a new issue