This commit is contained in:
GaryOderNichts 2022-02-22 20:59:19 +01:00
parent 8c4eae6fbc
commit cdbc250bab
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,8 @@
## Note about archival
This code was basically directly translated from C# to C, and is incredibly dirty.
(A lot of unneeded allocations / copying / reading).
This should probably be completely rewritten.
# wiiu-nandextract-c
Wii (U) NAND Extractor written in C

View File

@ -203,7 +203,7 @@ uint8_t getKey(void)
}
}
printf("Error key not valid");
printf("Error key not valid\n");
return 0;
}
@ -500,16 +500,12 @@ void extractFile(fst_t fst, uint16_t entry, char* parent)
uint8_t* aesDecrypt(uint8_t* key, uint8_t* enc_data, size_t data_size)
{
uint8_t* dec_data = calloc(data_size, sizeof(uint8_t));
memcpy(dec_data, enc_data, data_size);
free(enc_data);
uint8_t iv[16] = { 0 };
struct AES_ctx ctx;
AES_init_ctx_iv(&ctx, key, iv);
AES_CBC_decrypt_buffer(&ctx, dec_data, data_size);
AES_CBC_decrypt_buffer(&ctx, enc_data, data_size);
return dec_data;
return enc_data;
}