mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
Fix off-by-one mkey revision errors
This commit is contained in:
parent
6a0946378a
commit
965971edbd
1 changed files with 16 additions and 9 deletions
|
@ -283,11 +283,12 @@ uint32_t user_generate_specific_aes_key(smc_args_t *args) {
|
|||
wrapped_key[0] = args->X[1];
|
||||
wrapped_key[1] = args->X[2];
|
||||
|
||||
master_key_rev = args->X[3];
|
||||
if (mkey_get_revision() < MASTERKEY_REVISION_400_CURRENT) {
|
||||
master_key_rev &= 0xFFFFFFFF;
|
||||
master_key_rev = (unsigned int)args->X[3];
|
||||
if (master_key_rev > 0) {
|
||||
master_key_rev -= 1;
|
||||
}
|
||||
if (master_key_rev > MASTERKEY_REVISION_MAX) {
|
||||
|
||||
if (master_key_rev >= MASTERKEY_REVISION_MAX) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -557,6 +558,10 @@ uint32_t user_unwrap_rsa_oaep_wrapped_titlekey(smc_args_t *args) {
|
|||
void *user_modulus = (void *)args->X[2];
|
||||
unsigned int master_key_rev = (unsigned int)args->X[7];
|
||||
|
||||
if(master_key_rev > 0) {
|
||||
master_key_rev -= 1;
|
||||
}
|
||||
|
||||
if (mkey_get_revision() > 0 && master_key_rev >= MASTERKEY_REVISION_MAX) {
|
||||
return 2;
|
||||
} else {
|
||||
|
@ -616,7 +621,9 @@ uint32_t user_unwrap_aes_wrapped_titlekey(smc_args_t *args) {
|
|||
aes_wrapped_titlekey[1] = args->X[2];
|
||||
unsigned int master_key_rev = (unsigned int)args->X[3];
|
||||
|
||||
|
||||
if (master_key_rev > 0) {
|
||||
master_key_rev -= 1;
|
||||
}
|
||||
if (mkey_get_revision() > 0 && master_key_rev >= MASTERKEY_REVISION_MAX) {
|
||||
return 2;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue