Remove module-level allows
Now that this codebase is more mature, remove allow directives so that
if we introduce issues, the compiler will tell us.
Bug: none
Test: compiles
Test: keystore2_test
Change-Id: If24b4ea40e0e2e1368e575e1e0bf6004bb318a42
diff --git a/keystore2/src/crypto/zvec.rs b/keystore2/src/crypto/zvec.rs
index e75e1dc..4af7b5a 100644
--- a/keystore2/src/crypto/zvec.rs
+++ b/keystore2/src/crypto/zvec.rs
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#![allow(dead_code)]
-
use crate::error::Error;
use nix::sys::mman::{mlock, munlock};
use std::convert::TryFrom;
diff --git a/keystore2/src/database.rs b/keystore2/src/database.rs
index 7e260fe..174a928 100644
--- a/keystore2/src/database.rs
+++ b/keystore2/src/database.rs
@@ -4444,7 +4444,6 @@
}
#[derive(Debug, PartialEq)]
- #[allow(dead_code)]
struct KeyEntryRow {
id: i64,
key_type: KeyType,
diff --git a/keystore2/src/km_compat/lib.rs b/keystore2/src/km_compat/lib.rs
index 6e27b5c..5ece8a7 100644
--- a/keystore2/src/km_compat/lib.rs
+++ b/keystore2/src/km_compat/lib.rs
@@ -12,13 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// TODO: Once this is stable, remove this and document everything public.
-#![allow(missing_docs)]
+//! Export into Rust a function to create a KeyMintDevice and add it as a service.
+#[allow(missing_docs)] // TODO remove this
extern "C" {
fn addKeyMintDeviceService() -> i32;
}
+#[allow(missing_docs)] // TODO remove this
pub fn add_keymint_device_service() -> i32 {
unsafe { addKeyMintDeviceService() }
}
diff --git a/keystore2/src/legacy_blob.rs b/keystore2/src/legacy_blob.rs
index 423f507..7c8a909 100644
--- a/keystore2/src/legacy_blob.rs
+++ b/keystore2/src/legacy_blob.rs
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#![allow(dead_code)]
-
//! This module implements methods to load legacy keystore key blob files.
use crate::{
@@ -227,7 +225,7 @@
const LENGTH_OFFSET: usize = 4 + Self::IV_SIZE + Self::GCM_TAG_LENGTH;
const IV_OFFSET: usize = 4;
const AEAD_TAG_OFFSET: usize = Self::IV_OFFSET + Self::IV_SIZE;
- const DIGEST_OFFSET: usize = Self::IV_OFFSET + Self::IV_SIZE;
+ const _DIGEST_OFFSET: usize = Self::IV_OFFSET + Self::IV_SIZE;
/// Construct a new LegacyBlobLoader with a root path of `path` relative to which it will
/// expect legacy key blob files.
diff --git a/keystore2/src/legacy_blob/test/legacy_blob_test_vectors.rs b/keystore2/src/legacy_blob/test/legacy_blob_test_vectors.rs
index aa99162..14bd40c 100644
--- a/keystore2/src/legacy_blob/test/legacy_blob_test_vectors.rs
+++ b/keystore2/src/legacy_blob/test/legacy_blob_test_vectors.rs
@@ -741,7 +741,7 @@
0xab, 0xae, 0x24, 0xe2, 0x44, 0x35, 0x16, 0x8d, 0x55, 0x3c, 0xe4,
];
-pub static DECRYPTED_USRPKEY_AUTHBOUND: &[u8] = &[
+pub static _DECRYPTED_USRPKEY_AUTHBOUND: &[u8] = &[
0x44, 0x4b, 0x4d, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xc6, 0x15, 0x3a, 0x08, 0x1e, 0x43, 0xba, 0x7a, 0x0f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/keystore2/src/security_level.rs b/keystore2/src/security_level.rs
index f7bf1c6..c234ad3 100644
--- a/keystore2/src/security_level.rs
+++ b/keystore2/src/security_level.rs
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#![allow(unused_variables)]
-
//! This crate implements the IKeystoreSecurityLevel interface.
use crate::globals::get_keymint_device;
@@ -63,7 +61,6 @@
pub struct KeystoreSecurityLevel {
security_level: SecurityLevel,
keymint: Asp,
- #[allow(dead_code)]
hw_info: KeyMintHardwareInfo,
km_uuid: Uuid,
operation_db: OperationDb,
@@ -411,7 +408,7 @@
attest_key_descriptor: Option<&KeyDescriptor>,
params: &[KeyParameter],
flags: i32,
- entropy: &[u8],
+ _entropy: &[u8],
) -> Result<KeyMetadata> {
if key.domain != Domain::BLOB && key.alias.is_none() {
return Err(error::Error::Km(ErrorCode::INVALID_ARGUMENT))
@@ -497,7 +494,7 @@
fn import_key(
&self,
key: &KeyDescriptor,
- attestation_key: Option<&KeyDescriptor>,
+ _attestation_key: Option<&KeyDescriptor>,
params: &[KeyParameter],
flags: i32,
key_data: &[u8],
diff --git a/keystore2/src/service.rs b/keystore2/src/service.rs
index 15b729d..73bd526 100644
--- a/keystore2/src/service.rs
+++ b/keystore2/src/service.rs
@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// TODO remove when fully implemented.
-#![allow(unused_variables)]
-
//! This crate implement the core Keystore 2.0 service API as defined by the Keystore 2.0
//! AIDL spec.
@@ -199,7 +196,7 @@
.context("Failed to load key entry.")?;
let mut db = db.borrow_mut();
- if let Some((key_id_guard, key_entry)) = entry {
+ if let Some((key_id_guard, _key_entry)) = entry {
db.set_blob(&key_id_guard, SubComponentType::CERT, public_cert, None)
.context("Failed to update cert subcomponent.")?;
diff --git a/keystore2/src/super_key.rs b/keystore2/src/super_key.rs
index 655e0ce..d490354 100644
--- a/keystore2/src/super_key.rs
+++ b/keystore2/src/super_key.rs
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#![allow(dead_code)]
-
use crate::{
database::BlobMetaData,
database::BlobMetaEntry,