How encryptogroup/motion works
1. MOTION is a C++20 framework for mixed-protocol secure multi-party computation. The core deliverable is a reusable library under src/motioncore, with optional example executables under src/examples and tests under src/test.
2. The highest-level runtime boundary is the “party” abstraction: each participant runs a local Party/Backend instance, loads a protocol configuration, and participates in distributed computation through a communication layer. The framework is designed for multiple parties executing the same circuit/protocol logic with secret-shared or garbled values.
3. Communication is isolated in src/motioncore/communication. It provides a transport-agnostic message system plus concrete transports:
- tcp_transport for real network communication
- dummy_transport for local or test execution
- message classes such as hello and garbled-circuit messages
FlatBuffers definitions live in fbs/, so serialized messages are a distinct boundary from protocol logic.
4. Protocol execution is centered around the generic gate, wire, share, and share_wrapper abstractions. Concrete protocol families implement these interfaces in subdirectories under src/motioncore/protocols, which is the main architectural partition of the computation layer.
5. The supported protocol families include boolean GMW, arithmetic GMW, BMR, garbled circuits, Astra, and constant shares. This means the framework can represent the same application at different abstraction levels and switch between protocols or mix them within one computation. Conversions between domains are handled explicitly in protocols/conversion, while protocols/data_management provides SIMD-style packing/unpacking and subset selection.
6. The garbled-circuit path is a major subsystem. It has its own provider, gate, share, wire, and constants, and it connects to dedicated message types in communication. This indicates a full end-to-end offline/online flow for garbled computation rather than a thin wrapper over another protocol.
7. Oblivious transfer is a separate foundational layer in src/motioncore/oblivious_transfer. It includes base OT providers and KK13-style 1-out-of-n OT flavors/providers. These primitives feed other protocol layers, especially garbled circuits and OT-based extensions.
8. Multiplication triples and Beaver-style randomness are another core service layer in src/motioncore/multiplication_triple. Providers for different share types supply preprocessed correlated randomness to arithmetic-style protocols. This preprocessing layer is structurally separate from online gate execution.
9. Cryptographic and randomness primitives are centralized in src/motioncore/primitives. This includes AES-NI helpers, BLAKE2b, Curve25519 code, PRGs, and RNG backends such as OpenSSL and AES-CTR. These primitives support OT, preprocessing, and protocol-specific randomness generation.
10. Application code is intentionally separated from the core framework. The examples in src/examples show how to build end-user MPC programs such as AES-128, SHA-256, the millionaires’ problem, benchmarking apps, and tutorial workloads like inner product and cross-tabs. This makes the repo both a library and a collection of reference deployments.
11. The circuits/ directory contains Bristol-format circuit descriptions and metadata for integer, float, and advanced functions like AES and SHA. These are externalized circuit assets consumed by protocol implementations, especially garbled-circuit-based ones, and they serve as the bridge between high-level applications and low-level gate networks.
12. Supporting infrastructure is substantial but secondary to the computation stack: utility/ contains threading/fiber pools, queues, logging, bit containers, and runtime helpers; statistics/ collects runtime measurements; data_storage/ holds OT extension state. This separation shows that MOTION’s architecture is layered around distributed protocol execution, with shared infrastructure reused across protocols and applications.
13. Build and portability are managed with CMake, optional bundled dependencies in extern/, and Docker for a reproducible environment. The repo also uses GoogleTest for validation and Benchmarks for performance experiments, reinforcing that this is a research/experimental MPC platform rather than an application-specific product.
Main entry points: backend.h Backend · communication_layer.h Comm layer · boolean_gmw_gate.h GMW / BMR / Astra · transport.h Transport
Components 27
Core runtime
Party lifecycle, backend orchestration, and execution scheduling.
- Party · Represents one participant in a distributed MPC run.
src/motioncore/base/party.h - Backend · Coordinates protocol setup and local execution for a party.
src/motioncore/base/backend.h - Config · Loads and holds protocol and runtime configuration.
src/motioncore/base/configuration.h - Gate exec · Executes protocol gates and drives computation order.
src/motioncore/executor/gate_executor.h
Communication
Transport-agnostic messaging and concrete network backends.
- Comm layer · Routes messages between protocol logic and transports.
src/motioncore/communication/communication_layer.h - Transport · Abstract transport interface for message delivery.
src/motioncore/communication/transport.h - TCP · Concrete network transport for real multi-party communication.
src/motioncore/communication/tcp_transport.h - Dummy · Local transport for testing and single-process execution.
src/motioncore/communication/dummy_transport.h - Message mgr · Creates, parses, and dispatches typed protocol messages.
src/motioncore/communication/message_manager.h - FlatBuffers · Serialized message definitions for communication payloads.
fbs/message.fbs
Protocols
Generic MPC abstractions and concrete protocol families.
- Gate · Common computation unit across protocol families.
src/motioncore/protocols/gate.h - Wire · Represents protocol-specific wire state flowing through gates.
src/motioncore/protocols/wire.h - Share · Base abstraction for secret-shared or garbled values.
src/motioncore/protocols/share.h - Share wrap · Wraps shares for type-safe protocol use and conversions.
src/motioncore/protocols/share_wrapper.h - Garbled circuits · Full garbled-circuit stack with provider, gates, shares, wires, and constants.
src/motioncore/protocols/garbled_circuit/garbled_circuit_provider.h - GMW / BMR / Astra · Boolean and arithmetic secret-sharing families plus BMR and Astra implementations.
src/motioncore/protocols/boolean_gmw/boolean_gmw_gate.h - Conversions · Explicit conversions between share domains and protocol types.
src/motioncore/protocols/conversion/conversion_gate.h - Data mgmt · SIMD packing, unpacking, and subset selection utilities.
src/motioncore/protocols/data_management/simdify_gate.h
Crypto primitives
Randomness and cryptographic building blocks used across the stack.
- Oblivious transfer · Base OT and KK13-style OT providers used by higher-level protocols.
src/motioncore/oblivious_transfer/ot_provider.h - Crypto primitives · AES, hashes, curves, PRGs, and RNG backends supporting OT and preprocessing.
src/motioncore/primitives/pseudo_random_generator.h
Infrastructure
Shared runtime utilities, preprocessing storage, and statistics.
- Mul triples · Beaver-style correlated randomness providers for arithmetic protocols.
src/motioncore/multiplication_triple/mt_provider.h - Utility · Threads, fibers, queues, logging, bit containers, and helpers.
src/motioncore/utility/helpers.h - Statistics · Runtime measurement and analysis collection.
src/motioncore/statistics/run_time_statistics.h - OT storage · Persistent state for OT extension and related preprocessing.
src/motioncore/data_storage/ot_extension_data.h
Applications
Example programs and benchmarks built on top of the library.
- Examples · Reference MPC applications and tutorials built on the framework.
src/examples/CMakeLists.txt - Benchmarks · Microbenchmarks for protocol and runtime performance.
src/benchmark/CMakeLists.txt
Assets
External circuit descriptions consumed by protocol implementations.
- Circuits · Bristol-format circuit assets for arithmetic, float, and advanced functions.
circuits/advanced/aes_128.bristol
Connections 28
- Party → Config: loads · A party uses configuration to initialize its runtime.
- Party → Backend: owns · The backend is the local execution context for one party.
- Backend → Comm layer: uses · Backend coordinates distributed message exchange through the communication layer.
- Backend → Gate exec: drives · Backend delegates local gate execution to the scheduler.
- Comm layer → Transport: abstracts · Communication layer hides the underlying transport.
- Transport → TCP: implements · TCP transport provides the real network backend.
- Transport → Dummy: implements · Dummy transport supports local and test execution.
- Comm layer → Message mgr: routes · Message manager handles typed message lifecycle and dispatch.
- Message mgr → FlatBuffers: serializes · FlatBuffers defines the wire format for messages.
- Gate → Wire: operates on · Gates consume and produce wire state.
- Wire → Share: backing · Shares and wires represent protocol-specific value state.
- Share → Share wrap: adapts · Wrapper provides typed access and conversion helpers.
- GMW / BMR / Astra → Gate: implements · Boolean GMW, arithmetic GMW, BMR, and Astra specialize the core gate model.
- GMW / BMR / Astra → Share: implements · Protocol families define share types.
- GMW / BMR / Astra → Wire: implements · Protocol families define wire types.
- Garbled circuits → Comm layer: exchanges · Garbled circuit execution uses dedicated messages through communication.
- Garbled circuits → Oblivious transfer: depends on · Garbled circuits use OT for key transfer and input handling.
- Conversions → Share wrap: converts · Conversion gates bridge between share domains.
- Data mgmt → Share wrap: packs · SIMD-style packing and subset selection work on wrapped shares.
- Oblivious transfer → Crypto primitives: uses · OT relies on cryptographic primitives and randomness generation.
- Mul triples → Crypto primitives: uses · Preprocessing randomness is built on cryptographic primitives.
- Mul triples → OT storage: persists · OT and preprocessing state is stored separately from online execution.
- Crypto primitives → Utility: supports · Primitive code relies on common low-level utilities and runtime helpers.
- Statistics → Utility: integrates · Statistics collection is part of the shared runtime infrastructure.
- Examples → Backend: uses · Examples build end-user MPC programs on the core backend.
- Examples → Circuits: consumes · Some examples rely on external circuit assets and metadata.
- Benchmarks → Gate exec: measures · Benchmarks exercise the executor and protocol layers.
- Circuits → Garbled circuits: feeds · Circuit assets are consumed by garbled-circuit-based protocols.