Loader: Use HW-acceleration for SHA256

This commit is contained in:
Michael Scire 2018-07-24 01:26:37 -07:00
parent e58927a8ab
commit dd4993dfda
5 changed files with 287 additions and 171 deletions

View file

@ -36,7 +36,7 @@ Result NroUtils::LoadNro(Registration::Process *target_proc, Handle process_h, u
unsigned int i;
Result rc;
u8 nro_hash[0x20];
SHA256_CTX sha_ctx;
struct sha256_state sha_ctx;
/* Ensure there is an available NRO slot. */
if (std::all_of(target_proc->nro_infos.begin(), target_proc->nro_infos.end(), std::mem_fn(&Registration::NroInfo::in_use))) {
return 0x6E09;
@ -78,7 +78,8 @@ Result NroUtils::LoadNro(Registration::Process *target_proc, Handle process_h, u
sha256_init(&sha_ctx);
sha256_update(&sha_ctx, (u8 *)nro, nro->nro_size);
sha256_final(&sha_ctx, nro_hash);
sha256_finalize(&sha_ctx);
sha256_finish(&sha_ctx, nro_hash);
if (!Registration::IsNroHashPresent(target_proc->index, nro_hash)) {
rc = 0x6C09;