LogoLogo
LogoLogo
  • Introduction
    • About Us
    • Notations & Definitions
      • MPC
      • ZK
    • Contribute to this Site!
  • Primitives
    • Multiplication
      • Karatsuba Multiplication
      • Toom-Cook Multiplication
    • NAF (Non-adjacent form)
    • Chinese Remainder Theorem (CRT)
    • Euclidean Algorithm
      • Extended Euclidean Algorithm
      • Binary Euclidean Algorithm
      • Extended Binary Euclidean Algorithm
    • Coding Theory
      • Linear Code
    • Number Theoretic Transform
    • Abstract Algebra
      • Group
        • -Morphisms
        • Batch Inverse
      • Elliptic Curve
        • Weierstrass Curve
          • Coordinate Forms
          • Fast Elliptic Curve Arithmetic and Improved WEIL Pairing Evaluation
        • Edwards Curve
          • Coordinate Forms
          • Twisted Edwards ↔ Short Weierstrass Transformation
        • Batch Inverse for Batch Point Additions
        • Scalar Multiplication
          • Double-and-add
          • GLV Decomposition
        • MSM
          • Pippenger's Algorithm
          • Signed Bucket Index
          • CycloneMSM
          • EdMSM
          • cuZK
        • 2-Chain and 2-Cycle of Elliptic Curves
    • Encryption Scheme
      • ElGamal Encryption
    • Modular Arithmetic
      • Modular Reduction
        • Barrett Reduction
        • Montgomery Reduction
      • Modular Inverse
        • Bernstein-Yang's Inverse
    • Multiset Check
    • Sumcheck
    • Commitment Scheme
      • Fflonk
      • SHPlonk
      • Zeromorph
  • MPC
    • Yao's Garbled Circuits
    • GMW
    • BMR
  • ZK
    • Arithmetization
      • R1CS
      • PLONK
      • AIR
    • Folding
      • LatticeFold
      • Nova
        • Nova over Cycles of Curves
    • Lookup
      • Lasso
      • LogUp-GKR
    • SNARK
      • Groth16
      • HyperPlonk
      • Spartan
        • SPARK
    • STARK
      • Additive NTT
      • Basefold
      • Binius
      • Brakedown
      • CircleSTARK
      • FRI
        • FRI Security Features and Optimizations
      • DEEP FRI
      • STIR
      • WHIR
    • Distributed ZK
      • Ryan's Trick for Distributed Groth16
  • Application
    • zkLogin
    • zkHoldem
    • zkTLS
      • DECO
      • Proxying is enough
  • zkVM
Powered by GitBook
On this page
  • Definitions
  • A wire sublabel for a given value, gate, and party:
  • Each party’s underlying-MPC input per wire :
  • Naively encrypted row of table:
  • Creating the Garbled Table Naively
  • Creating the Garbled Table Securely with Flip Bits
  • BMR Protocol Summary
  • References
Export as PDF
  1. MPC

BMR

Presentation: https://www.youtube.com/watch?v=8fvH4GM_A5k

PreviousGMWNextArithmetization

Last updated 2 months ago

Created by Beaver, Micali, and Rogaway in 1990, the BMR protocol is an multi-party computation (MPC) for boolean circuits for greater than 2 parties. It extends upon the core concept of Yao’s Garbled Circuits with its garbled tables and also carries a constant communication cost similar to Yao’s. Note that explanations online on the specifics of the protocol vary due to the more conceptual nature of the , so we will focus mostly on the explanation outlined . It is heavily recommended you read as a prerequisite.

Definitions

Let’s start with the basics: the definitions.

A wire sublabel for a given value, gate, and party:

wi,jb=(ki,jb,pi,jb)∈R{0,1}κ+1w^{b}_{i,j} = \left( k^{b}_{i,j}, p^{b}_{i,j} \right) \in_{\mathbb{R}} \{0,1\}^{\kappa+1} wi,jb​=(ki,jb​,pi,jb​)∈R​{0,1}κ+1

www = the wire bbb = the true value of the wire (0 or 1) iii = the unique wire ID jjj = the unique party ID kkk = the key to a given value of the wire (length κ\kappaκ) ppp = the pointer bit of the given value of the wire (length 1)

Thus, the wire sublabel for a gate by a given party is a set of κ+1\kappa + 1κ+1 random bits, κ\kappaκ of which are the key bits corresponding to a value and 1 of which is the pointer bit used later for shuffling the encrypted tables. Additionally note that the final wire label wib= wi,1b∣∣ wi,2b∣∣⋯∣∣ wi,n−1b∣∣ wi,nbw_i^b = w_{i,1}^b || w_{i,2}^b || \cdots || w_{i,n-1}^b || w_{i,n}^bwib​= wi,1b​∣∣ wi,2b​∣∣⋯∣∣ wi,n−1b​∣∣ wi,nb​, where 1 to nnn denote the parties.

