Cope with Keymaster->KeyMint device upgrade
When handling keyblob upgrade required, also watch out for an invalid
keyblob error that might indicate that a key used to be a
km_compat-wrapped Keymaster key.
In this situation, try stripping off the km_compat prefix and
attempt upgrade of the inner keyblob data instead.
Bug: 251426862
Bug: 283077822
Bug: 296403357
Test: tested with ARC upgrade, see b/296403357
Change-Id: I8539455e33ab2e1c97f26174476ee9d616269e74
diff --git a/keystore2/src/raw_device.rs b/keystore2/src/raw_device.rs
index 860a1bc..44d805c 100644
--- a/keystore2/src/raw_device.rs
+++ b/keystore2/src/raw_device.rs
@@ -265,6 +265,7 @@
{
let (f_result, upgraded_blob) = crate::utils::upgrade_keyblob_if_required_with(
&*self.km_dev,
+ self.version(),
&key_blob,
&[],
f,