mirror of
https://github.com/SciresM/hactool
synced 2024-11-22 20:13:08 +00:00
Merge pull request #21 from roblabla/feature-keygen
Allow deriving keys without providing BOOT0
This commit is contained in:
commit
9d9b781aa3
1 changed files with 3 additions and 3 deletions
6
main.c
6
main.c
|
@ -423,7 +423,7 @@ int main(int argc, char **argv) {
|
|||
if (optind == argc - 1) {
|
||||
/* Copy input file. */
|
||||
strncpy(input_name, argv[optind], sizeof(input_name));
|
||||
} else if ((optind < argc) || (argc == 1)) {
|
||||
} else if (tool_ctx.file_type != FILETYPE_BOOT0 && ((optind < argc) || (argc == 1))) {
|
||||
usage();
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
|
||||
if ((tool_ctx.file = fopen(input_name, "rb")) == NULL) {
|
||||
if ((tool_ctx.file = fopen(input_name, "rb")) == NULL && tool_ctx.file_type != FILETYPE_BOOT0) {
|
||||
fprintf(stderr, "unable to open %s: %s\n", input_name, strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ int main(int argc, char **argv) {
|
|||
memcpy(new_keyset.tsec_key, tool_ctx.settings.keygen_tsec, 0x10);
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < 0x20; i++) {
|
||||
for (unsigned int i = 0; tool_ctx.file != NULL && i < 0x20; i++) {
|
||||
fseek(tool_ctx.file, 0x180000 + 0x200 * i, SEEK_SET);
|
||||
if (fread(&new_keyset.encrypted_keyblobs[i], sizeof(new_keyset.encrypted_keyblobs[i]), 1, tool_ctx.file) != 1) {
|
||||
fprintf(stderr, "Error: Failed to read encrypted_keyblob_%02x from boot0!\n", i);
|
||||
|
|
Loading…
Reference in a new issue