Skip to content

Commit fba2c87

Browse files
Phanindra Babu PabbamikeNG
authored andcommitted
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
1 parent ce2aa0e commit fba2c87

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

keystore2/src/km_compat/km_compat.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ namespace KMV1 = ::aidl::android::hardware::security::keymint;
5959
using namespace std::chrono_literals;
6060
using std::chrono::duration_cast;
6161

62+
static const KMV1::Tag KM_TAG_FBE_ICE = static_cast<KMV1::Tag>((7 << 28) | 16201);
63+
6264
// Utility functions
6365

6466
// Returns true if this parameter may be passed to attestKey.
@@ -484,6 +486,18 @@ ScopedAStatus KeyMintDevice::generateKey(const std::vector<KeyParameter>& inKeyP
484486

485487
auto legacyKeyGenParams = convertKeyParametersToLegacy(extractGenerationParams(inKeyParams));
486488
KMV1::ErrorCode errorCode;
489+
490+
for (const auto& keyParam : inKeyParams) {
491+
if((int32_t)keyParam.tag==(int32_t)KM_TAG_FBE_ICE) {
492+
android::hardware::keymaster::V4_0::KeyParameter param1;
493+
param1.tag = static_cast<::android::hardware::keymaster::V4_0::Tag>
494+
(android::hardware::keymaster::V4_0::KM_TAG_FBE_ICE);
495+
param1.f.boolValue = true;
496+
legacyKeyGenParams.push_back(param1);
497+
break;
498+
}
499+
}
500+
487501
auto result = mDevice->generateKey(
488502
legacyKeyGenParams, [&](V4_0_ErrorCode error, const hidl_vec<uint8_t>& keyBlob,
489503
const V4_0_KeyCharacteristics& keyCharacteristics) {

0 commit comments

Comments
 (0)