summaryrefslogtreecommitdiff
path: root/src/core/crypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: Use std::optional instead of boost::optional (#1578)Gravatar Frederic L2018-10-302-26/+27
| | | | | | | | | | | | | | | | * 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
* key_manager: Use isxdigit instead of isdigit when reading key fileGravatar Zach Hilman2018-10-271-1/+1
| | | | 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.
* key_manager: Remove unused variable in DeriveBase()Gravatar Lioncash2018-10-241-1/+0
|
* crypto: Use compressed sizes in offset calculation for KIP decompressionGravatar Zach Hilman2018-10-191-1/+2
| | | | Fixes a fatal crash on start when deriving keys.
* crypto: Various crypto fixes for quickstart guideGravatar Zach Hilman2018-10-141-2/+2
|
* partition_data_manager: Reserve and insert data within output vector in ↵Gravatar Lioncash2018-10-131-20/+16
| | | | | | | | | | | | | | | | | | | | DecryptPackage2() We can just reserve the memory then perform successive insertions instead of needing to use memcpy. This also avoids the need to zero out the output vector's memory before performing the insertions. We can also std::move the output std::vector into the destination so that we don't need to make a completely new copy of the vector, getting rid of an unnecessary allocation. Additionally, we can use iterators to determine the beginning and end ranges of the std::vector instances that comprise the output vector, as the end of one range just becomes the beginning for the next successive range, and since std::vector's iterator constructor copies data within the range [begin, end), this is more straightforward and gets rid of the need to have an offset variable that keeps getting incremented to determine where to do the next std::memcpy.
* partition_data_manager: Remove unused std::map instance within DecryptPackage2()Gravatar Lioncash2018-10-131-2/+0
| | | | | Aside from emplacing elements into the map, the map itself is never actually queried for contained data.
* partition_data_manager: Take package2_keys by const referenceGravatar Lioncash2018-10-132-2/+3
| | | | | These are only ever read from, so we don't need to make a copy of all the keys here.
* partition_data_manager: Move IV data to where it's needed in DecryptPackage2()Gravatar Lioncash2018-10-131-3/+1
| | | | | | 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.
* partition_data_manager: Remove commented out codeGravatar Lioncash2018-10-131-2/+0
| | | | | Commented out code shouldn't be left in without a reason indicating why in a comment.
* key_manager/partition_data_manager: Silence truncation compiler warningsGravatar Lioncash2018-10-134-10/+15
|
* partition_data_manager: Dehardcode array boundsGravatar Lioncash2018-10-132-7/+12
| | | | | | 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).
* partition_data_manager: Take VirtualFile by const reference in constructorGravatar Lioncash2018-10-132-2/+2
| | | | | | 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.
* partition_data_manager: Amend constructor initializer list orderGravatar Lioncash2018-10-131-2/+3
| | | | | Orders the members in the exact order they would be initialized. This also prevents compiler warnings about this sort of thing.
* partition_data_manager: Remove unused includesGravatar Lioncash2018-10-132-4/+1
| | | | | Gets unused includes out of the headers and moves them into the cpp file if they're used there instead.
* key_manager: Use std::vector's insert() instead of std::copy with a ↵Gravatar Lioncash2018-10-131-2/+2
| | | | | | | | 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.
* key_manager: Brace long conditional bodyGravatar Lioncash2018-10-131-1/+2
| | | | | If a conditional (or it's body) travels more than one line, it should be braced.
* key_manager: Don't assume file seeks and reads will always succeedGravatar Lioncash2018-10-131-7/+17
| | | | | | | | | | | | 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.
* key_manager: Remove unnecessary seek in DeriveSDSeed()Gravatar Lioncash2018-10-131-1/+0
| | | | | | 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.
* partition_data_manager: Rename system files for hekateGravatar Zach Hilman2018-10-074-178/+228
| | | | x
* crypto: Add PartitionDataManagerGravatar Zach Hilman2018-10-072-0/+690
| | | | Keeps track of system files for key derivation
* key_manager: Add support for loading keys from partition dataGravatar Zach Hilman2018-10-072-0/+88
|
* key_manager: Add ETicket key derivationGravatar Zach Hilman2018-10-072-2/+276
| | | | Derives titlekeys
* key_manager: Add base key derivationGravatar Zach Hilman2018-10-072-4/+220
| | | | Derives master keys, game encryption keys, and package1/2 keys
* key_manager: Add BIS key getterGravatar Zach Hilman2018-10-072-2/+19
|
* key_manager: Add support for more keysGravatar Zach Hilman2018-10-072-3/+99
| | | | TSEC, SBK, BIS, and other Sources for proper derivation
* key_manager: Add keyblob supportGravatar Zach Hilman2018-10-072-0/+14
|
* key_manager: Add support for crypto revisions past 04Gravatar Zach Hilman2018-10-071-43/+63
|
* key_manager: Add support for comments in keyfilesGravatar Zach Hilman2018-10-071-0/+3
|
* key_manager: Add support for console-specific keyfileGravatar Zach Hilman2018-10-072-3/+13
|
* key_manager: Rename KEK to KekGravatar Zach Hilman2018-10-072-8/+9
|
* Port #4182 from Citra: "Prefix all size_t with std::"Gravatar fearlessTobi2018-09-1510-47/+51
|
* game_list: Use RegisteredCacheUnion for installedGravatar Zach Hilman2018-09-041-1/+1
| | | | Reduces code
* aes_util: Fix error involving reads of less than 0x10Gravatar Zach Hilman2018-09-041-0/+14
| | | | Issues with block size are fixed by making all reads minimum length of 0x10
* nsp: Comply with style and performance guidelinesGravatar Zach Hilman2018-09-041-1/+1
|
* card_image: Parse XCI secure partition with NSPGravatar Zach Hilman2018-09-041-0/+2
| | | | Eliminated duplicate code and adds support for Rev1+ carts
* key_manager: Avoid autogeneration if key existsGravatar Zach Hilman2018-09-041-3/+13
|
* file_sys: Replace includes with forward declarations where applicableGravatar Lioncash2018-09-032-4/+8
| | | | | Cuts down on include dependencies, resulting in less files that need to be rebuilt when certain things are changed.
* file_sys/crypto: Fix missing/unnecessary includesGravatar Zach Hilman2018-08-244-4/+4
|
* key_manager: Eliminate indexed for loopGravatar Zach Hilman2018-08-231-6/+13
|
* key_manager: Create keys dir if it dosen't existGravatar Zach Hilman2018-08-231-0/+1
| | | | On call to WriteKeyToFile, so that the autogenerated file can be written.
* file_sys: Cut down on includes and copiesGravatar Zach Hilman2018-08-232-15/+13
|
* crypto: Eliminate magic constantsGravatar Zach Hilman2018-08-232-16/+19
|
* key_manager: Add support for autogenerated keysGravatar Zach Hilman2018-08-232-3/+45
| | | | Stored in a separate file than manual keys.
* key_manager: Add support for KEK and SD seed derivationGravatar Zach Hilman2018-08-232-5/+135
|
* key_manager: Switch to boost flat_map for keysGravatar Zach Hilman2018-08-232-32/+14
| | | | Should make key gets marginally faster.
* xts_encryption_layer: Implement XTSEncryptionLayerGravatar Zach Hilman2018-08-232-0/+80
|
* aes_util: Make XTSTranscode stricter about sizesGravatar Zach Hilman2018-08-231-5/+2
| | | | 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.
* ctr_encryption_layer: Fix bug when transcoding small dataGravatar Zach Hilman2018-08-231-5/+3
| | | | Fixes a bug where data lengths of less than size 0x10 will fail or have misleading return values.
* common: Namespace hex_util.h/.cppGravatar Lioncash2018-08-151-4/+4
| | | | | It's in the common code, so it should be under the Common namespace like everything else.