diff --git a/card-functionality/src/tests.rs b/card-functionality/src/tests.rs index 54dac2d..f22aefb 100644 --- a/card-functionality/src/tests.rs +++ b/card-functionality/src/tests.rs @@ -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()), ); diff --git a/openpgp-card-sequoia/src/card.rs b/openpgp-card-sequoia/src/card.rs index 1dbd718..ff5ef4a 100644 --- a/openpgp-card-sequoia/src/card.rs +++ b/openpgp-card-sequoia/src/card.rs @@ -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 { - self.card_app.get_application_related_data() - } - pub fn application_identifier( &self, ) -> Result { @@ -178,10 +170,12 @@ impl<'a> Open<'a> { self.ard.get_extended_length_information() } + #[allow(dead_code)] fn general_feature_management() -> Option { 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!() } diff --git a/openpgp-card-sequoia/src/decryptor.rs b/openpgp-card-sequoia/src/decryptor.rs index 08f412e..b7188dd 100644 --- a/openpgp-card-sequoia/src/decryptor.rs +++ b/openpgp-card-sequoia/src/decryptor.rs @@ -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())); } } diff --git a/openpgp-card-sequoia/src/privkey.rs b/openpgp-card-sequoia/src/privkey.rs index 6990248..a67b95c 100644 --- a/openpgp-card-sequoia/src/privkey.rs +++ b/openpgp-card-sequoia/src/privkey.rs @@ -141,6 +141,7 @@ struct SqRSA { } impl SqRSA { + #[allow(clippy::many_single_char_names)] fn new( e: MPI, d: ProtectedMPI, diff --git a/openpgp-card/src/card_app.rs b/openpgp-card/src/card_app.rs index 1e665ed..745c89e 100644 --- a/openpgp-card/src/card_app.rs +++ b/openpgp-card/src/card_app.rs @@ -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!() } diff --git a/openpgp-card/src/card_do.rs b/openpgp-card/src/card_do.rs index 47e5ca7..44f8f90 100644 --- a/openpgp-card/src/card_do.rs +++ b/openpgp-card/src/card_do.rs @@ -77,10 +77,12 @@ impl ApplicationRelatedData { } } + #[allow(dead_code)] fn get_general_feature_management() -> Option { unimplemented!() } + #[allow(dead_code)] fn get_discretionary_data_objects() { unimplemented!() } diff --git a/openpgp-card/src/keys.rs b/openpgp-card/src/keys.rs index 980a8d1..bdbb513 100644 --- a/openpgp-card/src/keys.rs +++ b/openpgp-card/src/keys.rs @@ -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 --