Skip to content

Commit 5f181d9

Browse files
committed
Add FipsStatus enum
1 parent e033938 commit 5f181d9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,14 @@ pub trait SignatureVerificationAlgorithm: Send + Sync + fmt::Debug {
928928
/// for signature verification.
929929
fn signature_alg_id(&self) -> AlgorithmIdentifier;
930930

931+
/// Return the FIPS status of this algorithm or implementation.
932+
fn fips_status(&self) -> FipsStatus {
933+
match self.fips() {
934+
true => FipsStatus::Pending,
935+
false => FipsStatus::Unvalidated,
936+
}
937+
}
938+
931939
/// Return `true` if this is backed by a FIPS-approved implementation.
932940
fn fips(&self) -> bool {
933941
false
@@ -1074,6 +1082,22 @@ impl PartialEq for BytesInner<'_> {
10741082

10751083
impl Eq for BytesInner<'_> {}
10761084

1085+
/// FIPS validation status of an algorithm or implementation.
1086+
#[allow(clippy::exhaustive_enums)]
1087+
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
1088+
pub enum FipsStatus {
1089+
/// Not FIPS tested, or unapproved algorithm.
1090+
Unvalidated,
1091+
/// In queue for FIPS validation.
1092+
Pending,
1093+
/// FIPS certified, with named certificate.
1094+
#[non_exhaustive]
1095+
Certified {
1096+
/// A name, number or URL referencing the FIPS certificate.
1097+
certificate: &'static str,
1098+
},
1099+
}
1100+
10771101
// Format an iterator of u8 into a hex string
10781102
fn hex<'a>(f: &mut fmt::Formatter<'_>, payload: impl IntoIterator<Item = &'a u8>) -> fmt::Result {
10791103
for (i, b) in payload.into_iter().enumerate() {

0 commit comments

Comments
 (0)