@@ -98,15 +98,22 @@ pub enum PrfDataParamType<'a> {
98
98
IterationVariable ( Option < & ' a KbkdfCounterFormat > ) ,
99
99
/// Identifies location of counter in constructed PRF input data.
100
100
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.
102
102
DkmLength ( & ' a KbkdfDkmLengthFormat ) ,
103
103
/// Identifies location and value of byte array of data in constructed PRF input data.
104
104
ByteArray ( & ' a [ u8 ] ) ,
105
105
}
106
106
107
107
/// A segment of input data for the PRF, to be used to construct a sequence of input.
108
108
///
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.
110
117
#[ derive( Debug , Clone , Copy ) ]
111
118
#[ repr( transparent) ]
112
119
pub struct PrfDataParam < ' a > {
@@ -210,7 +217,7 @@ impl From<&mut DerivedKey> for cryptoki_sys::CK_DERIVED_KEY {
210
217
}
211
218
}
212
219
213
- /// NIST SP 800-108 (aka KBKDF) counter-mode parameters.
220
+ /// NIST SP 800-108 (aka KBKDF) counter and double pipeline -mode parameters.
214
221
///
215
222
/// This structure wraps a `CK_SP800_108_KDF_PARAMS` structure.
216
223
#[ derive( Debug ) ]
@@ -225,7 +232,7 @@ pub struct KbkdfParams<'a> {
225
232
226
233
impl < ' a > KbkdfParams < ' a > {
227
234
/// 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.
229
236
///
230
237
/// # Arguments
231
238
///
0 commit comments