diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/crypto/partition_data_manager.cpp | 10 | ||||
| -rw-r--r-- | src/core/crypto/partition_data_manager.h | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp index ff46aad7c..bef8cdaf0 100644 --- a/src/core/crypto/partition_data_manager.cpp +++ b/src/core/crypto/partition_data_manager.cpp | |||
| @@ -332,18 +332,18 @@ FileSys::VirtualFile PartitionDataManager::GetBoot0Raw() const { | |||
| 332 | return boot0; | 332 | return boot0; |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | std::array<u8, 176> PartitionDataManager::GetEncryptedKeyblob(u8 index) const { | 335 | PartitionDataManager::EncryptedKeyBlob PartitionDataManager::GetEncryptedKeyblob(u8 index) const { |
| 336 | if (HasBoot0() && index < 32) | 336 | if (HasBoot0() && index < NUM_ENCRYPTED_KEYBLOBS) |
| 337 | return GetEncryptedKeyblobs()[index]; | 337 | return GetEncryptedKeyblobs()[index]; |
| 338 | return {}; | 338 | return {}; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | std::array<std::array<u8, 176>, 32> PartitionDataManager::GetEncryptedKeyblobs() const { | 341 | PartitionDataManager::EncryptedKeyBlobs PartitionDataManager::GetEncryptedKeyblobs() const { |
| 342 | if (!HasBoot0()) | 342 | if (!HasBoot0()) |
| 343 | return {}; | 343 | return {}; |
| 344 | 344 | ||
| 345 | std::array<std::array<u8, 176>, 32> out{}; | 345 | EncryptedKeyBlobs out{}; |
| 346 | for (size_t i = 0; i < 0x20; ++i) | 346 | for (size_t i = 0; i < out.size(); ++i) |
| 347 | boot0->Read(out[i].data(), out[i].size(), 0x180000 + i * 0x200); | 347 | boot0->Read(out[i].data(), out[i].size(), 0x180000 + i * 0x200); |
| 348 | return out; | 348 | return out; |
| 349 | } | 349 | } |
diff --git a/src/core/crypto/partition_data_manager.h b/src/core/crypto/partition_data_manager.h index c5a492a92..7c9c4410a 100644 --- a/src/core/crypto/partition_data_manager.h +++ b/src/core/crypto/partition_data_manager.h | |||
| @@ -22,6 +22,11 @@ enum class Package2Type { | |||
| 22 | class PartitionDataManager { | 22 | class PartitionDataManager { |
| 23 | public: | 23 | public: |
| 24 | static const u8 MAX_KEYBLOB_SOURCE_HASH; | 24 | static const u8 MAX_KEYBLOB_SOURCE_HASH; |
| 25 | static constexpr std::size_t NUM_ENCRYPTED_KEYBLOBS = 32; | ||
| 26 | static constexpr std::size_t ENCRYPTED_KEYBLOB_SIZE = 0xB0; | ||
| 27 | |||
| 28 | using EncryptedKeyBlob = std::array<u8, ENCRYPTED_KEYBLOB_SIZE>; | ||
| 29 | using EncryptedKeyBlobs = std::array<EncryptedKeyBlob, NUM_ENCRYPTED_KEYBLOBS>; | ||
| 25 | 30 | ||
| 26 | explicit PartitionDataManager(const FileSys::VirtualDir& sysdata_dir); | 31 | explicit PartitionDataManager(const FileSys::VirtualDir& sysdata_dir); |
| 27 | ~PartitionDataManager(); | 32 | ~PartitionDataManager(); |
| @@ -29,8 +34,8 @@ public: | |||
| 29 | // BOOT0 | 34 | // BOOT0 |
| 30 | bool HasBoot0() const; | 35 | bool HasBoot0() const; |
| 31 | FileSys::VirtualFile GetBoot0Raw() const; | 36 | FileSys::VirtualFile GetBoot0Raw() const; |
| 32 | std::array<u8, 0xB0> GetEncryptedKeyblob(u8 index) const; | 37 | EncryptedKeyBlob GetEncryptedKeyblob(u8 index) const; |
| 33 | std::array<std::array<u8, 0xB0>, 0x20> GetEncryptedKeyblobs() const; | 38 | EncryptedKeyBlobs GetEncryptedKeyblobs() const; |
| 34 | std::vector<u8> GetSecureMonitor() const; | 39 | std::vector<u8> GetSecureMonitor() const; |
| 35 | std::array<u8, 0x10> GetPackage2KeySource() const; | 40 | std::array<u8, 0x10> GetPackage2KeySource() const; |
| 36 | std::array<u8, 0x10> GetAESKekGenerationSource() const; | 41 | std::array<u8, 0x10> GetAESKekGenerationSource() const; |