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

View file

@ -154,14 +154,6 @@ impl<'a> Open<'a> {
// --- application data --- // --- 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( pub fn application_identifier(
&self, &self,
) -> Result<ApplicationIdentifier, Error> { ) -> Result<ApplicationIdentifier, Error> {
@ -178,10 +170,12 @@ impl<'a> Open<'a> {
self.ard.get_extended_length_information() self.ard.get_extended_length_information()
} }
#[allow(dead_code)]
fn general_feature_management() -> Option<bool> { fn general_feature_management() -> Option<bool> {
unimplemented!() unimplemented!()
} }
#[allow(dead_code)]
fn discretionary_data_objects() { fn discretionary_data_objects() {
unimplemented!() unimplemented!()
} }
@ -205,6 +199,7 @@ impl<'a> Open<'a> {
self.ard.get_fingerprints() self.ard.get_fingerprints()
} }
#[allow(dead_code)]
fn ca_fingerprints(&self) { fn ca_fingerprints(&self) {
unimplemented!() unimplemented!()
} }
@ -215,22 +210,27 @@ impl<'a> Open<'a> {
self.ard.get_key_generation_times() self.ard.get_key_generation_times()
} }
#[allow(dead_code)]
fn key_information() { fn key_information() {
unimplemented!() unimplemented!()
} }
#[allow(dead_code)]
fn uif_pso_cds() { fn uif_pso_cds() {
unimplemented!() unimplemented!()
} }
#[allow(dead_code)]
fn uif_pso_dec() { fn uif_pso_dec() {
unimplemented!() unimplemented!()
} }
#[allow(dead_code)]
fn uif_pso_aut() { fn uif_pso_aut() {
unimplemented!() unimplemented!()
} }
#[allow(dead_code)]
fn uif_attestation() { fn uif_attestation() {
unimplemented!() unimplemented!()
} }

View file

@ -164,14 +164,13 @@ impl<'a> DecryptionHelper for CardDecryptor<'a> {
for pkesk in pkesks { for pkesk in pkesks {
// Only attempt decryption if the KeyIDs match // Only attempt decryption if the KeyIDs match
// (this check is an optimization) // (this check is an optimization)
if pkesk.recipient() == &self.public.keyid() { if pkesk.recipient() == &self.public.keyid()
if pkesk && pkesk
.decrypt(self, sym_algo) .decrypt(self, sym_algo)
.map(|(algo, session_key)| dec_fn(algo, &session_key)) .map(|(algo, session_key)| dec_fn(algo, &session_key))
.unwrap_or(false) .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 { impl SqRSA {
#[allow(clippy::many_single_char_names)]
fn new( fn new(
e: MPI, e: MPI,
d: ProtectedMPI, d: ProtectedMPI,

View file

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

View file

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

View file

@ -410,9 +410,11 @@ fn rsa_key_import_cmd(
// Push e, padded with zero bytes from the left // Push e, padded with zero bytes from the left
let e_as_bytes = rsa_key.get_e(); 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); key_data.extend(e_as_bytes);
// -- Prime1: p + Prime2: q -- // -- Prime1: p + Prime2: q --