Documentation

CslibFrontier.Crypto.Computational.AuthenticatedKeyExchange.Experiment

Authenticated key exchange: challenger and attack experiments #

Communication log, partner functions, challenger state, effective session keys, and the unified query handler challenger for Experiments 0 and 1 ([BS23], §21.9, pp. 886–888).

Model conventions and differences from [BS23] #

Challenger.hasConnection counts any .connected peer classification; hasKeyedConnection_eq shows agreement with requiring a key except after error (game equivalence unproved). Idealization.exposed hooks PFS and HSM extensions without changing challenger.

Main definitions and results #

References #

Entry recorded in the AKE communication log ([BS23], §21.9, p. 887).

  • corruptUser (user : List Bool) : LogEntry

    Corrupt user identity registered with the TTP.

  • init (inst : ℕ) (role : Role) : LogEntry

    Initialization of instance inst with role. Omits user (I.user.id), matching the literal (init, I, I.role) entry ([BS23], p. 887) so partner functions receive minimal information; any partner function here lifts to one given user IDs.

  • deliver (inst : ℕ) (msgIn msgOut : List Bool) (phase : Phase) : LogEntry

    Accepted .deliver step on instance inst; omits partner ID and session key.

  • deliverTTP (msgIn msgOut : List Bool) : LogEntry

    Accepted .deliverTTP message pair.

