summaryrefslogtreecommitdiff
path: root/src/core/crypto/key_manager.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-04 21:17:10 -0400
committerGravatar GitHub2018-08-04 21:17:10 -0400
commitcd96c04339f0b457154ae17810408a9c39959962 (patch)
tree46691894e3dab41efe835b9c7924668aecc079ef /src/core/crypto/key_manager.cpp
parentMerge pull request #923 from lioncash/pragma (diff)
parentaes_util: Add static assertion to Transcode() and XTSTranscode() to ensure we... (diff)
downloadyuzu-cd96c04339f0b457154ae17810408a9c39959962.tar.gz
yuzu-cd96c04339f0b457154ae17810408a9c39959962.tar.xz
yuzu-cd96c04339f0b457154ae17810408a9c39959962.zip
Merge pull request #921 from lioncash/view
core/crypto: Minor changes
Diffstat (limited to 'src/core/crypto/key_manager.cpp')
-rw-r--r--src/core/crypto/key_manager.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 678ac5752..fc45e7ab5 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -2,19 +2,16 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
5#include <array> 6#include <array>
6#include <fstream> 7#include <fstream>
7#include <locale> 8#include <locale>
8#include <sstream> 9#include <sstream>
9#include <string_view> 10#include <string_view>
10#include <mbedtls/sha256.h>
11#include "common/assert.h"
12#include "common/common_paths.h" 11#include "common/common_paths.h"
13#include "common/file_util.h" 12#include "common/file_util.h"
14#include "common/logging/log.h"
15#include "core/crypto/key_manager.h" 13#include "core/crypto/key_manager.h"
16#include "core/settings.h" 14#include "core/settings.h"
17#include "key_manager.h"
18 15
19namespace Core::Crypto { 16namespace Core::Crypto {
20 17
@@ -66,8 +63,7 @@ KeyManager::KeyManager() {
66 AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true); 63 AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true);
67} 64}
68 65
69void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) { 66void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) {
70 const auto filename = std::string(filename_);
71 std::ifstream file(filename); 67 std::ifstream file(filename);
72 if (!file.is_open()) 68 if (!file.is_open())
73 return; 69 return;
@@ -107,11 +103,8 @@ void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) {
107 } 103 }
108} 104}
109 105
110void KeyManager::AttemptLoadKeyFile(std::string_view dir1_, std::string_view dir2_, 106void KeyManager::AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2,
111 std::string_view filename_, bool title) { 107 const std::string& filename, bool title) {
112 const std::string dir1(dir1_);
113 const std::string dir2(dir2_);
114 const std::string filename(filename_);
115 if (FileUtil::Exists(dir1 + DIR_SEP + filename)) 108 if (FileUtil::Exists(dir1 + DIR_SEP + filename))
116 LoadFromFile(dir1 + DIR_SEP + filename, title); 109 LoadFromFile(dir1 + DIR_SEP + filename, title);
117 else if (FileUtil::Exists(dir2 + DIR_SEP + filename)) 110 else if (FileUtil::Exists(dir2 + DIR_SEP + filename))