IOS: Reuse more code for crypto operations

This changes some parts of IOS (actually just ES) to reuse more crypto
code from IOSC or Common::AES.

TicketReader still returns the title key directly as opposed to having
ES use IOSC directly to avoid duplicating the title key IV stuff.

Side effects:

* A nasty unbounded array access bug is now fixed.

* ES_Decrypt/ES_Encrypt now returns sane results for keys other than
  the SD key.

* Titles with a Korean ticket can now be decrypted properly.

And in the future, we can look into implementing ioctlv 0x3c and 0x3d
now that we have the proper "infra" for IOSC calls.
This commit is contained in:
Léo Lam 2017-05-01 19:20:50 +02:00
commit 08f6c31287
9 changed files with 63 additions and 107 deletions

View file

@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 83; // Last changed in PR 5340
static const u32 STATE_VERSION = 84; // Last changed in PR 5354
// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,