Lioncash
781fd7983c
partition_data_manager: Remove unused std::map instance within DecryptPackage2()
Aside from emplacing elements into the map, the map itself is never
actually queried for contained data.
8 years ago
Lioncash
e0c76226ad
partition_data_manager: Take package2_keys by const reference
These are only ever read from, so we don't need to make a copy of all
the keys here.
8 years ago
Lioncash
3d9df49619
partition_data_manager: Move IV data to where it's needed in DecryptPackage2()
Given it's only used in one spot and has a fairly generic name, we can
just specify it directly in the function call. This also the benefit of
automatically moving it.
8 years ago
Lioncash
bc2196bb09
partition_data_manager: Remove commented out code
Commented out code shouldn't be left in without a reason indicating why
in a comment.
8 years ago
Lioncash
6da2ed4232
key_manager/partition_data_manager: Silence truncation compiler warnings
8 years ago
Lioncash
f56a8da46a
partition_data_manager: Dehardcode array bounds
Instead, we can make it part of the type and make named variables for
them, so they only require one definition (and if they ever change for
whatever reason, they only need to be changed in one spot).
8 years ago
Lioncash
d257a3b56c
partition_data_manager: Take VirtualFile by const reference in constructor
Given the VirtualFile instance isn't stored into the class as a data
member, or written to, this can just be turned into a const reference,
as the constructor doesn't need to make a copy of it.
8 years ago
Lioncash
e96d69c328
partition_data_manager: Amend constructor initializer list order
Orders the members in the exact order they would be initialized. This
also prevents compiler warnings about this sort of thing.
8 years ago
Lioncash
aaca7543f0
partition_data_manager: Remove unused includes
Gets unused includes out of the headers and moves them into the cpp file
if they're used there instead.
8 years ago
Lioncash
06898263f6
key_manager: Use std::vector's insert() instead of std::copy with a back_inserter
If the data is unconditionally being appended to the back of a
std::vector, we can just directly insert it there without the need to
insert all of the elements one-by-one with a std::back_inserter.
8 years ago
Lioncash
e70c08b543
key_manager: Brace long conditional body
If a conditional (or it's body) travels more than one line, it should be
braced.
8 years ago
Lioncash
ef5639bfbb
key_manager: Don't assume file seeks and reads will always succeed
Given the filesystem should always be assumed to be volatile, we should
check and bail out if a seek operation isn't successful. This'll prevent
potentially writing/returning garbage data from the function in rare
cases.
This also allows removing a check to see if an offset is within the
bounds of a file before perfoming a seek operation. If a seek is
attempted beyond the end of a file, it will fail, so this essentially
combines two checks into one in one place.
8 years ago
Lioncash
82ea1cf35a
key_manager: Remove unnecessary seek in DeriveSDSeed()
Given the file is opened a few lines above and no operations are done,
other than check if the file is in a valid state, the read/write pointer
will always be at the beginning of the file.
8 years ago
Zach Hilman
3ec054643e
partition_data_manager: Rename system files for hekate
x
8 years ago
Zach Hilman
29dc6f4519
crypto: Add PartitionDataManager
Keeps track of system files for key derivation
8 years ago
Zach Hilman
4aad010f7a
key_manager: Add support for loading keys from partition data
8 years ago
Zach Hilman
d041d6231c
key_manager: Add ETicket key derivation
Derives titlekeys
8 years ago
Zach Hilman
a57aac5772
key_manager: Add base key derivation
Derives master keys, game encryption keys, and package1/2 keys
8 years ago
Zach Hilman
d7398283e3
key_manager: Add BIS key getter
8 years ago
Zach Hilman
d6a0d5d432
key_manager: Add support for more keys
TSEC, SBK, BIS, and other Sources for proper derivation
8 years ago
Zach Hilman
c79d2ca6cf
key_manager: Add keyblob support
8 years ago
Zach Hilman
e4602748d6
key_manager: Add support for crypto revisions past 04
8 years ago
Zach Hilman
9e34303fb9
key_manager: Add support for comments in keyfiles
8 years ago
Zach Hilman
ce05df0a6d
key_manager: Add support for console-specific keyfile
8 years ago
Zach Hilman
721632fe66
key_manager: Rename KEK to Kek
8 years ago
fearlessTobi
63c2e32e20
Port #4182 from Citra: "Prefix all size_t with std::"
8 years ago
Zach Hilman
d2caf4af7d
game_list: Use RegisteredCacheUnion for installed
Reduces code
8 years ago
Zach Hilman
99fbcb3bf2
aes_util: Fix error involving reads of less than 0x10
Issues with block size are fixed by making all reads minimum length of 0x10
8 years ago
Zach Hilman
e4e55d064e
nsp: Comply with style and performance guidelines
8 years ago
Zach Hilman
5c8aff984e
card_image: Parse XCI secure partition with NSP
Eliminated duplicate code and adds support for Rev1+ carts
8 years ago
Zach Hilman
d770c60205
key_manager: Avoid autogeneration if key exists
8 years ago
Lioncash
a813c10e1c
file_sys: Replace includes with forward declarations where applicable
Cuts down on include dependencies, resulting in less files that need to
be rebuilt when certain things are changed.
8 years ago
Zach Hilman
6314a799aa
file_sys/crypto: Fix missing/unnecessary includes
8 years ago
Zach Hilman
ccfd176382
key_manager: Eliminate indexed for loop
8 years ago
Zach Hilman
119ab308b5
key_manager: Create keys dir if it dosen't exist
On call to WriteKeyToFile, so that the autogenerated file can be written.
8 years ago
Zach Hilman
a7e8d10969
file_sys: Cut down on includes and copies
8 years ago
Zach Hilman
42dc856ce1
crypto: Eliminate magic constants
8 years ago
Zach Hilman
61a5b56abd
key_manager: Add support for autogenerated keys
Stored in a separate file than manual keys.
8 years ago
Zach Hilman
f26fc64cb4
key_manager: Add support for KEK and SD seed derivation
8 years ago
Zach Hilman
cde665c565
key_manager: Switch to boost flat_map for keys
Should make key gets marginally faster.
8 years ago
Zach Hilman
c4845df3d4
xts_encryption_layer: Implement XTSEncryptionLayer
8 years ago
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.
8 years ago
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.
8 years ago
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.
8 years ago
Zach Hilman
a27ec24c0f
crypto: Remove hex utilities from key_manager
Move to hex_util.h in common
8 years ago
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.
8 years ago
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.
8 years ago
Lioncash
b25468b498
aes_util: Make Transcode() a const member function
This doesn't modify member state, so it can be made const.
8 years ago
Lioncash
8da651ac4d
core/crypto: Remove unnecessary includes
8 years ago
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.
8 years ago