From cac466f5ed54f4dead5286e444b5e62643eb6f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sat, 9 Mar 2024 16:26:21 +0100 Subject: [PATCH] Use a NonZeroU64 since the periodicity cannot be zero --- src/kdf.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kdf.rs b/src/kdf.rs index 6b7d379..a44066c 100644 --- a/src/kdf.rs +++ b/src/kdf.rs @@ -1,5 +1,6 @@ use crate::canonicalization::canonicalize; use crate::ikm::InputKeyMaterial; +use std::num::NonZeroU64; pub(crate) type KdfFunction = dyn Fn(&str, &[u8]) -> Vec; @@ -13,8 +14,8 @@ impl KeyContext { self.periodicity = None; } - pub fn set_periodicity(&mut self, periodicity: u64) { - self.periodicity = Some(periodicity); + pub fn set_periodicity(&mut self, periodicity: NonZeroU64) { + self.periodicity = Some(periodicity.get()); } pub(crate) fn get_ctx_elems(&self, time_period: Option) -> Vec> {