Skip to content
Closed
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
11 changes: 11 additions & 0 deletions cryptoki/src/mechanism/elliptic_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ impl<'a> EcKdf<'a> {
}
}

/// The sha256 transformation as defined in the x9 standard. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The sha256 transformation as defined in the x9 standard. The
/// The key derivation function based on sha256 as defined in the ANSI X9.63 standard. The

I'd recommend this change to make the reference clearer. If you'd like to put in a link to the standard that'd be even nicer 😉

/// derived key is produced by concatenating hashes of the shared
/// value followed by 00000001, 00000002, etc. until we find
/// enough bytes to fill the `CKA_VALUE_LEN` of the derived key.
pub fn sha256_x9() -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn sha256_x9() -> Self {
pub fn sha256() -> Self {

I think SHA256 is actually specific enough here, since the type makes it clear it's a KDF.

Self {
kdf_type: CKD_SHA256_KDF,
shared_data: None,
}
}

// The intention here is to be able to support other methods with
// shared data, without it being a breaking change, by just adding
// additional constructors here.
Expand Down