mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Crypto: don't modify EDAT_IV (all zeros)
I didn't notice where it gets restored to zeros.
This commit is contained in:
parent
6cf73fad13
commit
caf02d1841
1 changed files with 6 additions and 2 deletions
|
@ -18,12 +18,14 @@ static shared_mutex ec_mtx;
|
|||
void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv)
|
||||
{
|
||||
int mode = crypto_mode & 0xF0000000;
|
||||
uchar temp_iv[16]{};
|
||||
switch (mode)
|
||||
{
|
||||
case 0x10000000:
|
||||
// Encrypted ERK.
|
||||
// Decrypt the key with EDAT_KEY + EDAT_IV and copy the original IV.
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, EDAT_IV, key, key_final, 0x10);
|
||||
memcpy(temp_iv, EDAT_IV, 0x10);
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, temp_iv, key, key_final, 0x10);
|
||||
memcpy(iv_final, iv, 0x10);
|
||||
break;
|
||||
case 0x20000000:
|
||||
|
@ -44,12 +46,14 @@ void generate_key(int crypto_mode, int version, unsigned char *key_final, unsign
|
|||
void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsigned char *hash)
|
||||
{
|
||||
int mode = hash_mode & 0xF0000000;
|
||||
uchar temp_iv[16]{};
|
||||
switch (mode)
|
||||
{
|
||||
case 0x10000000:
|
||||
// Encrypted HASH.
|
||||
// Decrypt the hash with EDAT_KEY + EDAT_IV.
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, EDAT_IV, hash, hash_final, 0x10);
|
||||
memcpy(temp_iv, EDAT_IV, 0x10);
|
||||
aescbc128_decrypt(version ? EDAT_KEY_1 : EDAT_KEY_0, temp_iv, hash, hash_final, 0x10);
|
||||
break;
|
||||
case 0x20000000:
|
||||
// Default HASH.
|
||||
|
|
Loading…
Add table
Reference in a new issue