clean up lints

This commit is contained in:
Heiko Schaefer 2021-11-11 15:32:34 +01:00
parent d55985807c
commit d10cbe8eff
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D
7 changed files with 28 additions and 18 deletions

View file

@ -409,7 +409,7 @@ pub fn test_cardholder_cert(
let data = "Foo bar baz!".as_bytes();
match ca.set_cardholder_certificate(data.to_vec()) {
Ok(resp) => out.push(TestResult::Text("set cert ok".to_string())),
Ok(_resp) => out.push(TestResult::Text("set cert ok".to_string())),
Err(e) => {
out.push(TestResult::Text(format!(
"set_cardholder_certificate: {:?}",
@ -433,7 +433,7 @@ pub fn test_cardholder_cert(
// try using slot 2
match ca.select_data(2, &[0x7F, 0x21]) {
Ok(res) => out.push(TestResult::Text("select_data ok".to_string())),
Ok(_res) => out.push(TestResult::Text("select_data ok".to_string())),
Err(e) => {
out.push(TestResult::Text(format!("select_data: {:?}", e)));
return Ok(out);
@ -639,7 +639,7 @@ pub fn test_reset_retry_counter(
println!("reset retry counter");
// ca.reset_retry_counter_pw1("abcdef".as_bytes().to_vec(), None)?;
let res = ca.reset_retry_counter_pw1(
let _res = ca.reset_retry_counter_pw1(
"abcdef".as_bytes().to_vec(),
Some("abcdefgh".as_bytes().to_vec()),
);

View file

@ -154,14 +154,6 @@ impl<'a> Open<'a> {
// --- application data ---
/// Load "application related data".
///
/// This is done once, after opening the OpenPGP card applet
/// (the data is stored in the OpenPGPCard object).
fn application_related_data(&mut self) -> Result<ApplicationRelatedData> {
self.card_app.get_application_related_data()
}
pub fn application_identifier(
&self,
) -> Result<ApplicationIdentifier, Error> {
@ -178,10 +170,12 @@ impl<'a> Open<'a> {
self.ard.get_extended_length_information()
}
#[allow(dead_code)]
fn general_feature_management() -> Option<bool> {
unimplemented!()
}
#[allow(dead_code)]
fn discretionary_data_objects() {
unimplemented!()
}
@ -205,6 +199,7 @@ impl<'a> Open<'a> {
self.ard.get_fingerprints()
}
#[allow(dead_code)]
fn ca_fingerprints(&self) {
unimplemented!()
}
@ -215,22 +210,27 @@ impl<'a> Open<'a> {
self.ard.get_key_generation_times()
}
#[allow(dead_code)]
fn key_information() {
unimplemented!()
}
#[allow(dead_code)]
fn uif_pso_cds() {
unimplemented!()
}
#[allow(dead_code)]
fn uif_pso_dec() {
unimplemented!()
}
#[allow(dead_code)]
fn uif_pso_aut() {
unimplemented!()
}
#[allow(dead_code)]
fn uif_attestation() {
unimplemented!()
}

View file

@ -164,14 +164,13 @@ impl<'a> DecryptionHelper for CardDecryptor<'a> {
for pkesk in pkesks {
// Only attempt decryption if the KeyIDs match
// (this check is an optimization)
if pkesk.recipient() == &self.public.keyid() {
if pkesk
if pkesk.recipient() == &self.public.keyid()
&& pkesk
.decrypt(self, sym_algo)
.map(|(algo, session_key)| dec_fn(algo, &session_key))
.unwrap_or(false)
{
return Ok(Some(self.public.fingerprint()));
}
{
return Ok(Some(self.public.fingerprint()));
}
}

View file

@ -141,6 +141,7 @@ struct SqRSA {
}
impl SqRSA {
#[allow(clippy::many_single_char_names)]
fn new(
e: MPI,
d: ProtectedMPI,

View file

@ -129,26 +129,32 @@ impl CardApp {
Ok(resp.data()?.to_vec())
}
#[allow(dead_code)]
fn get_ca_fingerprints() {
unimplemented!()
}
#[allow(dead_code)]
fn get_key_information() {
unimplemented!()
}
#[allow(dead_code)]
fn get_uif_pso_cds() {
unimplemented!()
}
#[allow(dead_code)]
fn get_uif_pso_dec() {
unimplemented!()
}
#[allow(dead_code)]
fn get_uif_pso_aut() {
unimplemented!()
}
#[allow(dead_code)]
fn get_uif_attestation() {
unimplemented!()
}

View file

@ -77,10 +77,12 @@ impl ApplicationRelatedData {
}
}
#[allow(dead_code)]
fn get_general_feature_management() -> Option<bool> {
unimplemented!()
}
#[allow(dead_code)]
fn get_discretionary_data_objects() {
unimplemented!()
}

View file

@ -410,9 +410,11 @@ fn rsa_key_import_cmd(
// Push e, padded with zero bytes from the left
let e_as_bytes = rsa_key.get_e();
for _ in e_as_bytes.len()..(len_e_bytes as usize) {
key_data.push(0);
if len_e_bytes as usize > e_as_bytes.len() {
key_data.extend(vec![0; len_e_bytes as usize - e_as_bytes.len()]);
}
key_data.extend(e_as_bytes);
// -- Prime1: p + Prime2: q --