mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-18 08:11:21 +00:00
Fix off-by-one mkey revision errors
This commit is contained in:
parent
6a0946378a
commit
965971edbd
@ -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 New Issue
Block a user