[ctrtool] fix bug with seeddb

This commit is contained in:
jakcron 2017-05-28 13:52:32 +08:00
parent b0896ecee2
commit d185b18f27
7 changed files with 16 additions and 3 deletions

1
.gitignore vendored
View File

@ -228,3 +228,4 @@ pip-log.txt
#exec #exec
*.exe *.exe
*.db *.db
/.vs/slnx.sqlite

3
.vs/ProjectSettings.json Normal file
View File

@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}

View File

@ -0,0 +1,9 @@
{
"ExpandedNodes": [
"",
"\\ctrtool",
"\\makerom"
],
"SelectedNode": "\\makerom\\keyset.c",
"PreviewInSolutionExplorer": false
}

BIN
ctrtool/ctrtool Normal file

Binary file not shown.

View File

@ -301,7 +301,7 @@ void keyset_parse_seeddb(keyset* keys, char* path)
seeddb_header hdr; seeddb_header hdr;
fread(&hdr, sizeof(seeddb_header), 1, fp); fread(&hdr, sizeof(seeddb_header), 1, fp);
u32 n_entries = getle32(hdr.n_entries); keys->seed_num = getle32(hdr.n_entries);
for (u32 i = 0; i < 0xC; i++) for (u32 i = 0; i < 0xC; i++)
{ {
if (hdr.padding[i] != 0x00) if (hdr.padding[i] != 0x00)
@ -311,8 +311,8 @@ void keyset_parse_seeddb(keyset* keys, char* path)
} }
} }
keys->seed_db = (seeddb_entry*)calloc(n_entries, sizeof(seeddb_entry)); keys->seed_db = (seeddb_entry*)calloc(keys->seed_num, sizeof(seeddb_entry));
fread(keys->seed_db, n_entries * sizeof(seeddb_entry), 1, fp); fread(keys->seed_db, keys->seed_num * sizeof(seeddb_entry), 1, fp);
} }
void keyset_dump_rsakey(rsakey2048* key, const char* keytitle) void keyset_dump_rsakey(rsakey2048* key, const char* keytitle)

BIN
ctrtool/seeddb.bin Normal file

Binary file not shown.

BIN
makerom/makerom Normal file

Binary file not shown.