Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3des fix ; ensure no oob read in YubiKey::authenticate #2

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mgm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub trait MgmKeyAlgorithm:
}
}

impl MgmKeyAlgorithm for des::TdesEee3 {
impl MgmKeyAlgorithm for des::TdesEde3 {
const KEY_SIZE: u8 = 24;
const ALGORITHM_ID: u8 = 0x03;

Expand Down Expand Up @@ -208,7 +208,7 @@ pub struct MgmKey<C: MgmKeyAlgorithm> {
}

/// A Management Key (MGM) using Triple-DES
pub type MgmKey3Des = MgmKey<des::TdesEee3>;
pub type MgmKey3Des = MgmKey<des::TdesEde3>;

/// A Management Key (MGM) using AES-128
pub type MgmKeyAes128 = MgmKey<aes::Aes128>;
Expand Down Expand Up @@ -522,7 +522,7 @@ impl<'a, C: MgmKeyAlgorithm> TryFrom<&'a [u8]> for MgmKey<C> {
// Seal the MgmKeyAlgorithm trait
mod private {
pub trait Seal {}
impl Seal for des::TdesEee3 {}
impl Seal for des::TdesEde3 {}
impl Seal for aes::Aes128 {}
impl Seal for aes::Aes192 {}
impl Seal for aes::Aes256 {}
Expand Down
2 changes: 1 addition & 1 deletion src/yubikey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl YubiKey {
.data([TAG_DYN_AUTH, 0x02, 0x80, 0x00])
.transmit(&txn, 261)?;

if !card_response.is_success() {
if !card_response.is_success() || card_response.data().len() < 5 {
return Err(Error::AuthenticationError);
}

Expand Down