mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 15:49:48 -04:00
smcGetRandomFor{User,Priv} Implementations.
This commit is contained in:
parent
34667a65f9
commit
cec055a44b
4 changed files with 132 additions and 1 deletions
|
@ -75,6 +75,22 @@ uint32_t user_exp_mod(smc_args_t *args) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t user_get_random_bytes(smc_args_t *args) {
|
||||
uint8_t random_bytes[0x40];
|
||||
if (args->X[1] > 0x38) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
size_t size = (size_t)args->X[1];
|
||||
|
||||
flush_dcache_range(random_bytes, random_bytes + size);
|
||||
se_generate_random(KEYSLOT_SWITCH_RNGKEY, random_bytes, size);
|
||||
flush_dcache_range(random_bytes, random_bytes + size);
|
||||
|
||||
memcpy(&args->X[1], random_bytes, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t user_generate_aes_kek(smc_args_t *args) {
|
||||
uint64_t wrapped_kek[2];
|
||||
uint8_t kek_source[0x10];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue