Keystore 2.0: Clean up lints
Bug: 184833962
Test: m
Change-Id: Iff862198960003cd780844b0cd6620da941d48bc
diff --git a/keystore2/src/remote_provisioning.rs b/keystore2/src/remote_provisioning.rs
index fc1a6ad..1f3f8e8 100644
--- a/keystore2/src/remote_provisioning.rs
+++ b/keystore2/src/remote_provisioning.rs
@@ -19,8 +19,6 @@
//! certificate chains signed by some root authority and stored in a keystore SQLite
//! DB.
-#![allow(clippy::from_over_into, clippy::needless_question_mark, clippy::vec_init_then_push)]
-
use std::collections::HashMap;
use android_hardware_security_keymint::aidl::android::hardware::security::keymint::{
@@ -252,7 +250,7 @@
// attestation keys unless the pool status is checked first, so this call should be
// enough to routinely clean out expired keys.
db.delete_expired_attestation_keys()?;
- Ok(db.get_attestation_pool_status(expired_by, &uuid)?)
+ db.get_attestation_pool_status(expired_by, &uuid)
})
}
@@ -294,14 +292,15 @@
protected_data,
))
.context("In generate_csr: Failed to generate csr")?;
- let mut cose_mac_0 = Vec::<u8>::new();
// TODO(b/180392379): Replace this manual CBOR generation with the cbor-serde crate as well.
// This generates an array consisting of the mac and the public key Maps.
// Just generate the actual MacedPublicKeys structure when the crate is
// available.
- cose_mac_0.push((0b100_00000 | (keys_to_sign.len() + 1)) as u8);
- cose_mac_0.push(0b010_11000); //push mac
- cose_mac_0.push(mac.len() as u8);
+ let mut cose_mac_0: Vec<u8> = vec![
+ (0b100_00000 | (keys_to_sign.len() + 1)) as u8,
+ 0b010_11000, // mac
+ (mac.len() as u8),
+ ];
cose_mac_0.append(&mut mac);
for maced_public_key in keys_to_sign {
if maced_public_key.macedKey.len() > 83 + 8 {
@@ -327,13 +326,13 @@
DB.with::<_, Result<()>>(|db| {
let mut db = db.borrow_mut();
let (_, _, uuid) = get_keymint_device(&sec_level)?;
- Ok(db.store_signed_attestation_certificate_chain(
+ db.store_signed_attestation_certificate_chain(
public_key,
batch_cert,
certs, /* DER encoded certificate chain */
expiration_date,
&uuid,
- )?)
+ )
})
}
@@ -362,7 +361,7 @@
raw_key[32..64].clone_from_slice(&data[53..53 + 32]);
DB.with::<_, Result<()>>(|db| {
let mut db = db.borrow_mut();
- Ok(db.create_attestation_key_entry(&maced_key.macedKey, &raw_key, &priv_key, &uuid)?)
+ db.create_attestation_key_entry(&maced_key.macedKey, &raw_key, &priv_key, &uuid)
})
}
@@ -377,7 +376,7 @@
pub fn delete_all_keys(&self) -> Result<i64> {
DB.with::<_, Result<i64>>(|db| {
let mut db = db.borrow_mut();
- Ok(db.delete_all_attestation_keys()?)
+ db.delete_all_attestation_keys()
})
}
}