summaryrefslogtreecommitdiffstats
path: root/src/core/crypto (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-12-02filesystem: De-globalize registered_cache_unionLioncash1-1/+1
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-02crypto/key_manager: Remove unused variable in GetTicketblob()Lioncash1-1/+0
2018-10-30global: Use std::optional instead of boost::optional (#1578)Frederic L2-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
2018-10-28key_manager: Use isxdigit instead of isdigit when reading key fileZach Hilman1-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.
2018-10-24key_manager: Remove unused variable in DeriveBase()Lioncash1-1/+0
2018-10-20crypto: Use compressed sizes in offset calculation for KIP decompressionZach Hilman1-1/+2
Fixes a fatal crash on start when deriving keys.
2018-10-15crypto: Various crypto fixes for quickstart guideZach Hilman1-2/+2
2018-10-13partition_data_manager: Reserve and insert data within output vector in DecryptPackage2()Lioncash1-20/+16
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.
2018-10-13partition_data_manager: Remove unused std::map instance within DecryptPackage2()Lioncash1-2/+0
Aside from emplacing elements into the map, the map itself is never actually queried for contained data.
2018-10-13partition_data_manager: Take package2_keys by const referenceLioncash2-2/+3
These are only ever read from, so we don't need to make a copy of all the keys here.
2018-10-13partition_data_manager: Move IV data to where it's needed in DecryptPackage2()Lioncash1-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.
2018-10-13partition_data_manager: Remove commented out codeLioncash1-2/+0
Commented out code shouldn't be left in without a reason indicating why in a comment.
2018-10-13key_manager/partition_data_manager: Silence truncation compiler warningsLioncash4-10/+15
2018-10-13partition_data_manager: Dehardcode array boundsLioncash2-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).
2018-10-13partition_data_manager: Take VirtualFile by const reference in constructorLioncash2-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.
2018-10-13partition_data_manager: Amend constructor initializer list orderLioncash1-2/+3
Orders the members in the exact order they would be initialized. This also prevents compiler warnings about this sort of thing.
2018-10-13partition_data_manager: Remove unused includesLioncash2-4/+1
Gets unused includes out of the headers and moves them into the cpp file if they're used there instead.
2018-10-13key_manager: Use std::vector's insert() instead of std::copy with a back_inserterLioncash1-2/+2
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.
2018-10-13key_manager: Brace long conditional bodyLioncash1-1/+2
If a conditional (or it's body) travels more than one line, it should be braced.
2018-10-13key_manager: Don't assume file seeks and reads will always succeedLioncash1-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.
2018-10-13key_manager: Remove unnecessary seek in DeriveSDSeed()Lioncash1-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.
2018-10-07partition_data_manager: Rename system files for hekateZach Hilman4-178/+228
x
2018-10-07crypto: Add PartitionDataManagerZach Hilman2-0/+690
Keeps track of system files for key derivation
2018-10-07key_manager: Add support for loading keys from partition dataZach Hilman2-0/+88
2018-10-07key_manager: Add ETicket key derivationZach Hilman2-2/+276
Derives titlekeys
2018-10-07key_manager: Add base key derivationZach Hilman2-4/+220
Derives master keys, game encryption keys, and package1/2 keys
2018-10-07key_manager: Add BIS key getterZach Hilman2-2/+19
2018-10-07key_manager: Add support for more keysZach Hilman2-3/+99
TSEC, SBK, BIS, and other Sources for proper derivation
2018-10-07key_manager: Add keyblob supportZach Hilman2-0/+14
2018-10-07key_manager: Add support for crypto revisions past 04Zach Hilman1-43/+63
2018-10-07key_manager: Add support for comments in keyfilesZach Hilman1-0/+3
2018-10-07key_manager: Add support for console-specific keyfileZach Hilman2-3/+13
2018-10-07key_manager: Rename KEK to KekZach Hilman2-8/+9
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi10-47/+51
2018-09-04game_list: Use RegisteredCacheUnion for installedZach Hilman1-1/+1
Reduces code
2018-09-04aes_util: Fix error involving reads of less than 0x10Zach Hilman1-0/+14
Issues with block size are fixed by making all reads minimum length of 0x10
2018-09-04nsp: Comply with style and performance guidelinesZach Hilman1-1/+1
2018-09-04card_image: Parse XCI secure partition with NSPZach Hilman1-0/+2
Eliminated duplicate code and adds support for Rev1+ carts
2018-09-04key_manager: Avoid autogeneration if key existsZach Hilman1-3/+13
2018-09-04file_sys: Replace includes with forward declarations where applicableLioncash2-4/+8
Cuts down on include dependencies, resulting in less files that need to be rebuilt when certain things are changed.
2018-08-25file_sys/crypto: Fix missing/unnecessary includesZach Hilman4-4/+4
2018-08-23key_manager: Eliminate indexed for loopZach Hilman1-6/+13
2018-08-23key_manager: Create keys dir if it dosen't existZach Hilman1-0/+1
On call to WriteKeyToFile, so that the autogenerated file can be written.
2018-08-23file_sys: Cut down on includes and copiesZach Hilman2-15/+13
2018-08-23crypto: Eliminate magic constantsZach Hilman2-16/+19
2018-08-23key_manager: Add support for autogenerated keysZach Hilman2-3/+45
Stored in a separate file than manual keys.
2018-08-23key_manager: Add support for KEK and SD seed derivationZach Hilman2-5/+135
2018-08-23key_manager: Switch to boost flat_map for keysZach Hilman2-32/+14
Should make key gets marginally faster.
2018-08-23xts_encryption_layer: Implement XTSEncryptionLayerZach Hilman2-0/+80
2018-08-23aes_util: Make XTSTranscode stricter about sizesZach Hilman1-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.
2018-08-23ctr_encryption_layer: Fix bug when transcoding small dataZach Hilman1-5/+3
Fixes a bug where data lengths of less than size 0x10 will fail or have misleading return values.
2018-08-16common: Namespace hex_util.h/.cppLioncash1-4/+4
It's in the common code, so it should be under the Common namespace like everything else.
2018-08-12crypto: Remove hex utilities from key_managerZach Hilman2-36/+2
Move to hex_util.h in common
2018-08-04aes_util: Add static assertion to Transcode() and XTSTranscode() to ensure well-defined behaviorLioncash1-0/+4
These functions should only be given trivially-copyable types.
2018-08-04aes_util: Make CalculateNintendoTweak() an internally linked functionLioncash2-12/+10
This function doesn't directly depend on class state, so it can be hidden entirely from the interface in the cpp file.
2018-08-04aes_util: Make Transcode() a const member functionLioncash2-8/+9
This doesn't modify member state, so it can be made const.
2018-08-04core/crypto: Remove unnecessary includesLioncash4-5/+5
2018-08-04key_manager: Use regular std::string instead of std::string_viewLioncash2-10/+7
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-01Use more descriptive error codes and messagesZach Hilman2-5/+24
2018-08-01Use static const instead of const staticZach Hilman1-2/+2
2018-08-01Add missing includes and use const where applicableZach Hilman6-15/+23
2018-08-01Allow key loading from %YUZU_DIR%/keys in addition to ~/.switchZach Hilman2-7/+20
2018-08-01Make XCI comply to review and style guidelinesZach Hilman8-405/+187
2018-08-01Extract mbedtls to cpp fileZach Hilman2-85/+123
2018-08-01Add missing string.h includeZach Hilman1-0/+1
2018-08-01Update mbedtls and fix compile errorZach Hilman1-0/+1
2018-08-01Remove files that are not usedZach Hilman10-0/+834