Skip to content

Commit

Permalink
Merge pull request #239 from hug-dev/sha256
Browse files Browse the repository at this point in the history
Define CKD_SHA256_KDF transformation
  • Loading branch information
hug-dev authored Dec 30, 2024
2 parents 3d14be8 + 7844005 commit b0afb3e
Showing 1 changed file with 11 additions and 0 deletions.
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 EcKdf<'_> {
}
}

/// The key derivation function based on sha256 as defined in the ANSI X9.63 standard. The
/// 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() -> Self {
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

0 comments on commit b0afb3e

Please sign in to comment.