Commit Graph

73 Commits

Author SHA1 Message Date
Zach Hilman 42dc856ce1 crypto: Eliminate magic constants 2018-08-23 11:53:30 -04:00
Zach Hilman 61a5b56abd key_manager: Add support for autogenerated keys
Stored in a separate file than manual keys.
2018-08-23 11:53:30 -04:00
Zach Hilman f26fc64cb4 key_manager: Add support for KEK and SD seed derivation 2018-08-23 11:53:30 -04:00
Zach Hilman cde665c565 key_manager: Switch to boost flat_map for keys
Should make key gets marginally faster.
2018-08-23 11:53:30 -04:00
Zach Hilman c4845df3d4 xts_encryption_layer: Implement XTSEncryptionLayer 2018-08-23 11:52:44 -04:00
Zach Hilman 10e5356e9a aes_util: Make XTSTranscode stricter about sizes
XTS with Nintendo Tweak will fail mysteriously if the sector size is not 0x4000. Upgrade the critical log to an assert to prevent undefined behavior.
2018-08-23 11:52:44 -04:00
Zach Hilman 6dd369ab88 ctr_encryption_layer: Fix bug when transcoding small data
Fixes a bug where data lengths of less than size 0x10 will fail or have misleading return values.
2018-08-23 11:52:44 -04:00
Lioncash b39cd70cd4 common: Namespace hex_util.h/.cpp
It's in the common code, so it should be under the Common namespace like
everything else.
2018-08-15 23:24:00 -04:00
Zach Hilman a27ec24c0f crypto: Remove hex utilities from key_manager
Move to hex_util.h in common
2018-08-11 22:50:08 -04:00
Lioncash 0d04ee97dc aes_util: Add static assertion to Transcode() and XTSTranscode() to ensure well-defined behavior
These functions should only be given trivially-copyable types.
2018-08-04 17:30:52 -04:00
Lioncash 64c8212ae1 aes_util: Make CalculateNintendoTweak() an internally linked function
This function doesn't directly depend on class state, so it can be
hidden entirely from the interface in the cpp file.
2018-08-04 17:30:48 -04:00
Lioncash b25468b498 aes_util: Make Transcode() a const member function
This doesn't modify member state, so it can be made const.
2018-08-04 16:49:42 -04:00
Lioncash 8da651ac4d core/crypto: Remove unnecessary includes 2018-08-04 16:44:07 -04:00
Lioncash c1f76abfaf key_manager: Use regular std::string instead of std::string_view
The benefit of std::string_view comes from the idea of avoiding copies
(essentially acting as a non-owning view), however if we're just going
to copy into a local variable immediately, there's not much benefit
gained here.
2018-08-04 16:37:30 -04:00
Zach Hilman 187d8e215f Use more descriptive error codes and messages 2018-08-01 00:16:54 -04:00
Zach Hilman 9d59b96ef9 Use static const instead of const static 2018-08-01 00:16:54 -04:00
Zach Hilman 03149d3e4a Add missing includes and use const where applicable 2018-08-01 00:16:54 -04:00
Zach Hilman 150527ec19 Allow key loading from %YUZU_DIR%/keys in addition to ~/.switch 2018-08-01 00:16:54 -04:00
Zach Hilman 239a3113e4 Make XCI comply to review and style guidelines 2018-08-01 00:16:54 -04:00
Zach Hilman 22342487e8 Extract mbedtls to cpp file 2018-08-01 00:16:54 -04:00
Zach Hilman 83c3ae8be8 Add missing string.h include 2018-08-01 00:16:54 -04:00
Zach Hilman c54a10cb4f Update mbedtls and fix compile error 2018-08-01 00:16:54 -04:00
Zach Hilman df5b75694f Remove files that are not used 2018-08-01 00:16:54 -04:00