inst_kbkdf.bend source
inst_kbkdf.bend on the hub · documented module
# The named SP 800-108 KDFs (kbkdf.bend) over HMAC-SHA-256 (inst_sha2.bend),# with a 32-bit counter and a 32-bit [L]_2: counter mode, and feedback mode# with the counter. As a KDF (kdf.bend), counter mode is# ~Kb.CrKbkdf.derive(~Hm.CrHmacKey, ~Hm.CrHmac.key_of(~64n, ~SH.CrSha2.sha256), ~Hm.CrHmac.mac(~SH.CrSha2.sha256), ~32n, ~4n, ~4n)# and the same tuple with another MAC, its tag length, or other field# widths gives the other members of the family.import Baseimport bend-osdev-bytes@0.1.0.0/bytes.bend as Bimport ./crypto.bend as Crimport ./hmac.bend as Hmimport ./kbkdf.bend as Kbimport ./inst_sha2.bend as SHdef CrKbkdf.hmac_sha256_counter(ki: B.Octets, label: B.Octets, context: B.Octets, n: Nat) -> Result<&2, &2, Cr.CrError, B.Octets>: Kb.CrKbkdf.counter_kdf(~Hm.CrHmacKey, ~Hm.CrHmac.key_of(~64n, ~SH.CrSha2.sha256), ~Hm.CrHmac.mac(~SH.CrSha2.sha256), ~32n, ~4n, ~4n, ki, label, context, n)def CrKbkdf.hmac_sha256_feedback(ki: B.Octets, iv: B.Octets, label: B.Octets, context: B.Octets, n: Nat) -> Result<&2, &2, Cr.CrError, B.Octets>: Kb.CrKbkdf.feedback_kdf(~Hm.CrHmacKey, ~Hm.CrHmac.key_of(~64n, ~SH.CrSha2.sha256), ~Hm.CrHmac.mac(~SH.CrSha2.sha256), ~32n, ~4n, ~4n, ki, iv, label, context, n)