1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-10 04:31:44 +00:00
Commit graph

32 commits

Author SHA1 Message Date
Pablo Curiel
59d0e0ba90 bktr: handle compression in patches (part 1).
Some parts of the code need to be still need to be slightly restructured.

bktrIsBlockWithinIndirectStorageRange() must be updated as well, too.
2022-07-09 14:56:44 +02:00
Pablo Curiel
942a407247 Codebase cleanup.
Remove legacy code and trailing whitespace from all files.
2022-07-05 03:04:28 +02:00
Pablo Curiel
de6eb1a7e8 romfs: add support for Patch RomFS.
Uses the new NCA storage interface.

Also implemented ncaStorageGetHashTargetExtents().
2022-07-04 14:30:48 +02:00
Pablo Curiel
54046994a6 BKTR rewrite part 6: bktrReadAesCtrExStorage(). 2022-07-03 16:29:22 +02:00
Pablo Curiel
7a8daf8ba5 BKTR rewrite part 5: finish bktrReadSubStorage(). 2022-07-03 12:05:30 +02:00
Pablo Curiel
a427759dd1 BKTR rewrite part 3: finish BucketTreeVisitor.
Also fixed lots of storage table read bugs.

bktrReadIndirectStorage() is still incomplete -- check TODOs.
2022-07-03 00:37:13 +02:00
Pablo Curiel
29e5af2064 BKTR rewrite: part 1.
This is a mess. It won't build, so don't bother trying.
2022-07-02 12:09:49 +02:00
Pablo Curiel
e372b97131 nca: parse CompressionInfo struct. 2022-06-30 23:04:54 +02:00
Pablo Curiel
8d81528619 Add support for sparse NCAs. 2022-06-30 18:46:45 +02:00
Pablo Curiel
590495d012 bktr: added ID offset and title version checks. 2022-06-29 09:55:46 +02:00
Pablo Curiel
c1e3dc719f More NCA changes.
* Made ncaGenerateEncryptedFsSectionBlock() entirely private. There's no point in keeping it public.

* Moved NCA FS section context initialization into its own function, ncaInitializeFsSectionContext().

* Hash data boundaries are now checked while initializing each NCA FS section context, using ncaFsSectionValidateHashDataBoundaries(). Both ncaValidateHierarchicalSha256Offsets() and ncaValidateHierarchicalIntegrityOffsets() have been removed.

* Improved hash region access detection in _ncaReadFsSection() by implementing ncaFsSectionCheckHashRegionAccess().

* ncaGetFsSectionHashTargetProperties() is now used in pfs.c, romfs.c and bktr.c to retrieve the properties from the target hash layer.

* Updated sanity checks in pfsInitializeContext(), romfsInitializeContext() and bktrInitializeContext().
2022-06-29 08:55:35 +02:00
Pablo Curiel
2c4ddac4c6 nca: skip hash layer crypto operations if needed.
ncaInitializeContext(), _ncaReadFsSection() and ncaGenerateHashDataPatch() were all updated to reflect this change.

SHA3-256 support is still missing.
2022-06-25 08:03:27 +02:00
Pablo Curiel
8ce253d13d More NCA changes. 2022-06-24 19:39:15 +02:00
Pablo Curiel
bd2bf2c8f4 Fix NCA context initialization for NCAs that hold a single sparse FS section. 2022-06-24 03:38:58 +02:00
Pablo Curiel
37b63aee60 More NCA parsing changes. 2022-06-24 02:22:01 +02:00
Pablo Curiel
b8992d1fdc Follow latest Switchbrew changes. 2022-04-18 23:59:25 +02:00
Pablo Curiel
77fa25e0e0 HOS 14.0.0 shenanigans. 2022-03-22 02:20:09 +01:00
Pablo Curiel
e0cf57d8a5 nca: SparseInfo support (part 2).
Handle the has_sparse_flag wherever needed.
2022-03-21 03:19:39 +01:00
Pablo Curiel
8d8f19b229 nca: SparseInfo support (part 1).
Proper CTR IV and context are generated to decrypt the SparseInfo IndirectBucket. More to come at a later time.
2022-03-21 02:49:54 +01:00
Pablo Curiel
2fa61dc228 Update copyright year. 2022-03-17 13:58:40 +01:00
Pablo Curiel
278cb5c72a Some changes.
* nxdt_includes: renamed VersionType1 to Version and tweaked it to add the application_version struct, renamed VersionType2 to SdkAddOnVersion.

