@@ -21,7 +21,7 @@ Header-only semi-honest 2PC built on top of [emp-tool](https://github.com/emp-to
2121## Usage
2222
2323The public handle is one session, ` SH2PCSession ` : it owns the IO channel and all
24- protocol state, and ` sess.direct_ctx () ` is the gate context your values are built over.
24+ protocol state, and ` sess.ctx () ` is the gate context your values are built over.
2525
2626``` cpp
2727#include < emp-sh2pc/emp-sh2pc.h>
@@ -31,11 +31,11 @@ int party = parse_party(argv); // argv[1]; port/IP come from $EMP_PORT / $EMP_
3131NetIO io (party == ALICE ? nullptr : peer_ip(), peer_port());
3232SH2PCSession sess(&io, party);
3333
34- using Ctx = SH2PCSession::DirectCtx ; // the gate context values are built over
34+ using Ctx = SH2PCSession::ctx_t ; // the gate context values are built over
3535using UInt32 = UInt_T<Ctx, 32>;
3636auto a = sess.input<UInt32 >(ALICE, av); // each party owns its input
3737auto b = sess.input<UInt32 >(BOB, bv);
38- auto c = a + b; // eager half-gate over sess.direct_ctx ()
38+ auto c = a + b; // eager half-gate over sess.ctx ()
3939uint32_t out = sess.reveal(c, PUBLIC).value(); // open the result to both parties
4040```
4141
@@ -45,9 +45,9 @@ both parties (each its own secret-share) for `reveal(v, XOR)` — and `std::null
4545on a party that does not. The session names no value family — circuit values are
4646emp-tool's context-bound types (`UInt_T<Ctx,N>`, `Int_T<Ctx,N>`, `Float_T<Ctx,W>`,
4747`BitVec_T<Ctx,N>`, `Bit_T<Ctx>`), and `input`/`reveal` are generic over any `WireValue`.
48- Public constants use `UInt32::constant(sess.direct_ctx (), 1)`. A reusable circuit is
48+ Public constants use `UInt32::constant(sess.ctx (), 1)`. A reusable circuit is
4949compiled once with the emp-tool frontend and replayed over the session's context with
50- `frontend::run(sess.direct_ctx (), circuit, args...)`. There is no global backend — the
50+ `frontend::run(sess.ctx (), circuit, args...)`. There is no global backend — the
5151session is explicit.
5252
5353## Requirements
@@ -109,15 +109,16 @@ wrapper script.
109109 e.g. ` ./run ./build/test_bit ` or
110110 ` ./run ./build/test_example 123 ` .
111111
112- * Two machines (IP addresses hardcoded in the test source):
112+ * Two machines: the shared port is ` $EMP_PORT ` (default 12345) and party 2
113+ dials ` $EMP_PEER_IP ` ; only the party id is a positional arg:
113114
114- ` ./build/[binary] 1 12345 [more opts] ` on one machine and
115- ` ./build/[binary] 2 12345 [more opts] ` on the other.
115+ ` ./build/[binary] 1 [more opts] ` on one machine and
116+ ` EMP_PEER_IP=<party-1-ip> ./build/[binary] 2 [more opts]` on the other.
116117
117118* ` test_example ` takes a per-party integer; the two parties must use
118119 different numbers:
119120
120- ` ./build/test_example 1 12345 123 & ./build/test_example 2 12345 124 `
121+ ` ./build/test_example 1 123 & EMP_PEER_IP=<party-1-ip> ./build/test_example 2 124 `
121122
122123` ctest --test-dir build --output-on-failure ` runs the entire suite.
123124
0 commit comments