Skip to content

Commit 50c6ced

Browse files
committedAug 12, 2019
During HKDF, call KeyType::len() at most once.
This shouldn't matter at all, except that it is easier to reason about, and potentially it is more efficient in the rare case that `KeyType::len()` is slow.
1 parent 6ec6e11 commit 50c6ced

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/hkdf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Prk {
126126
len: L,
127127
) -> Result<Okm<'a, L>, error::Unspecified> {
128128
let len_cached = len.len();
129-
if len.len() > 255 * self.0.algorithm().digest_algorithm().output_len {
129+
if len_cached > 255 * self.0.algorithm().digest_algorithm().output_len {
130130
return Err(error::Unspecified);
131131
}
132132
Ok(Okm {

0 commit comments

Comments
 (0)
Please sign in to comment.