Skip to content

Commit

Permalink
keep rustfmt happy
Browse files Browse the repository at this point in the history
  • Loading branch information
joostd committed Feb 5, 2025
1 parent 5a4bb60 commit aba894b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
20 changes: 16 additions & 4 deletions src/piv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,10 @@ impl AlgorithmId {
#[cfg(feature = "untested")]
fn get_param_tag(self) -> u8 {
match self {
AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 | AlgorithmId::Rsa3072 | AlgorithmId::Rsa4096 => 0x01,
AlgorithmId::Rsa1024
| AlgorithmId::Rsa2048
| AlgorithmId::Rsa3072
| AlgorithmId::Rsa4096 => 0x01,
AlgorithmId::EccP256 | AlgorithmId::EccP384 => 0x6,
}
}
Expand Down Expand Up @@ -618,7 +621,10 @@ pub fn generate(
let setting_roca: setting::Setting;

match algorithm {
AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 | AlgorithmId::Rsa3072 | AlgorithmId::Rsa4096 => {
AlgorithmId::Rsa1024
| AlgorithmId::Rsa2048
| AlgorithmId::Rsa3072
| AlgorithmId::Rsa4096 => {
if yubikey.version.major == 4
&& (yubikey.version.minor < 3
|| yubikey.version.minor == 3 && (yubikey.version.patch < 5))
Expand Down Expand Up @@ -833,7 +839,10 @@ pub fn import_rsa_key(
pin_policy: PinPolicy,
) -> Result<()> {
match algorithm {
AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 | AlgorithmId::Rsa3072 | AlgorithmId::Rsa4096 => (),
AlgorithmId::Rsa1024
| AlgorithmId::Rsa2048
| AlgorithmId::Rsa3072
| AlgorithmId::Rsa4096 => (),
_ => return Err(Error::AlgorithmError),
}

Expand Down Expand Up @@ -1123,7 +1132,10 @@ fn read_public_key(
//
// 0x7f 0x49 -> Application | Constructed | 0x49
match algorithm {
AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 | AlgorithmId::Rsa3072 | AlgorithmId::Rsa4096=> {
AlgorithmId::Rsa1024
| AlgorithmId::Rsa2048
| AlgorithmId::Rsa3072
| AlgorithmId::Rsa4096 => {
// It appears that the inner application-specific value returned by the
// YubiKey is constructed such that RSA pubkeys can be parsed in two ways:
//
Expand Down
8 changes: 4 additions & 4 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,22 @@ impl<'tx> Transaction<'tx> {
let templ = [0, Ins::Authenticate.code(), algorithm.into(), key.into()];

match algorithm {
AlgorithmId::Rsa1024 => {
AlgorithmId::Rsa1024 => {
if in_len != 128 {
return Err(Error::SizeError);
}
}
AlgorithmId::Rsa2048 => {
AlgorithmId::Rsa2048 => {
if in_len != 256 {
return Err(Error::SizeError);
}
}
AlgorithmId::Rsa3072 => {
AlgorithmId::Rsa3072 => {
if in_len != 384 {
return Err(Error::SizeError);
}
}
AlgorithmId::Rsa4096 => {
AlgorithmId::Rsa4096 => {
if in_len != 512 {
return Err(Error::SizeError);
}
Expand Down

0 comments on commit aba894b

Please sign in to comment.