Repository navigation
session: let the caller choose the OT extension - #45
Merged
Merged
Conversation
SH2PCSession always ran IKNP for the correlated OTs behind BOB's private input bits. SH2PCSessionT<OTExt> takes any emp-ot OT extension (IKNP, SoftSpoken<k>, Ferret): the session calls only set_sid(), set_delta() and rcot(), which every OTExtension provides, and every extension puts BOB's choice bit in the low bit of his block, which is where the session reads it. SH2PCSession is SH2PCSessionT<IKNP>, so existing code compiles unchanged; both parties must choose the same extension. Each session also sets a fresh session id, sent by ALICE, on its OT extension before it starts, so the hash inputs of the extension and its base OTs are separate from every other session's. The handshake gains that one block. test_ot checks BOB inputs that take each refill path (from the buffer, across a refill, larger than the batch) and a dot product under IKNP, SoftSpoken<4> and Ferret; the concept test checks that every extension gives the same session surface over the same gate context. On loopback, a 1M-bit BOB input moves 17 MB under IKNP, 4.3 MB under SoftSpoken<4> and 0.6 MB under Ferret, whose fixed setup is about 0.4 MB; Ferret takes 2-4x the time on loopback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SH2PCSessionT<OTExt>takes any emp-ot OT extension for the correlated OTs behind BOB's private input bits, the only inputs that use OT.SH2PCSessionisSH2PCSessionT<IKNP>, so existing code compiles unchanged:The session calls only
set_sid(),set_delta()andrcot(), which everyOTExtensionprovides, and every extension puts BOB's choice bit in the low bit of his block, which is where the session reads it. Both parties must choose the same extension.Each session also sets a fresh session id (one block from ALICE) on its OT extension before it starts, so the hash inputs of the extension and its base OTs are separate from every other session's. The handshake gains that one block, so both parties need this version.
Closes #35.
Cost
Loopback on an Apple Silicon laptop, BOB input of n bits; Alice's bytes sent plus received, and wall time for the whole session:
SoftSpoken<4> moves a quarter of IKNP's bytes in the same time. Ferret has a fixed setup of about 0.4 MB and takes 2-4x the time on loopback, so it wins only when BOB's inputs are large and bandwidth is the bottleneck. The 128-bit row is mostly the session's first 16K-OT refill. The default stays IKNP.
Tests
test_ot: under IKNP, SoftSpoken<4> and Ferret, BOB inputs served from the refill buffer, straddling a refill, and larger than the batch must come back unchanged, and a 32-bit dot product must decode.test_session_concepts_sh2pcchecks that every extension gives the same session surface over the same gate context.🤖 Generated with Claude Code