Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
ce05df0a
There was an error fetching the commit references. Please try again later.
Commit
ce05df0a
authored
6 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
key_manager: Add support for console-specific keyfile
parent
721632fe
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/crypto/key_manager.cpp
+7
-3
7 additions, 3 deletions
src/core/crypto/key_manager.cpp
src/core/crypto/key_manager.h
+6
-0
6 additions, 0 deletions
src/core/crypto/key_manager.h
with
13 additions
and
3 deletions
src/core/crypto/key_manager.cpp
+
7
−
3
View file @
ce05df0a
...
...
@@ -138,6 +138,8 @@ KeyManager::KeyManager() {
AttemptLoadKeyFile
(
yuzu_keys_dir
,
hactool_keys_dir
,
"title.keys"
,
true
);
AttemptLoadKeyFile
(
yuzu_keys_dir
,
yuzu_keys_dir
,
"title.keys_autogenerated"
,
true
);
AttemptLoadKeyFile
(
yuzu_keys_dir
,
hactool_keys_dir
,
"console.keys"
,
false
);
AttemptLoadKeyFile
(
yuzu_keys_dir
,
yuzu_keys_dir
,
"console.keys_autogenerated"
,
false
);
}
void
KeyManager
::
LoadFromFile
(
const
std
::
string
&
filename
,
bool
is_title_keys
)
{
...
...
@@ -213,8 +215,10 @@ void KeyManager::WriteKeyToFile(bool title_key, std::string_view keyname,
const
std
::
array
<
u8
,
Size
>&
key
)
{
const
std
::
string
yuzu_keys_dir
=
FileUtil
::
GetUserPath
(
FileUtil
::
UserPath
::
KeysDir
);
std
::
string
filename
=
"title.keys_autogenerated"
;
if
(
!
title_key
)
if
(
category
==
KeyCategory
::
Standard
)
filename
=
dev_mode
?
"dev.keys_autogenerated"
:
"prod.keys_autogenerated"
;
else
if
(
category
==
KeyCategory
::
Console
)
filename
=
"console.keys_autogenerated"
;
const
auto
add_info_text
=
!
FileUtil
::
Exists
(
yuzu_keys_dir
+
DIR_SEP
+
filename
);
FileUtil
::
CreateFullPath
(
yuzu_keys_dir
+
DIR_SEP
+
filename
);
std
::
ofstream
file
(
yuzu_keys_dir
+
DIR_SEP
+
filename
,
std
::
ios
::
app
);
...
...
@@ -228,7 +232,7 @@ void KeyManager::WriteKeyToFile(bool title_key, std::string_view keyname,
}
file
<<
fmt
::
format
(
"
\n
{} = {}"
,
keyname
,
Common
::
HexArrayToString
(
key
));
AttemptLoadKeyFile
(
yuzu_keys_dir
,
yuzu_keys_dir
,
filename
,
title_key
);
AttemptLoadKeyFile
(
yuzu_keys_dir
,
yuzu_keys_dir
,
filename
,
category
==
KeyCategory
::
Title
);
}
void
KeyManager
::
SetKey
(
S128KeyType
id
,
Key128
key
,
u64
field1
,
u64
field2
)
{
...
...
@@ -261,7 +265,7 @@ void KeyManager::SetKey(S256KeyType id, Key256 key, u64 field1, u64 field2) {
std
::
tie
(
id
,
field1
,
field2
);
});
if
(
iter
!=
s256_file_id
.
end
())
WriteKeyToFile
(
false
,
iter
->
first
,
key
);
WriteKeyToFile
(
KeyCategory
::
Standard
,
iter
->
first
,
key
);
s256_keys
[{
id
,
field1
,
field2
}]
=
key
;
}
...
...
This diff is collapsed.
Click to expand it.
src/core/crypto/key_manager.h
+
6
−
0
View file @
ce05df0a
...
...
@@ -26,6 +26,12 @@ using SHA256Hash = std::array<u8, 0x20>;
static_assert
(
sizeof
(
Key128
)
==
16
,
"Key128 must be 128 bytes big."
);
static_assert
(
sizeof
(
Key256
)
==
32
,
"Key128 must be 128 bytes big."
);
enum
class
KeyCategory
:
u8
{
Standard
,
Title
,
Console
,
};
enum
class
S256KeyType
:
u64
{
Header
,
//
SDKeySource
,
// f1=SDKeyType
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment