Some of the possible policy setups were skipped. Make the generate_ckm_policy()
generate all possible combinations.
Expect backend depending on the policy's extractable flag in T1024
Change-Id: I1bd0f5b1a544c8385fdd9c66d23cbd5385137cd0
}
CKM::Policy generate_ckm_policy(int iterator_nr) {
- if (iterator_nr % 2) { // policy with password and with / without extractable flag
- return CKM::Policy(CKM::Password("test_pwd"), iterator_nr % 4);
- }
- return CKM::Policy();
+ CKM::Password password;
+ if ((iterator_nr & 0x1) != 0)
+ password.assign("test_pwd");
+ return CKM::Policy(password, (iterator_nr & 0x2) != 0);
}
void require_default_user(char *argv[])
{
CKM::Policy policy = generate_ckm_policy(it);
currentAlias = "T1024_appkey" + std::to_string(it);
- expected.emplace_back(currentAlias, !policy.password.empty(), backend());
+ expected.emplace_back(currentAlias,
+ !policy.password.empty(),
+ policy.extractable ? CKM::BackendId::SW : backend());
RUNNER_ASSERT_MSG(
CKM_API_SUCCESS == (exitCode = manager->saveKey(currentAlias, key, policy)),
"Error=" << CKM::APICodeToString(exitCode));