Add support for engineering devices in the unlock v1 routines

This commit is contained in:
Gustave Monce
2020-01-14 15:42:23 +01:00
parent 9734077bb1
commit 1d6af81253
2 changed files with 46 additions and 19 deletions
+13
View File
@@ -53,12 +53,25 @@ namespace WPinternals
else
Loader = new QualcommPartition(Binary);
// Make sure the RootKeyHash is not blank
// If the RootKeyHash is blank, this is an engineering device, and it will accept any RKH
// We expect the user to know what he is doing in such case and we will ignore checks
if (!StructuralComparisons.StructuralEqualityComparer.Equals(RootKeyHash, new byte[RootKeyHash.Length]))
{
if ((StructuralComparisons.StructuralEqualityComparer.Equals(Loader.RootKeyHash, RootKeyHash))
&& (ByteOperations.FindUnicode(Loader.Binary, "QHSUSB_ARMPRG") != null)) // To detect that this is a loader, and not SBL1 or something. V1 loaders are QHSUSB_ARMPRG. V2 loaders are QHSUSB__BULK. Only V1 supported for now, because V2 only accepts signed payload.
{
Result.Add(Loader);
}
}
else
{
if ((ByteOperations.FindUnicode(Loader.Binary, "QHSUSB_ARMPRG") != null)) // To detect that this is a loader, and not SBL1 or something. V1 loaders are QHSUSB_ARMPRG. V2 loaders are QHSUSB__BULK. Only V1 supported for now, because V2 only accepts signed payload.
{
Result.Add(Loader);
}
}
}
}
catch { }
}
@@ -373,6 +373,12 @@ namespace WPinternals
{
throw new Exception("Error: Root Key Hash could not be retrieved from the phone.");
}
// Make sure the RootKeyHash is not blank
// If the RootKeyHash is blank, this is an engineering device, and it will accept any RKH
// We expect the user to know what he is doing in such case and we will ignore checks
if (!StructuralComparisons.StructuralEqualityComparer.Equals(RootKeyHash, new byte[RootKeyHash.Length]))
{
if (SBL1.RootKeyHash == null)
{
throw new Exception("Error: Root Key Hash could not be retrieved from FFU file.");
@@ -384,6 +390,7 @@ namespace WPinternals
throw new Exception("Error: Root Key Hash from phone and from FFU file do not match!");
}
}
}
SBL2 SBL2Partition = null;
try
@@ -870,6 +877,12 @@ namespace WPinternals
{
throw new Exception("Error: Root Key Hash could not be retrieved from the phone.");
}
// Make sure the RootKeyHash is not blank
// If the RootKeyHash is blank, this is an engineering device, and it will accept any RKH
// We expect the user to know what he is doing in such case and we will ignore checks
if (!StructuralComparisons.StructuralEqualityComparer.Equals(RootKeyHash, new byte[RootKeyHash.Length]))
{
if (SBL1.RootKeyHash == null)
{
throw new Exception("Error: Root Key Hash could not be retrieved from FFU file.");
@@ -881,6 +894,7 @@ namespace WPinternals
throw new Exception("Error: Root Key Hash from phone and from FFU file do not match!");
}
}
}
SBL2 SBL2Partition = null;
try