aboutsummaryrefslogtreecommitdiff
path: root/src/core/crypto
Commit message (Collapse)AuthorAgeFilesLines
* [core] Support block-compressed NSZ and XCZ (#4552)PavelBARABANOV8 days2-0/+465
| | | | | | | | | | | | | | | | | | | | | | | | | - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Add NCZBLOCK (nsz -B / .xcz) reader: each read decodes only the covered blocks and re-encrypts CTR sections, no disk output. - Allow installing solid .nsz to NAND via DecompressNCZForInstall (lazy, incremental decode with frontier, O(n) instead of O(n^2)). - Accept BKTR updates with thousands of sections (MaxSectionCount = 0x10000). - Wire .nsz/.xcz into loader, registered cache, scanner, and NAND install (content_manager.h), and reject solid NCZ from the game list. - Bump the pinned zstd to 33618c8 in cpmfile.json, which includes the upstream AArch64 revert ([33618c89](https://github.com/facebook/zstd/commit/33618c89e511637f8a6ef955b3501766d71feb53)) for a ZSTD_decodeSequence branch optimization that could corrupt data on ARM64; without it, solid NCZ decoding on Android fails with "Data corruption detected". NCZ format and CTR counter semantics follow the reference nsz tool and its Rust port: - https://github.com/nicoboss/nsz (Decompressor.py, BlockDecompressorReader.py) - https://docs.rs/nsz-rs/0.3.0/src/nsz_rs/decompress.rs.html The last-block edge case (decompressed size is an exact multiple of block size) is handled as described in https://github.com/nicoboss/nsz/issues/210 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4552 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
* [common] rework BitField and BitUtil, use concepts whenever possible (#4076)lizzie2026-07-094-436/+305
| | | | | | | | | | test no regressions especially on Liiinux Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4076 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [settings] Add back & properly implement use_dev_keys (#3631)smiRaphi2026-03-082-4/+15
| | | | | | | | | | Was removed recently but also wasn't really working before, this adds it to the debug UI (under the kiosk option) and also makes it properly reload the keys on launch & setting change. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3631 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: smiRaphi <neogt404@gmail.com> Co-committed-by: smiRaphi <neogt404@gmail.com>
* [ports] Remove ENABLE_OPENSSL and mbedtls nixos remnants (#3638)lizzie2026-03-013-34/+4
| | | | | | | | | | | | shell.nix still had references to mbedtls Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3638 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: DraVee <dravee@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [crypto] Atomize all traces of MbedTLS, and require OpenSSL 3+ (#3606)lizzie2026-02-234-110/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #3137 Closes #3465 - Replace all mbedtls usage with OpenSSL - require OpenSSL - Up OpenSSL version to 3, cuz that's what we actually need... CAVEATS: - httplib also now required - other ssl backends for svc are unused, maybe remove later * To be fair, our CI never used them anyways. And we never tested those TESTERS PLEASE TEST: - All games and applets boot - Boot, load, exit, etc. times Co-authored-by: crueter <crueter@eden-emu.dev> Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3606 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: DraVee <dravee@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [qt, settings] allow to set custom unit and battery serial (#2813)lizzie2025-11-242-35/+17
| | | | | | | | | | | Also removes "use dev keys" option since it's not even present on UI and it's just a file redirection anyways Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2813 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [crypto] Rework AES CTR/XTS streaming and squash heap churn (#2782)godpow2025-10-263-106/+152
| | | | | | | | | | | | | | | | AES Updates: Replaced heap churn with stack scratch buffers tail handling now stays in-place, no more recursive transcode detours. CTR/XTS modes read in larger, aligned chunks and still handle odd offsets cleanly. XTS prefetches a few sectors ahead to reduce extra reads. AesCtrStorage writer now uses the pooled buffer properly one stack slab, chunk forward, bump counter, repeat. Result: less malloc noise, fewer watchdog spikes at startup (though mbedtls still sets the pace). This should make the loading speed slightly better than before. Make sure to test. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2782 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: godpow <thesaviorsrule@yahoo.com> Co-committed-by: godpow <thesaviorsrule@yahoo.com>
* [nca] Use better tight loop allocation schemes (none at all) for AES ↵lizzie2025-10-173-77/+121
| | | | | | | | | | | | | | | | decrypt/encrypt and force MbedTLS to use AES x86_64 instructions (#2750) Uses stack instead of allocating stuff haphazardly (16 bytes and 512 bytes respectively) - removes malloc() pollution and all that nasty stuff from tight loops Original work by Ribbit but edited by me. Will NOT bring a massive speedup since the main bottleneck is mbedtls itself, but may bring nice oddities to STARTUP TIMES nonetheless. AES instructions being forced wont affect CPUs without them since there is always a runtime check for them. Signed-off-by: lizzie lizzie@eden-emu.dev Co-authored-by: Ribbit <ribbit@placeholder.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2750 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [core] Remove key hashes and hash checks (#2552)Maufeat2025-09-233-399/+17
| | | | | | | | | | I've removed all hardcoded key hashes as they are not required and to avoid possible legal issues. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2552 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: Maufeat <sahyno1996@gmail.com> Co-committed-by: Maufeat <sahyno1996@gmail.com>
* [meta] fix license headers (#2547)lizzie2025-09-213-0/+9
| | | | | | | Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2547 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake, core] refactor: update mbedtls and make YUZU_USE_CPM better (#485)crueter2025-09-153-4/+4
| | | | | | | | | | | | | | | update mbedtls functors to support mbedtls3 signatures moved some vulkan stuff from externals to root, yuzu_use_cpm manages them now needs testing: - all key/derivation related things - nca verification - game loading/updates/stuff Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/485 Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-2/+2
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] CPMUtil: formatting, git_host, new repos, more system deps, libusb ↵crueter2025-09-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | (#392) I promise I'm a UI developer - mbedtls can now be used as a system package - zycore can now be used as a system package - cleaned up dynarmic externals - fixed libusb incorrectly showing as bundled - add version/tag formatting to JSON - add custom GIT_HOST option for packages - moved some of my repos to my new git - slightly better version identification - combined VUL/VH since they are codependent (using my combo vendor) - fix cpmfile inclusion - remove libusb submodule This PR succeeds #383 since it includes it Co-authored-by: SDK Chan <sdkchan@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/392 Co-authored-by: crueter <crueter@crueter.xyz> Co-committed-by: crueter <crueter@crueter.xyz>
* User Data Migration from Citron, Sudachi, and Yuzu (#91)swurl2025-05-081-7/+7
| | | | | | | | | | | | Includes citron, sudachi, yuzu currently broken, because the eden dir is always made early? Signed-off-by: swurl <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/91 Co-authored-by: swurl <swurl@swurl.xyz> Co-committed-by: swurl <swurl@swurl.xyz>
* Update fmt to allow for v11crueter2025-04-101-1/+1
| | | Signed-off-by: swurl <swurl@swurl.xyz>
* vfs: Move vfs files to their own directoryFearlessTobi2024-01-254-6/+6
|
* key_manager: Remove uncaught usage of stoullat9nq2023-09-131-4/+4
|
* core: Add support for loading NSPs with personalized tickets. (#10048)Steveice102023-09-052-106/+179
| | | | Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
* android: frontend: Integrate key installation for SAF.bunnei2023-06-032-2/+2
|
* core: crypto: key_manager: Add methods to reload & validate keys.bunnei2023-06-032-0/+11
|
* general: fix spelling mistakesLiam2023-03-123-3/+3
|
* crypto: use user-provided keys whenever possibleValeri2022-11-271-4/+4
| | | Solves an issue where autogenerated title keys would take precedence over those provided by user.
* common: Change semantics of UNREACHABLE to unconditionally crashLiam2022-06-131-2/+0
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-2314-42/+28
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* core: Fix transitive include build errorsameerj2021-11-031-0/+1
|
* core: Remove unused includesameerj2021-11-035-8/+0
|
* General: Resolve fmt specifiers to adhere to 8.0.0 API where applicableLioncash2021-06-231-1/+1
| | | | Also removes some deprecated API usages.
* common: fs: Rework the Common Filesystem interface to make use of ↵Morph2021-05-252-66/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::filesystem (#6270) * common: fs: fs_types: Create filesystem types Contains various filesystem types used by the Common::FS library * common: fs: fs_util: Add std::string to std::u8string conversion utility * common: fs: path_util: Add utlity functions for paths Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library * common: fs: file: Rewrite the IOFile implementation * common: fs: Reimplement Common::FS library using std::filesystem * common: fs: fs_paths: Add fs_paths to replace common_paths * common: fs: path_util: Add the rest of the path functions * common: Remove the previous Common::FS implementation * general: Remove unused fs includes * string_util: Remove unused function and include * nvidia_flags: Migrate to the new Common::FS library * settings: Migrate to the new Common::FS library * logging: backend: Migrate to the new Common::FS library * core: Migrate to the new Common::FS library * perf_stats: Migrate to the new Common::FS library * reporter: Migrate to the new Common::FS library * telemetry_session: Migrate to the new Common::FS library * key_manager: Migrate to the new Common::FS library * bis_factory: Migrate to the new Common::FS library * registered_cache: Migrate to the new Common::FS library * xts_archive: Migrate to the new Common::FS library * service: acc: Migrate to the new Common::FS library * applets/profile: Migrate to the new Common::FS library * applets/web: Migrate to the new Common::FS library * service: filesystem: Migrate to the new Common::FS library * loader: Migrate to the new Common::FS library * gl_shader_disk_cache: Migrate to the new Common::FS library * nsight_aftermath_tracker: Migrate to the new Common::FS library * vulkan_library: Migrate to the new Common::FS library * configure_debug: Migrate to the new Common::FS library * game_list_worker: Migrate to the new Common::FS library * config: Migrate to the new Common::FS library * configure_filesystem: Migrate to the new Common::FS library * configure_per_game_addons: Migrate to the new Common::FS library * configure_profile_manager: Migrate to the new Common::FS library * configure_ui: Migrate to the new Common::FS library * input_profiles: Migrate to the new Common::FS library * yuzu_cmd: config: Migrate to the new Common::FS library * yuzu_cmd: Migrate to the new Common::FS library * vfs_real: Migrate to the new Common::FS library * vfs: Migrate to the new Common::FS library * vfs_libzip: Migrate to the new Common::FS library * service: bcat: Migrate to the new Common::FS library * yuzu: main: Migrate to the new Common::FS library * vfs_real: Delete the contents of an existing file in CreateFile Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now. * input_profiles: Don't iterate the input profile dir if it does not exist Silences an error produced in the log if the directory does not exist. * game_list_worker: Skip parsing file if the returned VfsFile is nullptr Prevents crashes in GetLoader when the virtual file is nullptr * common: fs: Validate paths for path length * service: filesystem: Open the mod load directory as read only
* core: Make variable shadowing a compile-time errorLioncash2021-05-163-4/+4
| | | | | | Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely.
* aes_util: Make use of std::spanLioncash2021-04-232-9/+5
| | | | | Allows us to simplify the interface quite a bit as it will handle contiguous sequences for us.
* common: Move settings to common from core.bunnei2021-04-141-1/+1
| | | | - Removes a dependency on core and input_common from common.
* aes_util: Remove malformed mbedtls_cipher_finish function callMorph2021-03-051-2/+0
|
* key_manager: Create the keys directory if it does not existMorph2021-02-041-0/+5
|
* core: Silence warnings when compiling without assertsReinUsesLisp2021-01-051-6/+5
|
* Revert "core: Fix clang build"bunnei2020-10-202-6/+3
|
* core: Fix clang buildLioncash2020-10-172-3/+6
| | | | | | | Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795
* core/CMakeLists: Make some warnings errorsLioncash2020-10-131-1/+1
| | | | | | | | | Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
* crypto/key_manager: Remove dependency on the global system accessorLioncash2020-09-142-5/+8
| | | | | We can supply the content provider as an argument instead of hardcoding a global accessor in the implementation.
* Merge pull request #4564 from lioncash/file-includebunnei2020-09-021-0/+1
|\ | | | | file_sys: Replace inclusions with forward declarations where applicable
| * file_sys: Replace inclusions with forward declarations where applicableLioncash2020-08-231-0/+1
| | | | | | | | Same behavior, minus unnecessary inclusions where not necessary.
* | key_manager: Make data arrays constexprLioncash2020-08-222-75/+82
|/ | | | | We can convert these maps into constexpr arrays to eliminate some runtime static constructors.
* Merge pull request #4535 from lioncash/fileutilbunnei2020-08-172-112/+178
|\ | | | | common/fileutil: Convert namespace to Common::FS
| * common/fileutil: Convert namespace to Common::FSLioncash2020-08-162-112/+178
| | | | | | | | | | | | | | | | | | | | | | | | Migrates a remaining common file over to the Common namespace, making it consistent with the rest of common files. This also allows for high-traffic FS related code to alias the filesystem function namespace as namespace FS = Common::FS; for more concise typing.
* | Merge pull request #4494 from lioncash/transcodebunnei2020-08-172-3/+3
|\ \ | |/ |/| aes_util: Make use of non-template variant of Transcode
| * partition_data_manager: Eliminate magic valueLioncash2020-08-061-2/+2
| | | | | | | | | | We can use sizeof to make it obvious at the call site where the value is coming from.
| * aes_util: Make use of non-template variant of TranscodeLioncash2020-08-061-1/+1
| | | | | | | | Same behavior, less template instantiations.
* | Merge pull request #4483 from lioncash/constexpr-hexbunnei2020-08-062-98/+118
|\ \ | |/ |/| partition_data_manager: Make data arrays constexpr
| * partition_data_manager: Update master key hashesLioncash2020-08-061-5/+5
| | | | | | | | Fills in some hashes that were previously unhandled.
| * partition_data_manager: Make data arrays constexprLioncash2020-08-062-98/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously the constructor for all of these would run at program startup, consuming time before the application can enter main(). This is also particularly dangerous, given the logging system wouldn't have been initialized properly yet, yet the program would use the logs to signify an error. To rectify this, we can replace the literals with constexpr functions that perform the conversion at compile-time, completely eliminating the runtime cost of initializing these arrays.