Skip to content

Commit b0afb3e

Browse files
authored
Merge pull request #239 from hug-dev/sha256
Define CKD_SHA256_KDF transformation
2 parents 3d14be8 + 7844005 commit b0afb3e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cryptoki/src/mechanism/elliptic_curve.rs

+11
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ impl EcKdf<'_> {
9393
}
9494
}
9595

96+
/// The key derivation function based on sha256 as defined in the ANSI X9.63 standard. The
97+
/// derived key is produced by concatenating hashes of the shared
98+
/// value followed by 00000001, 00000002, etc. until we find
99+
/// enough bytes to fill the `CKA_VALUE_LEN` of the derived key.
100+
pub fn sha256() -> Self {
101+
Self {
102+
kdf_type: CKD_SHA256_KDF,
103+
shared_data: None,
104+
}
105+
}
106+
96107
// The intention here is to be able to support other methods with
97108
// shared data, without it being a breaking change, by just adding
98109
// additional constructors here.

0 commit comments

Comments
 (0)