Instances For

    Extract the constructor payload or field; return none otherwise.

    Extract the constructor payload or field; return none otherwise.

    Extract the constructor payload or field; return none otherwise.

    A payload exists precisely when this constructor matches.

    theorem Cslib.Crypto.AKE.encLogEntry_deliverTTP_inSpace {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {S0 : γ → ℕ} {x1 : γ → List Bool} {S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits S0) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits S1) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => LogEntry.deliverTTP (x0 x) (x1 x)) encIn encLogEntry fun (x : γ) => S0 x + S1 x

    The complete payload determines exactly this constructor value.

    The matcher recognizes precisely the range of this constructor.

    theorem Cslib.Crypto.AKE.encLogEntry_deliver_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → Phase} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn (Turing.MultiTapeTM.encFinEnum Phase) T3 S3) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => LogEntry.deliver (x0 x) (x1 x) (x2 x) (x3 x)) encIn encLogEntry (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))

    Extract the constructor payload or field; return none otherwise.

    The matcher recognizes precisely the range of this constructor.

    def Cslib.Crypto.AKE.encLogEntry_elim {ε✝ : Sort u_1} :
    LogEntry → (f0 : List Bool → ε✝) → (f1 : ℕ × Role → ε✝) → (f2 : ℕ × List Bool × List Bool × Phase → ε✝) → (f3 : List Bool × List Bool → ε✝) → ε✝

    Case analysis by constructor, on the constructor payloads.

    theorem Cslib.Crypto.AKE.encLogEntry_deliver_inSpace {γ : Type} {encIn : γ ↪ List Bool} {x0 S0 : γ → ℕ} {x1 : γ → List Bool} {S1 : γ → ℕ} {x2 : γ → List Bool} {S2 : γ → ℕ} {x3 : γ → Phase} {S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary S0) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits S1) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits S2) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn (Turing.MultiTapeTM.encFinEnum Phase) S3) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => LogEntry.deliver (x0 x) (x1 x) (x2 x) (x3 x)) encIn encLogEntry fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))

    Extract the constructor payload or field; return none otherwise.

    Extract the constructor payload or field; return none otherwise.

    A payload exists precisely when this constructor matches.

    The complete payload determines exactly this constructor value.

    Extract the constructor payload or field; return none otherwise.

    The complete payload determines exactly this constructor value.

    theorem Cslib.Crypto.AKE.encLogEntry_elim_inO {π✝ ε✝ : Type} {encP : π✝ ↪ List Bool} {encE : ε✝ ↪ List Bool} {g0 : π✝ × List Bool → ε✝} {T0 S0 : π✝ × List Bool → ℕ} {g1 : π✝ × ℕ × Role → ε✝} {T1 S1 : π✝ × ℕ × Role → ℕ} {g2 : π✝ × ℕ × List Bool × List Bool × Phase → ε✝} {T2 S2 : π✝ × ℕ × List Bool × List Bool × Phase → ℕ} {g3 : π✝ × List Bool × List Bool → ε✝} {T3 S3 : π✝ × List Bool × List Bool → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO g0 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encBits) encE T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO g1 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encFinEnum Role))) encE T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO g2 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (Turing.MultiTapeTM.encFinEnum Phase))))) encE T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO g3 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) encE T3 S3) :
    Turing.MultiTapeTM.ComputableInO (fun (p : π✝ × LogEntry) => encLogEntry_elim p.2 (fun (a : List Bool) => g0 (p.1, a)) (fun (a : ℕ × Role) => g1 (p.1, a)) (fun (a : ℕ × List Bool × List Bool × Phase) => g2 (p.1, a)) fun (a : List Bool × List Bool) => g3 (p.1, a)) (Turing.MultiTapeTM.encPair encP encLogEntry) encE (fun (p : π✝ × LogEntry) => 4 * ((Turing.MultiTapeTM.encPair encP encLogEntry) p).length + encLogEntry_elim p.2 (fun (a : List Bool) => T0 (p.1, a)) (fun (a : ℕ × Role) => T1 (p.1, a)) (fun (a : ℕ × List Bool × List Bool × Phase) => T2 (p.1, a)) fun (a : List Bool × List Bool) => T3 (p.1, a)) fun (p : π✝ × LogEntry) => 4 * ((Turing.MultiTapeTM.encPair encP encLogEntry) p).length + encLogEntry_elim p.2 (fun (a : List Bool) => S0 (p.1, a)) (fun (a : ℕ × Role) => S1 (p.1, a)) (fun (a : ℕ × List Bool × List Bool × Phase) => S2 (p.1, a)) fun (a : List Bool × List Bool) => S3 (p.1, a)

    Extract the constructor payload or field; return none otherwise.

    Test whether the value has this constructor.

    theorem Cslib.Crypto.AKE.encLogEntry_corruptUser_inSpace {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {S0 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits S0) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => LogEntry.corruptUser (x0 x)) encIn encLogEntry fun (x : γ) => S0 x
    theorem Cslib.Crypto.AKE.encLogEntry_elim_inSpace {π✝ ε✝ : Type} {encP : π✝ ↪ List Bool} {encE : ε✝ ↪ List Bool} {g0 : π✝ × List Bool → ε✝} {S0 : π✝ × List Bool → ℕ} {g1 : π✝ × ℕ × Role → ε✝} {S1 : π✝ × ℕ × Role → ℕ} {g2 : π✝ × ℕ × List Bool × List Bool × Phase → ε✝} {S2 : π✝ × ℕ × List Bool × List Bool × Phase → ℕ} {g3 : π✝ × List Bool × List Bool → ε✝} {S3 : π✝ × List Bool × List Bool → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace g0 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encBits) encE S0) (h1 : Turing.MultiTapeTM.ComputableInSpace g1 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encFinEnum Role))) encE S1) (h2 : Turing.MultiTapeTM.ComputableInSpace g2 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (Turing.MultiTapeTM.encFinEnum Phase))))) encE S2) (h3 : Turing.MultiTapeTM.ComputableInSpace g3 (Turing.MultiTapeTM.encPair encP (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits)) encE S3) :
    Turing.MultiTapeTM.ComputableInSpace (fun (p : π✝ × LogEntry) => encLogEntry_elim p.2 (fun (a : List Bool) => g0 (p.1, a)) (fun (a : ℕ × Role) => g1 (p.1, a)) (fun (a : ℕ × List Bool × List Bool × Phase) => g2 (p.1, a)) fun (a : List Bool × List Bool) => g3 (p.1, a)) (Turing.MultiTapeTM.encPair encP encLogEntry) encE fun (p : π✝ × LogEntry) => 4 * ((Turing.MultiTapeTM.encPair encP encLogEntry) p).length + encLogEntry_elim p.2 (fun (a : List Bool) => S0 (p.1, a)) (fun (a : ℕ × Role) => S1 (p.1, a)) (fun (a : ℕ × List Bool × List Bool × Phase) => S2 (p.1, a)) fun (a : List Bool × List Bool) => S3 (p.1, a)

    Extract the constructor payload or field; return none otherwise.

    Test whether the value has this constructor.

    Extract the constructor payload or field; return none otherwise.

    Extract the constructor payload or field; return none otherwise.

    A payload exists precisely when this constructor matches.

    Test whether the value has this constructor.

    @[reducible, inline]

    The encoding of the constructor payloads of encLogEntry.

    A payload exists precisely when this constructor matches.

    Framing encoding of LogEntry via enc_inductive.

    Extract the constructor payload or field; return none otherwise.

    The matcher recognizes precisely the range of this constructor.

    theorem Cslib.Crypto.AKE.encLogEntry_corruptUser_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => LogEntry.corruptUser (x0 x)) encIn encLogEntry (fun (x : γ) => T0 x) fun (x : γ) => S0 x
    theorem Cslib.Crypto.AKE.encLogEntry_deliverTTP_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => LogEntry.deliverTTP (x0 x) (x1 x)) encIn encLogEntry (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

    The complete payload determines exactly this constructor value.

    The matcher recognizes precisely the range of this constructor.

    Test whether the value has this constructor.

    Extract the constructor payload or field; return none otherwise.

    theorem Cslib.Crypto.AKE.encLogEntry_init_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → Role} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encFinEnum Role) T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => LogEntry.init (x0 x) (x1 x)) encIn encLogEntry (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

    The constructor payloads of a value, as a summand.

    theorem Cslib.Crypto.AKE.encLogEntry_init_inSpace {γ : Type} {encIn : γ ↪ List Bool} {x0 S0 : γ → ℕ} {x1 : γ → Role} {S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary S0) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encFinEnum Role) S1) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => LogEntry.init (x0 x) (x1 x)) encIn encLogEntry fun (x : γ) => S0 x + S1 x
    @[reducible, inline]

    Encoding of a communication log as a list of LogEntry values.

    Classification returned by a partner function ([BS23], §21.9, pp. 887–888).

    • vulnerable : Classification

      Return I.sk when I.pid is corrupt (or exposed), else error (none).

    • fresh : Classification

      Draw a uniform key from 𝒦 when I.pid is registered, else error.

    • connected (peer : ℕ) : Classification

      Copy J.effectiveKey when peer (J) is compatible, fresh, and unconnected.

    Instances For

      The matcher recognizes precisely the range of this constructor.

      The matcher recognizes precisely the range of this constructor.

      Extract the constructor payload or field; return none otherwise.

      Extract the constructor payload or field; return none otherwise.

      @[reducible, inline]

      The encoding of the constructor payloads of encClassification.

      Test whether the value has this constructor.

      The constructor payloads of a value, as a summand.

      Extract the constructor payload or field; return none otherwise.

      The matcher recognizes precisely the range of this constructor.

      theorem Cslib.Crypto.AKE.encClassification_fresh_inO {γ : Type} {encIn : γ ↪ List Bool} :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => Classification.fresh) encIn encClassification (fun (x : γ) => (encIn x).length) fun (x : γ) => (encIn x).length
      theorem Cslib.Crypto.AKE.encClassification_elim_inSpace {π✝ ε✝ : Type} {encP : π✝ ↪ List Bool} {encE : ε✝ ↪ List Bool} {g0 : π✝ × Unit → ε✝} {S0 : π✝ × Unit → ℕ} {g1 : π✝ × Unit → ε✝} {S1 : π✝ × Unit → ℕ} {g2 : π✝ × ℕ → ε✝} {S2 : π✝ × ℕ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace g0 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnit) encE S0) (h1 : Turing.MultiTapeTM.ComputableInSpace g1 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnit) encE S1) (h2 : Turing.MultiTapeTM.ComputableInSpace g2 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnary) encE S2) :
      Turing.MultiTapeTM.ComputableInSpace (fun (p : π✝ × Classification) => encClassification_elim p.2 (fun (a : Unit) => g0 (p.1, a)) (fun (a : Unit) => g1 (p.1, a)) fun (a : ℕ) => g2 (p.1, a)) (Turing.MultiTapeTM.encPair encP encClassification) encE fun (p : π✝ × Classification) => 3 * ((Turing.MultiTapeTM.encPair encP encClassification) p).length + encClassification_elim p.2 (fun (a : Unit) => S0 (p.1, a)) (fun (a : Unit) => S1 (p.1, a)) fun (a : ℕ) => S2 (p.1, a)
      theorem Cslib.Crypto.AKE.encClassification_vulnerable_inO {γ : Type} {encIn : γ ↪ List Bool} :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => Classification.vulnerable) encIn encClassification (fun (x : γ) => (encIn x).length) fun (x : γ) => (encIn x).length

      Test whether the value has this constructor.

      theorem Cslib.Crypto.AKE.encClassification_elim_inO {π✝ ε✝ : Type} {encP : π✝ ↪ List Bool} {encE : ε✝ ↪ List Bool} {g0 : π✝ × Unit → ε✝} {T0 S0 : π✝ × Unit → ℕ} {g1 : π✝ × Unit → ε✝} {T1 S1 : π✝ × Unit → ℕ} {g2 : π✝ × ℕ → ε✝} {T2 S2 : π✝ × ℕ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO g0 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnit) encE T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO g1 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnit) encE T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO g2 (Turing.MultiTapeTM.encPair encP Turing.MultiTapeTM.encUnary) encE T2 S2) :
      Turing.MultiTapeTM.ComputableInO (fun (p : π✝ × Classification) => encClassification_elim p.2 (fun (a : Unit) => g0 (p.1, a)) (fun (a : Unit) => g1 (p.1, a)) fun (a : ℕ) => g2 (p.1, a)) (Turing.MultiTapeTM.encPair encP encClassification) encE (fun (p : π✝ × Classification) => 3 * ((Turing.MultiTapeTM.encPair encP encClassification) p).length + encClassification_elim p.2 (fun (a : Unit) => T0 (p.1, a)) (fun (a : Unit) => T1 (p.1, a)) fun (a : ℕ) => T2 (p.1, a)) fun (p : π✝ × Classification) => 3 * ((Turing.MultiTapeTM.encPair encP encClassification) p).length + encClassification_elim p.2 (fun (a : Unit) => S0 (p.1, a)) (fun (a : Unit) => S1 (p.1, a)) fun (a : ℕ) => S2 (p.1, a)
      def Cslib.Crypto.AKE.encClassification_elim {ε✝ : Sort u_1} :
      Classification → (f0 f1 : Unit → ε✝) → (f2 : ℕ → ε✝) → ε✝

      Case analysis by constructor, on the constructor payloads.

      Extract the constructor payload or field; return none otherwise.

      The complete payload determines exactly this constructor value.

      theorem Cslib.Crypto.AKE.encClassification_connected_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => Classification.connected (x0 x)) encIn encClassification (fun (x : γ) => T0 x) fun (x : γ) => S0 x

      A payload exists precisely when this constructor matches.

      The complete payload determines exactly this constructor value.

      Test whether the value has this constructor.

      @[reducible, inline]

      Partner function taking security parameter n and communication log.

      Honest user registered with the TTP (U.id, U.ltk).

      Instances For

        Execution state of an honest user session instance ([BS23], §21.9, p. 886).

        • user : List Bool

          Identity of the honest user owning the instance.

        • longTermKey : List Bool

          Long-term secret key of the owning user.

        • role : Role

          Role assigned at initialization.

        • state : List Bool

          Current local state word.

        • phase : Phase

          Current execution status (running, aborted, or finished).

        • partner : List Bool

          Partner identity, read when phase = .finished.

        • key : List Bool

          Session key, read when phase = .finished.

        • classification : Option Classification

          Partner-function classification recorded in Experiment 1 (none until finished).

        • effectiveKey : Option (List Bool)

          Effective session key assigned when finishing in Experiment 1 (none if error/unset).

        Instances For

          Finished instances I, J are compatible when each names the other as partner and they have opposite roles ([BS23], §21.9, p. 888).

          Instances For

            Mutable state of the AKE challenger ([BS23], §21.9, pp. 886–888).

            • ttp : List Bool

              Internal state word of the TTP.

            • honest : List HonestUser

              Registered honest users.

            • corrupt : List (List Bool)

              Corrupt user identities (repeats allowed from repeated queries).

            • instances : List Instance

              Honest user instances in creation order (0, 1, …).

            • Communication log passed to the partner function in Experiment 1.

            Instances For

              Look up an honest user record by identity.

              Whether user is registered as an honest user.

              Whether user has been registered as a corrupt user.

              Whether user has been registered either honestly or corruptly.

              Whether any instance in s has already been classified as .connected peer. Implements the first reading of "no other user instance previously connected to it" ([BS23], p. 888): any .connected peer classification counts, even when that instance received error (effectiveKey = none). See hasKeyedConnection_eq.

              Idealization hook for Experiment 1 ([BS23], §21.9, pp. 887–893). Static security (Protocol.StaticallySecure) leaves exposed at its default (fun _ _ => false); PFS and HSM security (Definitions 21.2 and 21.3) supply nontrivial exposed predicates for .vulnerable instances without changing challenger.

              • Partner function classifying each finishing instance from the communication log.

              • exposed : Challenger → ℕ → Bool

                Extra exposure condition making a .vulnerable instance i in state s reveal I.key rather than error (none). Defaults to false.

              Reply returned by an accepted .deliver query on a running instance.

              • message : List Bool

                Outgoing protocol message m_out.

              • phase : Phase

                Resulting instance phase.

              • partner : List Bool

                Partner identity ([] unless phase = .finished).

              • key : Option (List Bool)

                Session key or effective session key (none denotes error or non-finished phase).

              Instances For
                theorem Cslib.Crypto.AKE.encDeliverReply_mk_deg :
                Turing.MultiTapeTM.ComputableInDegree (fun (p : List Bool × Phase × List Bool × Option (List Bool)) => { message := p.1, phase := p.2.1, partner := p.2.2.1, key := p.2.2.2 }) encDeliverReplyFields encDeliverReply 1 1
                theorem Cslib.Crypto.AKE.encDeliverReply_partner_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DeliverReply} :
                theorem Cslib.Crypto.AKE.encDeliverReply_phase_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DeliverReply} :
                theorem Cslib.Crypto.AKE.encDeliverReply_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → Phase} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → Option (List Bool)} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encFinEnum Phase) T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) T3 S3) :
                Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { message := x0 x, phase := x1 x, partner := x2 x, key := x3 x }) encIn encDeliverReply (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
                theorem Cslib.Crypto.AKE.encDeliverReply_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List Bool} {x1 : γ → Phase} {x2 : γ → List Bool} {x3 : γ → Option (List Bool)} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encFinEnum Phase) budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn (Turing.MultiTapeTM.encOption Turing.MultiTapeTM.encBits) budget) :
                Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { message := x0 x, phase := x1 x, partner := x2 x, key := x3 x }) encIn encDeliverReply budget
                theorem Cslib.Crypto.AKE.encDeliverReply_message_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DeliverReply} :
                theorem Cslib.Crypto.AKE.encDeliverReply_key_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → DeliverReply} :

                Oracle query tags exposed to an active AKE adversary ([BS23], §21.9, pp. 886–887).

                • registerHonest : Op

                  Register an honest user (req = user).

                • registerCorrupt : Op

                  Register a corrupt user (req = encPair encBits encBits (user, msg)).

                • init (role : Role) : Op

                  Initialize an honest instance with role (req = user).

                • deliver : Op

                  Deliver a protocol message (req = encPair encBits encBits (idx, msg)).

                • deliverTTP : Op

                  Deliver an online message to the TTP (req = msg).

                Instances For
                  @[instance_reducible]
                  @[instance_reducible]
                  noncomputable def Cslib.Crypto.AKE.effectiveKey (P : Protocol) (n : ℕ) (c : Classification) (exposed : Bool) (I : Instance) (s : Challenger) :

                  Effective session key distribution for a finishing instance I under classification c and exposure flag exposed in state s ([BS23], §21.9, p. 888). Returns none for error.

                  Query handler for Experiment 0 (ideal = none) and Experiment 1 (ideal = some idl) ([BS23], §21.9, pp. 886–888). Disallowed queries, and queries that would hand a protocol algorithm a word longer than P.sizeBound n (Protocol.TooLong), return [] with unchanged state; refusal depends only on (honestIds, corruptIds, instancePhases) and the lengths of the request's words (challenger_of_refused, view_of_mem_support). Clients should rewrite with challenger_* equations.

                  theorem Cslib.Crypto.AKE.encDeliverReply_some (message : List Bool) (phase : Phase) (partner key : List Bool) :
                  encDeliverReply { message := message, phase := phase, partner := partner, key := some key } = encDeliverReply { message := message, phase := phase, partner := partner, key := none } ++ true :: key

                  Encoded some key reply equals none (error) reply followed by true :: key.

                  theorem Cslib.Crypto.AKE.challenger_registerHonest (P : Protocol) (n : ℕ) (ideal : Option Idealization) (user : List Bool) (s : Challenger) :
                  challenger P n ideal (Op.registerHonest, user) s = if s.isRegistered user = true ∨ P.TooLong n user then pure ([], s) else do let out ← P.registerHonest { parameter := n, ttp := s.ttp, user := user, message := [] } pure ([], { ttp := out.ttp, honest := s.honest ++ [{ id := user, longTermKey := out.output }], corrupt := s.corrupt, instances := s.instances, log := s.log })

                  Query equation for .registerHonest.

                  theorem Cslib.Crypto.AKE.challenger_init (P : Protocol) (n : ℕ) (ideal : Option Idealization) (role : Role) (user : List Bool) (s : Challenger) :
                  challenger P n ideal (Op.init role, user) s = match s.findHonest user with | none => pure ([], s) | some u => have inst := { user := u.id, longTermKey := u.longTermKey, role := role, state := [], phase := Phase.running, partner := [], key := [] }; pure ([], { ttp := s.ttp, honest := s.honest, corrupt := s.corrupt, instances := s.instances ++ [inst], log := s.log ++ [LogEntry.init s.instances.length role] })

                  Query equation for .init.

                  theorem Cslib.Crypto.AKE.challenger_deliverTTP (P : Protocol) (n : ℕ) (ideal : Option Idealization) (msg : List Bool) (s : Challenger) :
                  challenger P n ideal (Op.deliverTTP, msg) s = if P.TooLong n msg then pure ([], s) else do let out ← P.ttpStep { parameter := n, ttp := s.ttp, user := [], message := msg } pure (out.output, { ttp := out.ttp, honest := s.honest, corrupt := s.corrupt, instances := s.instances, log := s.log ++ [LogEntry.deliverTTP msg out.output] })

                  Query equation for .deliverTTP.

                  Query equation for .deliver targeting a non-existent instance index.

                  Query equation for .deliver targeting a non-running instance.

                  Query equation for .deliver with a message longer than P.sizeBound n.

                  theorem Cslib.Crypto.AKE.challenger_deliver_of_running (P : Protocol) (n : ℕ) (ideal : Option Idealization) (req : List Bool) (s : Challenger) (inst : Instance) (h : s.instances[(Turing.MultiTapeTM.unframe req).length]? = some inst) (hphase : inst.phase = Phase.running) (hlen : ¬P.TooLong n (Turing.MultiTapeTM.dropFrame req)) :
                  challenger P n ideal (Op.deliver, req) s = have i := (Turing.MultiTapeTM.unframe req).length; have msg := Turing.MultiTapeTM.dropFrame req; do let out ← P.step { parameter := n, user := inst.user, longTermKey := inst.longTermKey, role := inst.role, state := inst.state, message := msg } have stepInst : Instance := { user := inst.user, longTermKey := inst.longTermKey, role := inst.role, state := out.state, phase := out.phase, partner := out.partner, key := out.key, classification := inst.classification, effectiveKey := inst.effectiveKey } have s' : Challenger := { ttp := s.ttp, honest := s.honest, corrupt := s.corrupt, instances := s.instances.set i stepInst, log := s.log ++ [LogEntry.deliver i msg out.message out.phase] } if out.phase = Phase.finished then match ideal with | none => pure (encDeliverReply { message := out.message, phase := Phase.finished, partner := out.partner, key := some out.key }, s') | some idl => have c := idl.partner s'.log; do let esk ← effectiveKey P n c (idl.exposed s' i) stepInst s' have finInst : Instance := { user := inst.user, longTermKey := inst.longTermKey, role := inst.role, state := out.state, phase := out.phase, partner := out.partner, key := out.key, classification := some c, effectiveKey := esk } pure (encDeliverReply { message := out.message, phase := Phase.finished, partner := out.partner, key := esk }, { ttp := s'.ttp, honest := s'.honest, corrupt := s'.corrupt, instances := s'.instances.set i finInst, log := s'.log }) else pure (encDeliverReply { message := out.message, phase := out.phase, partner := [], key := none }, s')

                  Query equation for .deliver of a message of at most P.sizeBound n bits to a running instance.