* gc_dumper: use utilsGeneratePath() to truncate generated filenames to safe filesystem limits. Thanks to n0tw0rk for reporting the issue and testing the changes!

* nxdt_host.py: fixed a string formatting issue that made it impossible to unpack data from the SendFileProperties command block under certain circumstances.

* gamecard: modified GameCardKeySource to add a value field, added GameCardFlags_HasCa10Certificate flag.

* utils: utilsGeneratePath() no longer adds a dot on its own if it's not part of the provided extension string.
2022-03-17 13:37:24 +01:00
Pablo Curiel
9cc1d64694 Update references to latest HOS version. 2022-01-20 18:09:03 +01:00
Pablo Curiel
421f0f1482 tik: fix building. 2021-12-02 15:31:56 +01:00
Pablo Curiel
132fa3c6f0 Some small NACP and Ticket fixes.
Thanks to @0Liam
2021-12-01 18:35:19 +01:00
Pablo Curiel
de1ba425a1 Update AuthoringTool XML generation to SDK 13.0.0.
Big thanks to @0Liam
2021-09-26 17:59:41 -04:00
Pablo Curiel
a2a401d36d More progress.
* Updated borealis fork (refer to https://github.com/DarkMatterCore/borealis/commits/nxdumptool-legacy).
* Updated NcaKeyGeneration enum.
* Commented out title task notification.
* Remove unnecessary instant view invalidations.
* NS application records are now retrieved using a loop.
* Fixed text alignment issues in RootView.
* Slightly improved gamecard notifications.
2021-07-19 17:09:58 -04:00
Pablo Curiel
c0e82b3686 Tidy up GameCardFwVersion, NcaKeyGeneration and NcaMainSignatureKeyGeneration enums.
Thanks @0Liam
2021-06-03 10:46:21 -04:00
Pablo Curiel
f526d4e6f4 Crypto changes.
* Implemented RSA-2048-PSS + SHA256 signature verification.

* Refactored RSA-2048-OAEP decryption steps to use mbedtls function calls.

* Implemented NCA header main signature verification.

* Replaced Björn Samuelsson's CRC32 algorithm with the hardware accelerated CRC32 checksum calculation from libnx (latest commit with support for calculation in blocks).
2021-05-21 09:34:43 -04:00
Pablo Curiel
f82d7a3db4 Small code refactor (part 2).
* Rewrote mutex handling throughout the code to use a small, macro-based scoped lock implementation.

* Removed extern variables from common.h - launch path management is now completely handled in utils.c.

* Updated NpdmSystemCallId_Count to reflect changes introduced in 12.0.0.

* Added NcaMainSignatureKeyGeneration enum.

* NCA main signature moduli are now retrieved from FS .rodata at runtime.

* Simplified lock management in usb.c by using a single global mutex with scoped locks instead of three different r/w locks.

* Updated FatFs to R0.14b.

* Enabled 64-bit LBA support in FatFs to potentially support custom eMMC replacements / resized USER partitions in the future.

* Updated LZ4 to v1.9.3.

* Fixed typos.

* USB gamecard dumper PoC now only dumps the Initial Data area.

* Updated to-do list.
2021-05-18 08:32:43 -04:00
Pablo Curiel
4c0c7d2c56 Small code refactor.
* Refactored keydata handling.

* Sealed NCA KAEKs are now generated at startup, and NCA key area entries are now decrypted by keysDecryptNcaKeyAreaEntry(), reducing the number of calls to spl functions.

* The eTicket RSA device key is now retrieved and decrypted at startup. RSA-OAEP wrapped titlekeys are now decrypted by keysDecryptRsaOaepWrappedTitleKey().

* Renamed titlekek -> ticket common key throughout the codebase.

* Added NcaKeyAreaEncryptionKeyIndex_Count and NcaKeyGeneration_Max enum values to nca.h.

* Proper usage of strcasecmp() in some functions.

* Moved syscall hint checks from keys.c to mem.c.

* Define illegal FS characters as an array rather than a char pointer.

* Services are now initialized before the CFW type checks.

* Fixed pcv/clkrst service initialization.

* Implemented additional thread safety and logfile output to service functions.

* Slightly tweaked running service checks.

* Added proper Markdown documentation for the USB ABI.
2021-05-11 02:00:33 -04:00
Pablo Curiel
6d08c7e94c Support HOS 12.0.x. 2021-04-20 18:43:37 -04:00
Pablo Curiel
c6c5667bf0 Change project layout + upgrade license to GPLv3. 2021-03-25 15:26:58 -04:00
Renamed from source/nca.h (Browse further)