Handle key parameter conversion for FBE_ICE tag

FBE_ICE tag needs to be converted to KM 4.0 KeyParameter
before passing params to generate key.

Test: Boot-Up verified with QSSI 12.0 and both KM 4.0 and
KM 4.1

CRs-Fixed: 2978933
Change-Id: I6ea35bd1b9ebe08d7069c596a985153bd017c28d
This commit is contained in:
Phanindra Babu Pabba 2021-06-23 17:56:02 +05:30 committed by zlewchan
parent 5a37034a3a
commit 6c529e5155

View file

@ -59,6 +59,8 @@ namespace KMV1 = ::aidl::android::hardware::security::keymint;
using namespace std::chrono_literals; using namespace std::chrono_literals;
using std::chrono::duration_cast; using std::chrono::duration_cast;
static const KMV1::Tag KM_TAG_FBE_ICE = static_cast<KMV1::Tag>((7 << 28) | 16201);
// Utility functions // Utility functions
// Returns true if this parameter may be passed to attestKey. // Returns true if this parameter may be passed to attestKey.
@ -484,6 +486,18 @@ ScopedAStatus KeyMintDevice::generateKey(const std::vector<KeyParameter>& inKeyP
auto legacyKeyGenParams = convertKeyParametersToLegacy(extractGenerationParams(inKeyParams)); auto legacyKeyGenParams = convertKeyParametersToLegacy(extractGenerationParams(inKeyParams));
KMV1::ErrorCode errorCode; KMV1::ErrorCode errorCode;
for (const auto& keyParam : inKeyParams) {
if((int32_t)keyParam.tag==(int32_t)KM_TAG_FBE_ICE) {
android::hardware::keymaster::V4_0::KeyParameter param1;
param1.tag = static_cast<::android::hardware::keymaster::V4_0::Tag>
(android::hardware::keymaster::V4_0::KM_TAG_FBE_ICE);
param1.f.boolValue = true;
legacyKeyGenParams.push_back(param1);
break;
}
}
auto result = mDevice->generateKey( auto result = mDevice->generateKey(
legacyKeyGenParams, [&](V4_0_ErrorCode error, const hidl_vec<uint8_t>& keyBlob, legacyKeyGenParams, [&](V4_0_ErrorCode error, const hidl_vec<uint8_t>& keyBlob,
const V4_0_KeyCharacteristics& keyCharacteristics) { const V4_0_KeyCharacteristics& keyCharacteristics) {