Keystore 2.0: Add missing context in generated and import key.
Also small cleanup in enforcements.rs.
Test: N/A
Change-Id: If6afcb5e247402c1201a1a8719e35e369a38d99e
diff --git a/keystore2/src/enforcements.rs b/keystore2/src/enforcements.rs
index 22b4bed..387604e 100644
--- a/keystore2/src/enforcements.rs
+++ b/keystore2/src/enforcements.rs
@@ -392,13 +392,10 @@
user_auth_type = Some(*a);
}
KeyParameterValue::KeyPurpose(p) => {
- // Note: if there can be multiple KeyPurpose key parameters (TODO: confirm this),
- // following check has the effect of key_params.contains(purpose)
+ // The following check has the effect of key_params.contains(purpose)
// Also, authorizing purpose can not be completed here, if there can be multiple
- // key parameters for KeyPurpose
- if !key_purpose_authorized && *p == purpose {
- key_purpose_authorized = true;
- }
+ // key parameters for KeyPurpose.
+ key_purpose_authorized = key_purpose_authorized || *p == purpose;
}
KeyParameterValue::CallerNonce => {
caller_nonce_allowed = true;