Skip to content

Commit

Permalink
Add proper command to check if curve is initialized
Browse files Browse the repository at this point in the history
sosthene-nitrokey committed May 24, 2024
1 parent e457558 commit 0a35abd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/se05x.rs
Original file line number Diff line number Diff line change
@@ -1749,6 +1749,17 @@ where
Ok((value.map(TryInto::try_into).transpose()?, rem))
}

impl<'a> commands::ReadEcCurveListResponse<'a> {
pub fn is_set(&self, curve: EcCurve) -> bool {
let id: u8 = curve.into();
if id >= 0x40 {
return true;
}

self.ids.get(id as usize - 1) == Some(&SetIndicator::Set.into())
}
}

#[cfg(test)]
mod tests {
use super::{commands::CipherOneShotEncrypt, *};

0 comments on commit 0a35abd

Please sign in to comment.