Add SecurityLevel to key creation and operation logging.
This CL adds SecurityLevel to existing logging.
Test: android.keystore.cts.KeyGeneratorTest,
android.keystore.cts.RSACipherTest
Bug: 184301651
Merged-In: Ie61ba7392f0afca2790daebd7a1907a42c1eaed6
Change-Id: Ie61ba7392f0afca2790daebd7a1907a42c1eaed6
diff --git a/keystore2/src/security_level.rs b/keystore2/src/security_level.rs
index ec6c4d7..20f7226 100644
--- a/keystore2/src/security_level.rs
+++ b/keystore2/src/security_level.rs
@@ -326,7 +326,8 @@
let operation = match begin_result.operation {
Some(km_op) => {
self.operation_db.create_operation(km_op, caller_uid, auth_info, forced,
- LoggingInfo::new(purpose, op_params, upgraded_blob.is_some()))
+ LoggingInfo::new(self.security_level, purpose, op_params,
+ upgraded_blob.is_some()))
},
None => return Err(Error::sys()).context("In create_operation: Begin operation returned successfully, but did not return a valid operation."),
};
@@ -832,7 +833,7 @@
entropy: &[u8],
) -> binder::public_api::Result<KeyMetadata> {
let result = self.generate_key(key, attestation_key, params, flags, entropy);
- log_key_creation_event_stats(params, &result);
+ log_key_creation_event_stats(self.security_level, params, &result);
map_or_log_err(result, Ok)
}
fn importKey(
@@ -844,7 +845,7 @@
key_data: &[u8],
) -> binder::public_api::Result<KeyMetadata> {
let result = self.import_key(key, attestation_key, params, flags, key_data);
- log_key_creation_event_stats(params, &result);
+ log_key_creation_event_stats(self.security_level, params, &result);
map_or_log_err(result, Ok)
}
fn importWrappedKey(
@@ -857,7 +858,7 @@
) -> binder::public_api::Result<KeyMetadata> {
let result =
self.import_wrapped_key(key, wrapping_key, masking_key, params, authenticators);
- log_key_creation_event_stats(params, &result);
+ log_key_creation_event_stats(self.security_level, params, &result);
map_or_log_err(result, Ok)
}
fn convertStorageKeyToEphemeral(