More on Pointer Bits

Let’s expand some more on pointer bits. Each party holds a pointer bit share for a wire’s input value. Additionally, all parties’ pointer bit shares are XOR-ed together should create the final desired pointer bit for that wire input value. AKA pa0=pa,10⊕pa,20⊕pa,30⊕⋯⊕pa,n0p_a^0 = p_{a,1}^0 \oplus p_{a,2}^0 \oplus p_{a,3}^0 \oplus \dots \oplus p_{a,n}^0pa0​=pa,10​⊕pa,20​⊕pa,30​⊕⋯⊕pa,n0​ where pa0p_a^0pa0​ is the pointer bit for input value 0 on wire aaa and 1 to nnn are the parties. Subsequently, the pointer bit for the opposite input value should be the opposite bit (AKA pa1=1−pa0p_a^1 = 1- p_a^0pa1​=1−pa0​ or pa1⊕pa0=1p_a^1 \oplus p_a^0 = 1pa1​⊕pa0​=1)

The pointer bits for a given gate with 3 wires a, b, and c

Each party’s underlying-MPC input per wire www:

Ii,j=(F(i,wi,j0),F(i,wi,j1),pi,j0,fi,j)I_{i,j} = \left( F(i, w_{i,j}^{0}), F(i, w_{i,j}^{1}), p_{i,j}^{0}, f_{i,j} \right)Ii,j​=(F(i,wi,j0​),F(i,wi,j1​),pi,j0​,fi,j​)

III = the gate input FFF = A pseudo-random function (PRF) defined as the following:

F:id,{0,1}κ+1↦{0,1}n⋅(κ+1)F : id, \{0,1\}^{\kappa+1} \mapsto \{0,1\}^{n \cdot (\kappa+1)} F:id,{0,1}κ+1↦{0,1}n⋅(κ+1)

fff = the flip bit

For each gate, the input for each party will be the two PRFs of the gate index with the sublabels corresponding to input of 0 or 1, the pointer bit of the true input value, and the flip bit (more on this later).

Naively encrypted row of table:

eva,vb=wcvc⨁j=1..n(F(i,wa,jva)⊕F(i,wb,jvb))e_{v_a, v_b} = w^{v_c}_{c} \bigoplus\limits_{j=1..n} \left( F(i, w^{v_a}_{a,j}) \oplus F(i, w^{v_b}_{b,j}) \right) eva​,vb​​=wcvc​​j=1..n⨁​(F(i,wa,jva​​)⊕F(i,wb,jvb​​))

eva,vbe_{v_a, v_b}eva​,vb​​ = encrypted row on input values vav_ava​ and vbv_bvb​ vav_ava​ = value of input wire aaa vbv_bvb​ = value of input wire bbb vcv_cvc​ = value of output wire ccc

Note that the first subscript of the wires www also indicate the wire ID, where aaa and bbb refer to the input wires of a given gate and ccc refers to the output wire. Therefore, wcvcw_c^{v_c}wcvc​​ is the output label of wire ccc of true output value vcv_cvc​, while wa,jvaw_{a,j}^{v_a}wa,jva​​ is the sublabel for party jjj of input wire aaa with the true value vav_ava​. This encrypted row is a naive implementation not including the use of flip bits to further secure the encryption.

Creating the Garbled Table Naively

Let’s take another look at the formula to naively creating the encrypted rows of our gate tables from the previous section:

eva,vb=wcvc⨁j=1..n(F(i,wa,jva)⊕F(i,wb,jvb))e_{v_a, v_b} = w^{v_c}_{c} \bigoplus\limits_{j=1..n} \left( F(i, w^{v_a}_{a,j}) \oplus F(i, w^{v_b}_{b,j}) \right) eva​,vb​​=wcvc​​j=1..n⨁​(F(i,wa,jva​​)⊕F(i,wb,jvb​​))

With the 4 possible permutations of vav_ava​ and vbv_bvb​ , we get the 4 rows as follows for an AND gate:

