system: vold: Upgrade the FBE key

During OTA upgrades if security state or ROT changes then Keymaster
keys requires upgrade. So for such usescases, if the FBE ephemeral
key export fails, check whether KM key requires upgrade and try for
exporting ephemeral key again.

Conflicts:
	Keymaster.cpp
	Keymaster.h

[wight554: Apply changes from CAF 12]

CRs-Fixed: 2632902
Change-Id: I3ee2fcd97a56b628dc4304867c8f2b8da875f883
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Signed-off-by: Volodymyr Zhdanov <wight554@gmail.com>
diff --git a/Keystore.cpp b/Keystore.cpp
index 6040f2d..3c3f082 100644
--- a/Keystore.cpp
+++ b/Keystore.cpp
@@ -150,8 +150,8 @@
     return true;
 }
 
-bool Keystore::exportKey(const KeyBuffer& ksKey, std::string* key) {
-    bool ret = false;
+km::ErrorCode Keystore::exportKey(const KeyBuffer& ksKey, std::string* key) {
+    km::ErrorCode ret = km::ErrorCode::UNKNOWN_ERROR;
     ks2::KeyDescriptor storageKey = {
             .domain = ks2::Domain::BLOB,
             .alias = std::nullopt,
@@ -174,7 +174,7 @@
     // using the original blobs for TAG_STORAGE_KEY keys.  If KeyMint "upgrades"
     // them anyway, then they'll just get re-upgraded before each use.
 
-    ret = true;
+    ret = km::ErrorCode::OK;
 out:
     zeroize_vector(ephemeral_key_response.ephemeralKey);
     zeroize_vector(storageKey.blob.value());