Add support of A12 keymaster_key_blob files structure

In A12 keymaster_key_blob format changed
Compared to A11 it contains another new 8 bytes at beginning "pKMblob\0" (in hex 0x704B4D626C6F6200)
We can just ignore them

TEST: Tested on our old scorpion_windy,Android 12
      FDE encrypted. Decrypt successful.

Change-Id: I8a1701a248be536fdd000b9011122ef954c8e4d1
Signed-off-by: koron393 <koron393@gmail.com>
diff --git a/crypto/ext4crypt/Keymaster3.cpp b/crypto/ext4crypt/Keymaster3.cpp
index f8774f2..e9a37ba 100644
--- a/crypto/ext4crypt/Keymaster3.cpp
+++ b/crypto/ext4crypt/Keymaster3.cpp
@@ -25,6 +25,8 @@
 #define ERROR 1
 #define LOG(x) std::cout
 
+static const std::string kPkmBlob("pKMblob\x00", 8);
+
 using namespace ::keystore;
 using android::hardware::hidl_string;
 
@@ -179,6 +181,14 @@
         mOpHandle = operationHandle;
     };
 
+    // In A12 keymaster_key_blob format changed:
+    // it have useless for us bytes in beginning, so remove them to correctly handle key
+    std::string kmKey = dump::toString(keyBlob);
+    if (!kmKey.compare(0, kPkmBlob.size(), kPkmBlob)) {
+        kmKey.erase(0, kPkmBlob.size());
+        keyBlob = blob2hidlVec(kmKey);
+    }
+
     auto error = mDevice->begin(purpose, keyBlob, inParams.hidl_data(), hidlCb);
     if (!error.isOk()) {
         LOG(ERROR) << "begin failed: " << error.description() << "\n";