Commit Graph

113 Commits

Author SHA1 Message Date
Morph
96c9e67b1b aes_util: Remove malformed mbedtls_cipher_finish function call 2021-03-05 02:05:05 -05:00
Morph
806e2d7900 key_manager: Create the keys directory if it does not exist 2021-02-04 06:05:50 -05:00
ReinUsesLisp
4f13e270c8 core: Silence warnings when compiling without asserts 2021-01-05 04:18:16 -03:00
bunnei
3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash
be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash
39c8d18feb core/CMakeLists: Make some warnings errors
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.
2020-10-13 13:16:49 -04:00
Lioncash
e0dd440b1f crypto/key_manager: Remove dependency on the global system accessor
We can supply the content provider as an argument instead of hardcoding
a global accessor in the implementation.
2020-09-14 16:49:59 -04:00
bunnei
57e43682ed
Merge pull request #4564 from lioncash/file-include
file_sys: Replace inclusions with forward declarations where applicable
2020-09-02 23:06:38 -04:00
Lioncash
01d1b5cdaf file_sys: Replace inclusions with forward declarations where applicable
Same behavior, minus unnecessary inclusions where not necessary.
2020-08-23 17:02:55 -04:00
Lioncash
b62a8ca43e key_manager: Make data arrays constexpr
We can convert these maps into constexpr arrays to eliminate some
runtime static constructors.
2020-08-22 22:47:24 -04:00
bunnei
56c6a5def8
Merge pull request #4535 from lioncash/fileutil
common/fileutil: Convert namespace to Common::FS
2020-08-17 22:35:30 -04:00
bunnei
0530dd6ea1
Merge pull request #4494 from lioncash/transcode
aes_util: Make use of non-template variant of Transcode
2020-08-17 03:50:35 -04:00
Lioncash
c4ed791164 common/fileutil: Convert namespace to Common::FS
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.
2020-08-16 06:52:40 -04:00
bunnei
f5d538f118
Merge pull request #4483 from lioncash/constexpr-hex
partition_data_manager: Make data arrays constexpr
2020-08-06 23:14:14 -04:00
Lioncash
4f2acc54f5 partition_data_manager: Update master key hashes
Fills in some hashes that were previously unhandled.
2020-08-06 02:42:01 -04:00
Lioncash
7f0f37fca7 partition_data_manager: Make data arrays constexpr
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.
2020-08-06 02:41:58 -04:00
Lioncash
04bb47f57f partition_data_manager: Eliminate magic value
We can use sizeof to make it obvious at the call site where the value is
coming from.
2020-08-06 02:34:10 -04:00
Lioncash
09f884b7bd aes_util: Make use of non-template variant of Transcode
Same behavior, less template instantiations.
2020-08-06 02:31:19 -04:00
Lioncash
15660bd857 aes_util: Allow SetIV to be non-allocating
In a few places, the data to be set as the IV is already within an array.
We shouldn't require this data to be heap-allocated if it doesn't need
to be. This allows certain callers to reduce heap churn.
2020-08-03 14:29:58 -04:00
Morph
7351ca8c75 KeyManager: Prevent writing of invalid keys
If the keys are zero, don't write them to the autogenerated file.
2020-07-10 00:39:00 -04:00
Lioncash
fb13f053bb key_manager: Correct casing of instance()
Our codebase uppercases member function names.
2020-07-01 00:28:50 -04:00
Lioncash
c91710a82f key_manager: Delete move operations
Prevents the singleton from being moved from.
2020-07-01 00:24:38 -04:00
Lioncash
00a1d106bd key_manager: Make use of canonical deleted operator=
operator= typically returns a reference, it's not void.

While we're at it, we can correct the parameter formatting to adhere to the
codebase.
2020-07-01 00:21:31 -04:00
FearlessTobi
9f82a9a244 crypto: Make KeyManager a singleton class
Previously, we were reading the keys everytime a KeyManager object was created, causing yuzu to reread the keys file multiple hundreds of times when loading the game list.
With this change, it is only loaded once.
On my system, this decreased game list loading times by a factor of 20.
2020-05-20 21:28:16 +02:00
bunnei
2409fedacf
Merge pull request #3697 from lioncash/declarations
CMakeLists: Enable -Wmissing-declarations on Linux builds
2020-04-23 02:18:52 -04:00
Lioncash
e2d8be1ca2 General: Resolve warnings related to missing declarations 2020-04-16 23:43:34 -04:00
Lioncash
8f9c599c9f key_manager: Resolve missing field initializer warning 2020-04-16 22:45:44 -04:00
bunnei
3e0e4f146b
Merge pull request #3091 from lioncash/core-conversion
core: Make most implicit type conversion warnings errors on MSVC
2019-11-15 12:08:50 -05:00
bunnei
360b0d1b30
Merge pull request #3093 from lioncash/mbedtls
core: Migrate off deprecated mbedtls functions
2019-11-14 13:47:23 -05:00
Lioncash
64cbebc58f key_manager: Make use of IOFile in WriteKeyToFile()
This properly handles unicode-based paths on Windows, while opening a
raw stream doesn't out-of-the-box.

