Loader: Implement ldr:ro->LoadNRR(). NOTE: No sigchecks, at the moment.

This commit is contained in:
Michael Scire 2018-04-26 20:27:52 -06:00
parent 789afe7929
commit 8524f284fd
6 changed files with 143 additions and 25 deletions

View file

@ -0,0 +1,28 @@
#include <switch.h>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <picosha2.hpp>
#include "ldr_nro.hpp"
#include "ldr_map.hpp"
#include "ldr_random.hpp"
Result NroUtils::ValidateNrrHeader(NrrHeader *header, u64 size, u64 title_id_min) {
if (header->magic != MAGIC_NRR0) {
return 0x6A09;
}
if (header->nrr_size != size) {
return 0xA409;
}
/* TODO: Check NRR signature. */
if (false) {
return 0x6C09;
}
if (header->title_id_min != title_id_min) {
return 0x6A09;
}
return 0x0;
}