Instances For
@[instance_reducible]
- State : Type
- PublicKey : Type
- PrivateKey : Type
- Ciphertext : Type
- Plaintext : Type
- privI : Inhabited self.PrivateKey
- ctI : Inhabited self.Ciphertext
Inhabitance witness only; never run a scheme against
stateI.default.- publicKeySize : Nat
- privateKeySize : Nat
- ciphertextSize : Nat
- plaintextSize : Nat
- encodePublicKey : self.PublicKey → Vector UInt8 self.publicKeySize
- decodePublicKey : Vector UInt8 self.publicKeySize → Option self.PublicKey
- encodePrivateKey : self.PrivateKey → Vector UInt8 self.privateKeySize
- decodePrivateKey : Vector UInt8 self.privateKeySize → Option self.PrivateKey
- encodeCiphertext : self.Ciphertext → Vector UInt8 self.ciphertextSize
- decodeCiphertext : Vector UInt8 self.ciphertextSize → Option self.Ciphertext
- encodePlaintext : self.Plaintext → Vector UInt8 self.plaintextSize
- decap : self.PrivateKey → self.Ciphertext → EStateM KEMError self.State self.Plaintext
Pre-encapsulation states that cannot cause a decryption failure.
Truefor a perfectly correct KEM; a lattice KEM restricts it to states whose sampled noise stays within bounds.- generate : EStateM KEMError self.State ((pk : self.PublicKey) ×' { sk : self.PrivateKey // ∀ (s : self.State), self.Reliable s → ∀ (c : self.Ciphertext) (k : self.Plaintext) (s' : self.State), self.encap pk s = EStateM.Result.ok (c, k) s' → ∀ (t : self.State), ∃ (t' : self.State), self.decap sk c t = EStateM.Result.ok k t' })
Deterministic state from a 32-byte seed.
- derivePublicKey : self.PrivateKey → self.PublicKey
- honestRoundTrip (sk : self.PrivateKey) (s : self.State) : self.Reliable s → ∀ (c : self.Ciphertext) (k : self.Plaintext) (s' : self.State), self.encap (self.derivePublicKey sk) s = EStateM.Result.ok (c, k) s' → ∀ (t : self.State), ∃ (t' : self.State), self.decap sk c t = EStateM.Result.ok k t'
Round trip for any private key and its derived public key, from a
Reliablestate. - decodePrivateKey_total (b : Vector UInt8 self.privateKeySize) : ∃ (sk : self.PrivateKey), self.decodePrivateKey b = some sk
Every byte string of the right width decodes to a private key.
- decode_encode_priv (sk : self.PrivateKey) : self.decodePrivateKey (self.encodePrivateKey sk) = some sk
- plaintextEq : DecidableEq self.Plaintext
Instances For
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
Equations
- Cryptlib.Primitives.KEM.KEM.instInhabitedState kemSpec = kemSpec.stateI
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
- Cryptlib.Primitives.KEM.KEM.PublicKey kemSpec = kemSpec.PublicKey
Instances For
@[instance_reducible]
Equations
- Cryptlib.Primitives.KEM.KEM.instInhabitedPublicKey kemSpec = kemSpec.pubI
@[reducible, inline]
Equations
- Cryptlib.Primitives.KEM.KEM.PrivateKey kemSpec = kemSpec.PrivateKey
Instances For
@[instance_reducible]
instance
Cryptlib.Primitives.KEM.KEM.instInhabitedPrivateKey
(kemSpec : KEM)
:
Inhabited (PrivateKey kemSpec)
Equations
- Cryptlib.Primitives.KEM.KEM.instInhabitedPrivateKey kemSpec = kemSpec.privI
@[reducible, inline]
Equations
- Cryptlib.Primitives.KEM.KEM.Ciphertext kemSpec = kemSpec.Ciphertext
Instances For
@[instance_reducible]
instance
Cryptlib.Primitives.KEM.KEM.instInhabitedCiphertext
(kemSpec : KEM)
:
Inhabited (Ciphertext kemSpec)
Equations
- Cryptlib.Primitives.KEM.KEM.instInhabitedCiphertext kemSpec = kemSpec.ctI
@[reducible, inline]
Equations
- Cryptlib.Primitives.KEM.KEM.Plaintext kemSpec = kemSpec.Plaintext
Instances For
@[instance_reducible]
Equations
- Cryptlib.Primitives.KEM.KEM.instInhabitedPlaintext kemSpec = kemSpec.ptI
@[instance_reducible]
instance
Cryptlib.Primitives.KEM.KEM.instDecidableEqPlaintext
(kemSpec : KEM)
:
DecidableEq (Plaintext kemSpec)
Equations
- Cryptlib.Primitives.KEM.KEM.instDecidableEqPlaintext kemSpec = kemSpec.plaintextEq
def
Cryptlib.Primitives.KEM.KEM.encap
(kemSpec : KEM)
:
PublicKey kemSpec → KEMM kemSpec (Ciphertext kemSpec × Plaintext kemSpec)
Equations
- Cryptlib.Primitives.KEM.KEM.encap kemSpec = kemSpec.encap
Instances For
def
Cryptlib.Primitives.KEM.KEM.decap
(kemSpec : KEM)
:
PrivateKey kemSpec → Ciphertext kemSpec → KEMM kemSpec (Plaintext kemSpec)
Equations
- Cryptlib.Primitives.KEM.KEM.decap kemSpec = kemSpec.decap
Instances For
def
Cryptlib.Primitives.KEM.KEM.IsEncapsulation
(kemSpec : KEM)
(sk : PrivateKey kemSpec)
(c : Ciphertext kemSpec)
(k : Plaintext kemSpec)
:
Equations
- Cryptlib.Primitives.KEM.KEM.IsEncapsulation kemSpec sk c k = ∀ (t : kemSpec.State), ∃ (t' : kemSpec.State), Cryptlib.Primitives.KEM.KEM.decap kemSpec sk c t = EStateM.Result.ok k t'
Instances For
def
Cryptlib.Primitives.KEM.KEM.KeyPair
(kemSpec : KEM)
(pk : PublicKey kemSpec)
(sk : PrivateKey kemSpec)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Cryptlib.Primitives.KEM.KEM.EStateM_triple_ok
{ε σ α : Type u_1}
{p : α → Prop}
{x : EStateM ε σ α}
(h : ∀ (t : σ) (a : α) (t' : σ), x t = EStateM.Result.ok a t' → p a)
:
Partial-correctness triple: if x returns, its result satisfies p.
theorem
Cryptlib.Primitives.KEM.KEM.generate_keyPair
(kemSpec : KEM)
{t : kemSpec.State}
{r : PublicKey kemSpec × PrivateKey kemSpec}
{t' : kemSpec.State}
(hr : generate kemSpec t = EStateM.Result.ok r t')
:
Whatever generate returns is a valid key pair.
theorem
Cryptlib.Primitives.KEM.KEM.encap_ok
(kemSpec : KEM)
{pk : PublicKey kemSpec}
{sk : PrivateKey kemSpec}
(h : KeyPair kemSpec pk sk)
(t : kemSpec.State)
(hrel : kemSpec.Reliable t)
(r : Ciphertext kemSpec × Plaintext kemSpec)
(t' : kemSpec.State)
:
encap kemSpec pk t = EStateM.Result.ok r t' → IsEncapsulation kemSpec sk r.fst r.snd
Encapsulation from a Reliable state to a valid key pair decapsulates correctly. Stated as a
plain proposition because the precondition constrains the starting state.