Prevents file creation from potentially failing on Windows PCs that make
use of unicode characters in their save paths (e.g. writing to a user's
AppData folder, where the user has a name with non-ASCII characters).
2019-11-12 08:52:18 -05:00
Lioncash
e0c46e6879 core: Migrate off deprecated mbedtls functions
These functions are marked for deprecation and it's recommended that the
*_ret variants be used instead.
2019-11-12 08:45:56 -05:00
Lioncash
47a6bb2d5b externals: Update httplib
Since the introduction of this library, numerous improvements have been
made. Notably, many of the warnings we would get by simply including the
library header have now been fixed. This makes it much easier to make
conversion warning an error.
2019-11-12 08:31:27 -05:00
Lioncash
581d2e36e5 crypto: Resolve sign-conversion warnings 2019-11-12 07:55:22 -05:00
vperus
29b1d0db0f [crypto] Use IsAllZeroArray helper function 2019-10-02 19:20:45 +03:00
Zach Hilman
b4164d295b partition_data_manager: Add accessor for decrypted PRODINFO partition 2019-09-21 16:43:10 -04:00
Zach Hilman
50d5414075 key_manager: Convert Ticket union to std::variant 2019-07-07 21:38:33 -04:00
Zach Hilman
d9ef20e5a5 es: Populate/synthesize tickets on construction 2019-07-07 21:38:33 -04:00
Zach Hilman
f8718ae779 key_manager: Add structure for Ticket parsing 2019-07-07 21:38:33 -04:00
Zach Hilman
e35fac2054 key_manager: Add accessors/helpers for ticket management 2019-07-07 21:38:33 -04:00
Zach Hilman
5275fd2789 key_manager: Add equality operator for RSAKeyPair 2019-07-07 21:38:33 -04:00
bunnei
e2f7933b3f
Merge pull request #2546 from DarkLordZach/kips
loader, file_sys: Add support for parsing and loading KIP (Kernel Internal Process) files
2019-06-21 14:28:18 -04:00
Lioncash
a62088539e
common/hex_util: Combine HexVectorToString() and HexArrayToString()
These can be generified together by using a concept type to designate
them. This also has the benefit of not making copies of potentially very
large arrays.
2019-06-12 17:54:05 -04:00
Zach Hilman
0f37096820 partition_data_manager: Remove KIP processing and use FileSys
Previously, this TU contained the necessary headers to parse KIP/INI but now it should just use the FileSys class.
2019-06-05 00:19:29 -04:00
Zach Hilman
60f39060c6 core: Port current uses of RegisteredCache to ContentProvider 2019-03-26 22:05:37 -04:00
Jungy
3273f93cd5 Fixes Unicode Key File Directories (#2120)
* Fixes Unicode Key File Directories

Adds code so that when loading a file it converts to UTF16 first, to
ensure the files can be opened. Code borrowed from FileUtil::Exists.

* Update src/core/crypto/key_manager.cpp

Co-Authored-By: Jungorend <Jungorend@users.noreply.github.com>

* Update src/core/crypto/key_manager.cpp

Co-Authored-By: Jungorend <Jungorend@users.noreply.github.com>

* Using FileUtil instead to be cleaner.

* Update src/core/crypto/key_manager.cpp

Co-Authored-By: Jungorend <Jungorend@users.noreply.github.com>
2019-02-20 21:24:25 -05:00
bunnei
173073c722
Merge pull request #1836 from lioncash/unused
crypto/key_manager: Remove unused variable in GetTicketblob()
2018-12-04 18:28:15 -05:00
Lioncash
db4523f1ec filesystem: De-globalize registered_cache_union
We can just return a new instance of this when it's requested. This only
ever holds pointers to the existing registed caches, so it's not a large
object. Plus, this also gets rid of the need to keep around a separate
member function just to properly clear out the union.

Gets rid of one of five globals in the filesystem code.
2018-12-01 23:43:23 -05:00
Lioncash
a8aca4306d crypto/key_manager: Remove unused variable in GetTicketblob() 2018-12-01 22:37:51 -05:00
Frederic L
7a5eda5914 global: Use std::optional instead of boost::optional (#1578)
* get rid of boost::optional

* Remove optional references

* Use std::reference_wrapper for optional references

* Fix clang format

* Fix clang format part 2

* Adressed feedback

* Fix clang format and MacOS build
2018-10-30 00:03:25 -04:00
Zach Hilman
1fa31cf74d key_manager: Use isxdigit instead of isdigit when reading key file
Crypto revisions are hex numbers and this function only checks if the string is valid for stoul in base 16, so it should be isxdigit.
2018-10-27 21:56:10 -04:00