@@ -98,15 +98,22 @@ pub enum PrfDataParamType<'a> {
9898 IterationVariable ( Option < & ' a KbkdfCounterFormat > ) ,
9999 /// Identifies location of counter in constructed PRF input data.
100100 Counter ( & ' a KbkdfCounterFormat ) ,
101- /// Identifies location of DKM (derived key material) length in constructed PRF input data.
101+ /// Identifies location of DKM (derived key material) length value in constructed PRF input data.
102102 DkmLength ( & ' a KbkdfDkmLengthFormat ) ,
103103 /// Identifies location and value of byte array of data in constructed PRF input data.
104104 ByteArray ( & ' a [ u8 ] ) ,
105105}
106106
107107/// A segment of input data for the PRF, to be used to construct a sequence of input.
108108///
109- /// Corresponds to CK_PRF_DATA_PARAM in the specific cases of the KDF operating in feedback- or double pipeline-mode.
109+ /// This structure wraps a `CK_PRF_DATA_PARAM` structure.
110+ ///
111+ /// * [`PrfDataParamType::IterationVariable`] is required for the KDF in all modes.
112+ /// * In counter-mode, [`PrfDataParamType::IterationVariable`] must contain [`KbkdfCounterFormat`].
113+ /// In feedback- and double pipeline-mode, it must contain [`None`].
114+ /// * [`PrfDataParamType::Counter`] must not be present in counter-mode.
115+ /// * [`PrfDataParamType::DkmLength`] can be present at most once, in any mode.
116+ /// * [`PrfDataParamType::ByteArray`] can be present any amount of times, in any mode.
110117#[ derive( Debug , Clone , Copy ) ]
111118#[ repr( transparent) ]
112119pub struct PrfDataParam < ' a > {
@@ -210,7 +217,7 @@ impl From<&mut DerivedKey> for cryptoki_sys::CK_DERIVED_KEY {
210217 }
211218}
212219
213- /// NIST SP 800-108 (aka KBKDF) counter-mode parameters.
220+ /// NIST SP 800-108 (aka KBKDF) counter and double pipeline -mode parameters.
214221///
215222/// This structure wraps a `CK_SP800_108_KDF_PARAMS` structure.
216223#[ derive( Debug ) ]
@@ -225,7 +232,7 @@ pub struct KbkdfParams<'a> {
225232
226233impl < ' a > KbkdfParams < ' a > {
227234 /// Construct parameters for NIST SP 800-108 KDF (aka KBKDF) pseuderandom function-based key
228- /// derivation function, in counter-mode.
235+ /// derivation function, in counter or double pipeline -mode.
229236 ///
230237 /// # Arguments
231238 ///
0 commit comments