mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
exo2: implement SmcGenerateAesKek, SmcLoadAesKey
This commit is contained in:
parent
864b6085a8
commit
bf546d5fb3
8 changed files with 239 additions and 65 deletions
|
@ -26,10 +26,7 @@ namespace ams::secmon::smc {
|
|||
SmcResult GenerateRandomBytesImpl(SmcArguments &args) {
|
||||
/* Validate the input size. */
|
||||
const size_t size = args.r[1];
|
||||
|
||||
if (size > MaxRandomBytes) {
|
||||
return SmcResult::InvalidArgument;
|
||||
}
|
||||
SMC_R_UNLESS(size <= MaxRandomBytes, InvalidArgument);
|
||||
|
||||
/* Create a buffer that the se can generate bytes into. */
|
||||
util::AlignedBuffer<hw::DataCacheLineSize, MaxRandomBytes> buffer;
|
||||
|
@ -69,11 +66,7 @@ namespace ams::secmon::smc {
|
|||
} else {
|
||||
/* Otherwise, we'll retrieve some bytes from the cache. */
|
||||
const size_t size = args.r[1];
|
||||
|
||||
/* Validate the input size. */
|
||||
if (size > MaxRandomBytes) {
|
||||
return SmcResult::InvalidArgument;
|
||||
}
|
||||
SMC_R_UNLESS(size <= MaxRandomBytes, InvalidArgument);
|
||||
|
||||
/* Get random bytes from the cache. */
|
||||
GetRandomFromCache(std::addressof(args.r[1]), size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue