Diffie-Hellman Key Exchange in Stateful Processes (testbed) #
This module formalises the Diffie-Hellman key exchange protocol in StatefulProcesses.
It is also intended as a simple testbed to measure improvement on how CSLib deals with embedded DSLs like Stateful Processes and reasoning on operational semantics.
Current aspects that stand out and could be more ergonomic are:
- The integration of Lean terms within expressions for computation at processes requires significant plumbing. Ideally, it should be seamless.
- The protocol has two obvious symbolic traces, yet proving
net_completeTracesis cumbersome. Perhaps an API for unique transitions could be partially helpful:
def _root_.Cslib.LTS.TrUnique (lts : LTS State Label) (s : State) (μ : Label) (s' : State) :=
lts.Tr s μ s' ∧ ∀ μ' s'', lts.Tr s μ' s'' → μ' = μ ∧ s'' = s'
The terms for Alice and Bob after one and two steps of their executions are provided as
reference for this endeavour.
3. As a consequence of (2), proving net_fun_correct is cumbersome.
Implementation notes #
The current implementation requires proofs that p is prime and that g is a primitive root modulo
p, but does not use these facts. They are reserved for future work on security results.
Basics #
Parameters of the DH protocol.
- alice : Pid
Alice.
- bob : Pid
Bob.
Alice and Bob have different names.
- a : ℕ
Alice's private key (secret).
- b : ℕ
Bob's private key (secret).
- x : Var
Bob's variable to store Alice's message.
- y : Var
Alice's variable to store Bob's message.
- s : Var
The variable used to store the shared key.
- p : ℕ
The prime modulus
p. pis prime.The generator
g.- g_primitive_root_p : IsPrimitiveRoot self.g (self.p - 1)
- SelLabel : Type u_3
SelLabel type for instantiating stateful processes.
- ProcName : Type u_4
ProcName type for instantiating stateful processes.
Instances For
Computes the public DH message from a private exponent.
Equations
- Cslib.Algorithms.StatefulProcesses.DiffieHellman.computePublicMessage p g privateExp = g ^ privateExp
Instances For
Behaviour #
Value type for DH.
- nat {Pid : Type u_1} {Var : Type u_2} {params : Params Pid Var} (n : ℕ) : params.Val
- zMod {Pid : Type u_1} {Var : Type u_2} {params : Params Pid Var} (z : ZMod params.p) : params.Val
Instances For
Alice's expression for computing the public message.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bob's expression for computing the public message.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Alice's program.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bob's program.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Semantics #
Implementation of local function call evaluation. Calls with a mismatched modulus are rejected.
Equations
- One or more equations did not get rendered due to their size.
- Cslib.Algorithms.StatefulProcesses.DiffieHellman.funEval params x✝² x✝¹ x✝ = False
Instances For
DH network.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Alice's program after one step.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Alice's program after two steps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bob's program after one step.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bob's program after two steps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The LTS of network configurations.
Equations
- params.cfgLts = Cslib.StatefulProcesses.Cfg.lts (fun (x : params.Val) => decide False) (Cslib.Algorithms.StatefulProcesses.DiffieHellman.funEval params)