Introduce seed key for EGS53

This commit is contained in:
Vlad Lupashevskyi 2023-08-08 23:19:30 +02:00
parent 7651faac72
commit f675456c0b
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
namespace UnlockECU
{
/// <summary>
/// Implementation of extended VGS Algo with different keys for multiplication and xor
/// </summary>
class VGSSecurityAlgoExt : SecurityProvider
{
public override bool GenerateKey(byte[] inSeed, byte[] outKey, int accessLevel, List<Parameter> parameters)
{
byte[] cryptoKeyMultBytes = GetParameterBytearray(parameters, "M");
uint cryptoKeyMult = BytesToInt(cryptoKeyMultBytes, Endian.Big);
byte[] cryptoKeyXorBytes = GetParameterBytearray(parameters, "X");
uint cryptoKeyXor = BytesToInt(cryptoKeyXorBytes, Endian.Big);
if ((inSeed.Length != 4) || (outKey.Length != 4))
{
return false;
}
long seed = BytesToInt(inSeed, Endian.Big);
long seedKey = cryptoKeyMult * (cryptoKeyXor ^ seed);
IntToBytes((uint)seedKey, outKey, Endian.Big);
return true;
}
public override string GetProviderName()
{
return "VGSSecurityAlgoExt";
}
}
}

View File

@ -11818,6 +11818,27 @@
"DataType": "ByteArray"
}
]
},
{
"EcuName": "EGS53",
"Aliases": [],
"AccessLevel": 1,
"SeedLength": 4,
"KeyLength": 4,
"Provider": "VGSSecurityAlgoExt",
"Origin": "EGS53_27_05@VladLupashevskyi-@rnd-ash",
"Parameters": [
{
"Key": "X",
"Value": "6BB6B6B6",
"DataType": "ByteArray"
},
{
"Key": "M",
"Value": "49949494",
"DataType": "ByteArray"
}
]
},
{
"EcuName": "Subaru_2EE2",