ChainDefs.lean
libsignal's symmetric ratchet: the chain step and HMAC as a PRF on chain keys
Trusted: definitions used by the statement. The theorems of Computational/ use every definition in this file: read them. The theorems here are checked by Lean. See Computational/.
Models libsignal v0.105.4 ChainKey (rust/): one-byte domain-separated HMAC-SHA256 (chainHmac, messageKeySeed = 0x01, chainKeySeed = 0x02) and its PRF view hmacPRF.
@[expose] public sectionopen OracleComp OracleSpec ENNRealnamespace CryptoGamesnamespace Ratchetopen HMAC HKDF CBC LibsignalAead MACScheme AEADSchemeabbrev ChainKey
256-bit chain key as its 32 LE bytes (ChainKey.).
abbrev ChainKey := BitVec 256def chainHmac
ChainKey::calculate_base_material: HMAC-SHA256(ck, [b]).
def chainHmac (F : ShaState → List (BitVec 8) → ShaState) (ck : ChainKey) (b : BitVec 8) :
List (BitVec 8) :=
hmacWith F (keyToBytes32 ck) [b]def hmacPRF
HMAC-SHA256 on one-byte inputs as a 256-bit PRF (32 LE bytes).
end Ratchetend CryptoGames