Everything the wrapper needs is now in place: \(\opl {Guard}\) and \(\opl {Mediate}\) and \(\opl {Silence}\) from Chapter 2, and the register \(\Corr \) of Section 3.1 that supplies \(\Cs \). The full interface of a standard functionality is their composition.
Functionality \(\F \)
\(\PID \), \(\Ps \), \(\admits \), \(\uses \), \(\pars \)
\(\id .\fopdef {Op}(in)\) from \(\id '\)
Lines 2–4 and 6–7 handle corruption, and are the only place a full interface consults the register. It is read twice because \(\Cs \) changes as the execution proceeds and a read is only a snapshot: the tests before line 6 use the first, the test on line 7 the second. Membership is monotone, \(\opl {Corrupt}\) only ever adding, so a party honest at the first read may be corrupt at the second but never the reverse.
Line 3 refuses one combination: the adversary at an honest party, which has no business there. Everything else passes, and \(\opl {Mediate}\) settles the rest. So an honest party is addressable by everyone but \(\Adv \) and runs its own core; a corrupt party is addressable by everyone, but only \(\Adv \) reaches its core, every other caller being answered by \(\Adv \) in the party’s place. The environment needs no case of its own: whether it claims its own identity or an admitted external one, a corrupt party answers it through \(\Adv \) either way.
That leaves a corrupt party addressed by anyone but \(\Adv \), whose call cannot simply be run, so \(\Adv \) answers in the party’s place. Lines 4 and 7 are the same wrapper at two moments. The first catches a party already corrupt on arrival and hands over \(in\), so the core never runs. The second catches one that turned corrupt while its core ran on line 5, and hands over \(out\), no longer the party’s to return. Monotonicity makes the two cover the cases exactly once: a party corrupt at the first has already returned, and none is corrupt at the first and honest at the second. Both hooks address \(\Adv \) at \((A,\id .P)\) through its full interface, so the answering adversary is guarded and silenced like any other callee. Line 8 returns the core’s own value, which happens in two cases: for a party honest throughout, and for a corrupt party addressed by \(\Adv \) itself, which the gate admits and which neither hook catches, both testing \(\id '.F \neq A\).
Remark 3.2 (Corruption mid-call is not preemptive). Nothing interrupts a core that is already running. Suppose the core on line 5 calls the adversary — through \(\Adv (\cdot )\), or through a subroutine that mediates — and the adversary corrupts \(\id .P\) before returning a value. The register records that at once, \(\Cs \) being its own state, but the core is neither told nor stopped: it resumes with whatever the adversary returned and runs to completion. Only on its return does line 6 read \(\Cs \) again, find \(\id .P\) in it, and hand \(out\) to \(\opl {Mediate}\) on line 7 to be replaced.
So the adversary holds the token twice over such a call, in this order: once inside the core, for the call the core placed, and once after the core has returned, for the mediation of its output. No moment in between lets the corruption take effect, since a party that turns corrupt mid-call cannot un-run what it has already done. Nor is the call re-gated: line 3 was decided on the first read, and a call admitted while \(\id .P\) was honest stays admitted. What the wrapper guarantees is therefore weaker than aborting, and sufficient: nothing a newly corrupt party computed reaches its caller unmediated. Calls arriving after the corruption are caught on the way in instead, by line 4.