e0,0=wc0⊕[F(i,wa,10)⊕F(i,wb,10)]⊕⋯⊕[F(i,wa,n0)⊕F(i,wb,n0)]e0,1=wc0⊕[F(i,wa,10)⊕F(i,wb,11)]⊕⋯⊕[F(i,wa,n0)⊕F(i,wb,n1)]e1,0=wc0⊕[F(i,wa,11)⊕F(i,wb,10)]⊕⋯⊕[F(i,wa,n1)⊕F(i,wb,n0)]e1,1=wc1⊕[F(i,wa,11)⊕F(i,wb,11)]⊕⋯⊕[F(i,wa,n1)⊕F(i,wb,n1)]\begin{aligned} e_{0,0} &= w_c^{0} \oplus \left[ F(i, w_{a,1}^{0}) \oplus F(i, w_{b,1}^{0}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{0}) \oplus F(i, w_{b,n}^{0}) \right] \\ e_{0,1} &= w_c^{0} \oplus \left[ F(i, w_{a,1}^{0}) \oplus F(i, w_{b,1}^{1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{0}) \oplus F(i, w_{b,n}^{1}) \right] \\ e_{1,0} &= w_c^{0} \oplus \left[ F(i, w_{a,1}^{1}) \oplus F(i, w_{b,1}^{0}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{1}) \oplus F(i, w_{b,n}^{0}) \right] \\ e_{1,1} &= w_c^{1} \oplus \left[ F(i, w_{a,1}^{1}) \oplus F(i, w_{b,1}^{1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{1}) \oplus F(i, w_{b,n}^{1}) \right] \end{aligned} e0,0​e0,1​e1,0​e1,1​​=wc0​⊕[F(i,wa,10​)⊕F(i,wb,10​)]⊕⋯⊕[F(i,wa,n0​)⊕F(i,wb,n0​)]=wc0​⊕[F(i,wa,10​)⊕F(i,wb,11​)]⊕⋯⊕[F(i,wa,n0​)⊕F(i,wb,n1​)]=wc0​⊕[F(i,wa,11​)⊕F(i,wb,10​)]⊕⋯⊕[F(i,wa,n1​)⊕F(i,wb,n0​)]=wc1​⊕[F(i,wa,11​)⊕F(i,wb,11​)]⊕⋯⊕[F(i,wa,n1​)⊕F(i,wb,n1​)]​

Note that the output labels are defined as such as well:

wc0=wc,10∥⋯∥wc,n0∥pc0wc1=wc,11∥⋯∥wc,n1∥pc1\begin{aligned} w_c^{0} &= w_{c,1}^{0} \parallel \dots \parallel w_{c,n}^{0} \parallel p_c^{0} \\ w_c^{1} &= w_{c,1}^{1} \parallel \dots \parallel w_{c,n}^{1} \parallel p_c^{1} \end{aligned} wc0​wc1​​=wc,10​∥⋯∥wc,n0​∥pc0​=wc,11​∥⋯∥wc,n1​∥pc1​​

Similar to Yao’s, we now “garble” the table. For example, if pa0=1p_a^0 = 1pa0​=1, pb1=0p_b^1 = 0pb1​=0 meaning pa1=0p_a^1 = 0pa1​=0, pb0=1p_b^0 = 1pb0​=1, our table is shuffled as so:

Now, this is the naive way to create a garbled encrypted table; however, a major flaw that exposes the input values to the evaluator can occur. To prevent this information from being leaked, we use “flip bits.”

TODO(ashjeong): Add explanation of a possible attack for this naive case.

Creating the Garbled Table Securely with Flip Bits

Flip bits obscure the true input values for the evaluator. Similar to pointer bits, each party creates their own flip bit share for each wire such that for a given wire, the total flip bit is or all flip bit shares XOR-ed together. Since wire labels and PRF functions result in random strings that are consistent across a binary value, switching the correlations of said labels to their opposite value is fine. Therefore, we instead encrypt rows of the encrypted table while obscuring input values with flip bits as shown below:

eva,vb=wcvc⊕fc⨁j=1..n(F(i,wa,jva⊕fa)⊕F(i,wb,jvb⊕fb))e_{v_a, v_b} = w_c^{v_c \oplus f_c} \bigoplus\limits_{j=1..n} \left( F(i, w_{a,j}^{v_a \oplus f_a}) \oplus F(i, w_{b,j}^{v_b \oplus f_b}) \right) \\ eva​,vb​​=wcvc​⊕fc​​j=1..n⨁​(F(i,wa,jva​⊕fa​​)⊕F(i,wb,jvb​⊕fb​​))

Ex. fa=0f_a = 0fa​=0, fb=1f_b = 1fb​=1, fc=1f_c = 1fc​=1 for an AND gate:

e0,0=wc0⊕1⊕[F(i,wa,10⊕0)⊕F(i,wb,10⊕1)]⊕⋯⊕[F(i,wa,n0⊕0)⊕F(i,wb,n0⊕1)]e0,1=wc0⊕1⊕[F(i,wa,10⊕0)⊕F(i,wb,11⊕1)]⊕⋯⊕[F(i,wa,n0⊕0)⊕F(i,wb,n1⊕1)]e1,0=wc0⊕1⊕[F(i,wa,11⊕0)⊕F(i,wb,10⊕1)]⊕⋯⊕[F(i,wa,n1⊕0)⊕F(i,wb,n0⊕1)]e1,1=wc1⊕1⊕[F(i,wa,11⊕0)⊕F(i,wb,11⊕1)]⊕⋯⊕[F(i,wa,n1⊕0)⊕F(i,wb,n1⊕1)]\begin{aligned} e_{0,0} &= w_c^{0 \oplus 1} \oplus \left[ F(i, w_{a,1}^{0 \oplus 0}) \oplus F(i, w_{b,1}^{0 \oplus 1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{0 \oplus 0}) \oplus F(i, w_{b,n}^{0 \oplus 1}) \right] \\ e_{0,1} &= w_c^{0 \oplus 1} \oplus \left[ F(i, w_{a,1}^{0 \oplus 0}) \oplus F(i, w_{b,1}^{1 \oplus 1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{0 \oplus 0}) \oplus F(i, w_{b,n}^{1 \oplus 1}) \right] \\ e_{1,0} &= w_c^{0 \oplus 1} \oplus \left[ F(i, w_{a,1}^{1 \oplus 0}) \oplus F(i, w_{b,1}^{0 \oplus 1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{1 \oplus 0}) \oplus F(i, w_{b,n}^{0 \oplus 1}) \right] \\ e_{1,1} &= w_c^{1 \oplus 1} \oplus \left[ F(i, w_{a,1}^{1 \oplus 0}) \oplus F(i, w_{b,1}^{1 \oplus 1}) \right] \oplus \dots \oplus \left[ F(i, w_{a,n}^{1 \oplus 0}) \oplus F(i, w_{b,n}^{1 \oplus 1}) \right] \end{aligned}e0,0​e0,1​e1,0​e1,1​​=wc0⊕1​⊕[F(i,wa,10⊕0​)⊕F(i,wb,10⊕1​)]⊕⋯⊕[F(i,wa,n0⊕0​)⊕F(i,wb,n0⊕1​)]=wc0⊕1​⊕[F(i,wa,10⊕0​)⊕F(i,wb,11⊕1​)]⊕⋯⊕[F(i,wa,n0⊕0​)⊕F(i,wb,n1⊕1​)]=wc0⊕1​⊕[F(i,wa,11⊕0​)⊕F(i,wb,10⊕1​)]⊕⋯⊕[F(i,wa,n1⊕0​)⊕F(i,wb,n0⊕1​)]=wc1⊕1​⊕[F(i,wa,11⊕0​)⊕F(i,wb,11⊕1​)]⊕⋯⊕[F(i,wa,n1⊕0​)⊕F(i,wb,n1⊕1​)]​

If the flip bit of a wire is 0 such as for wire a shown above, the wire sublabels refer to their corresponding input value (e.g. wa,11w_{a,1}^1wa,11​ refers to input value 1). Else, if the flip bit is 1 as in wire bbb above, the wire sublabel refers to the opposite input value (e.g. wb,10w_{b,1}^0wb,10​ refers to input value 1).

Flip bits introduce more constrained chaos to prevent values from being exposed. Only 4 possible label permutations of each wire aaa, bbb, and ccc for its 4 possibilities of input values exist when not using flip bits, yet with its inclusion, the total number of label permutations jumps to 32. Take a look below showing off all possible label permutations for a single input case of a AND gate where the inputs are 1.

BMR Protocol Summary

All Parties:

  1. Create their own keys for all possible wires values

  2. Create their own pointer bit shares for each wire value (1 for each wire since the other can be simply calculated)

  3. Create their own flip bit shares for each wire

For n-MPC:

  1. Receive parties’s private input bits

  2. Receive MPC inputs of each party Ii,jI_{i,j}Ii,j​

  3. For each gate

    1. Compute total flip bits fff for each wire

    2. Compute total pointer bits ppp for each wire value

    3. Create the garbled table

One party who is set to be the evaluator:

  1. Receive the garbled tables and active wire labels

  2. Evaluate garbled circuit re-creating the garbled inputs themselves

References

Shuffling of encrypted table

Written by from A41

https://securecomputation.org/docs/ch3-fundamentalprotocols.pdf
https://eprint.iacr.org/2016/1066.pdf
https://www.cs.ucdavis.edu/~rogaway/papers/bmr90
original paper
here
Yao's Garbled Circuits
Ashley Jeong
AND gate possibilities for (1,1) -> 1