Wednesday, September 30, 2015

Improved OT Extension for Transferring Short Secrets


In this post, we see an efficient Oblivious Transfer (OT) Extension technique for short secrets.  The OT extension protocol of IKNP stands as the basis for this protocol. The building block is an IKNP-based framework for 1-out-of-n OT extension. Before going into the details of the protocol, let’s have a quick overview of the IKNP protocol.

IKNP Protocol
We assume the existence of a correlation-robust hash function, H, and the protocol works in the static semi-honest security model.

Protocol Overview
S first acts as the receiver and R as the sender in the underlying k OTs. S chooses a random string s {0,1}k as the selection bits and R inputs (ti, ti r), i [k], ti {0,1}n where r are the actual selection bits of R. S calls her ith chosen message in the underlying OTs qi = ti si .r, where qi is the ith column of a m x k matrix QNote that jth row of matrix Q, qj = tj  rj . s. Finally, S sends the actual messages by sending zj,0 = H(qj) xj,0 and zj,1 = H(qj s) xj,1 and R recovers xj,ri by computing xj,ri = H(ti) zj,ri , where j [m] and H() is the hash function.

Protocol Efficiency
The protocol makes a single call to OTkm. In addition, each party evaluates at most 2m times (an implementation of) a random oracle mapping k+log m bits to l bits. All other costs are negligible. The cost of OTkm is no more than k times the cost of OT1k (the type of OT realized by most direct implementations) plus a generation of 2m pseudo-random bits. In terms of round complexity, the protocol requires a single message from S to R in addition to the round complexity of the OTkm implementation. To summarize, the communication complexity of IKNP is O(m(k+l)) and for bit messages (l=1), the complexity turns out to be O(mk).

Now we can look to the efficient Oblivious Transfer (OT) Extension protocol of KK13. The main difference from IKNP is that each row of the matrix possessed by S is now used to perform a 1-out-of-n OT instead of 1-out-of-2, but of shorter secrets. On a very intuitive level, the protocol works as follows: Let C denote a binary code, and let rj denote the input of R to the j-th instance of 1-out-of-n OT. For each row j, S receives (via OT) the actual j-th row of the m x k matrix XORed with a vector that is the result of the rj-th codeword in C bitwise ANDed with the k-bit selection vector. This allows S to generate n random pads from each row of the matrix- the i-th such pad being the j-th row it received (via OT) XORed with a vector that is the result of the i-th codeword in C bitwise ANDed with the k bit selection vector. These n random pads may then be used by S to carry out a 1-out-of-n OT with R

KK Protocol
We assume the existence of a hash function (in the random oracle model), H, and the protocol works in the static semi-honest security model. It trades the length of messages for more gained OTs from the extensions.

Protocol Overview
Input of S is m tuples (xj,0, … ,xj,n-1) of l-bit strings while input of R is an m element selection vector r = (r1, … , rm) where each ri can ranges from 1 to n. S first acts as the receiver and R as the sender in the underlying k OTs. S chooses a random string s  {0,1}k as the selection bits. R forms m x k matrices T0 and T1 in the following way: Choose tj,0 , tj,1 ← {0,1}k  at random such that tj,0   tj,1 = crj , where crj  is a Walsh-Hadamard code. R then inputs {(tj,0, tj,1)}j∈[k]  for each of the k base OTs. S calls her ith chosen message in the underlying OTs qi ti,si , where qi is the ith column of a m x k matrix Q. Note that jth row of matrix Q, qj = tj,0 crj . s. Finally, S sends  messages zj,r = xj,r H(j, qj cr.s) for 1 r and R recovers xj,ri by computing xj,ri = H(j,tj,0)  zj,ri , where j  [m] and H() is the hash function.

Protocol Efficiency
The protocol makes a single call to OTkm. The cost of OTkm is the cost of OTkk (which is independent of m) plus a generation of 2k pseudo-random strings each of length m. Other than this, each party evaluates at most mn times a random oracle. Thus the total communication cost of  OTml is the communication cost of implementing OTkm plus mnl bits transferred between S and R, which turns out to be O(m(k+nl). In the semi-honest model, a single instance of 1-out-of-n OT may be used to generate log n instances of 1-out-of-2 OT over slightly shorter strings with no additional cost. More precisely, the cost of OTml is exactly equal to the cost of 1-out-of-n OTm/log nl.log n . To summarize, the communication complexity of KK for 1-out-of-2 OT extension is O(mk / log(k/l) ) and for bit messages (l=1), the complexity turns out to be O(mk / log k).

Monday, September 28, 2015

BMR: Extended version of Yao's protocol for n players

Here we discuss how to extend Yao's protocol for any arbitrary 'n' players. In Yao's protocol, the responsibilities of the two players (Circuit constructor and Circuit Evaluator) are not at all alike. Hence, it is not trivial to see how to extend the protocol for any 'n' number of parties.

We start by assuming that the logical circuit C corresponding to the multi-party computation function f is already given, and we expect Semi-honest behaviour (at worst) from the parties, and the threshold for corrupted parties is (n-1).

In this extended protocol (BMR protocol), both construction and evaluation of the circuit is done collaboratively. Now we see how the protocol works.
BMR Protocol is having an Offline Phase and an Online Phase.

Offline Phase:

In the offline phase, we need to know nothing other than the circuit. Let there be 'W' wires in the circuit, indexed from 0 to W-1. At first, all players will (collaboratively) choose one random bit for each wire, namely λ­0, λ­1…, λ­­w-1. Each λ­i values are secret shared among all n parties. Then λj is reconstructed to party Pi, if ‘j’ is one of the input wires of Pi.

Now, each player will choose two random string (we call them 'two seeds') of length 'k', for each wire. Without loss of generality, we name those seeds s­­­­­­­­­iw,0 and s­­­­­­­­­iw,1 for each player i, for each wire w. Now we define SuperSeed for a wire w.

            Sw,0 = s1w,0 || s2w,0 || .. siw,0 .. || snw,0
            Sw,1 = s1w,1 || s2w,1 || .. siw,1 .. || snw,1

These two SuperSeeds will act as two different keys, and bears the meaning of the bits; just like two keys for each wire in Yao's protocol. But here, the SuperSeed S­w,j need not represent the bit 'j' ; instead Sw,0 represent the bit λ­w, and Sw,0 represent the bit λ­wc.

Please note that individual players know only their seeds on each wire, and λ values of all wires.
For the implementation of 4 (generally, but for NOT gate it’s 2) encryption boxes of a logic gate, We need two PRGs G1 and G2 both maps {0,1}k → {0,1}nk. Let a and b be the input wires of the gate g, and c be output wire of g. The cyphertexts corresponding to each Encryption Box is of the form:

Box 1: C1 := ( G1­(s1a,0) G1­(s2a,0) .. G1­(sna,0) ) ( G1­(s1b,0) G1­(s2b,0) .. G1­(snb,0) ) ⊕ Sc,r  ,
(Where r = 0 if g(λa, λb) = λc ; r = 1 otherwise)

Box 2: C2 := ( G2­(s1a,0) G2­(s2a,0) .. G2­(sna,0) ) ( G1­(s1b,1) G1­(s2b,1) .. G1­(snb,1) ) ⊕ Sc,r  ,
(Where r = 0 if g(λa, λbc) = λc ; r = 1 otherwise)

Box 3: C3 := ( G1­(s1a,1) G1­(s2a,1) .. G1­(sna,1) ) ( G2­(s1b,0) G2­(s2b,0) .. G2­(snb,0) ) ⊕ Sc,r  ,
(Where r = 0 if g(λac, λb) = λc ; r = 1 otherwise)

Box 4: C4 := ( G2­(s1a,1) G2­(s2a,1) .. G2­(sna,1) ) ( G2­(s1b,1) G2­(s2b,1) .. G2­(snb,1) ) ⊕ Sc,r  ,
(Where r =0 if g(λac, λbc) = λc ; r = 1 otherwise)

We can see that, if each party just shares the PRG outputs of both seeds for the computation of these 4 cypherboxes and adversary have corrupted t parties, then the adversary can gain extra information about the messages in the boxes, that are not supposed to open in an execution (For eg: if t = n-1, and without loss of generality P1 is the only honest player, then G1(s1a,0)), G2(s1a,0)), G1(s1a,1)), G2(s1a,1)) are leaked to the adversary, and he can compute all the Sc,r in all Boxes). So C1, C2, C3 and C4 should be a computed only by a Multi-Party Computation function. If that’s the case, adversary, who doesn’t know the seed(s) of honest party, will see the cypherboxes as One-Time padded messages with PRG outputs.

Now the λi for all output wires i are reconstructed and shared with every party. In the end of Offline phase, every party Pi knows,
  •          2 Seeds of each wires
  •          4 Cypherboxes for each gate g
  •          Secret share of λj , for all wires j
  •          λk , for all output wire k
  •          λm , for all input wire (m) of the party Pi

Online Phase

Each party will evaluate the circuit in this phase. All parties know their input to their input wires. We define a new bit Δj of a wire j as follows:

                        Δj = bj λj

where bj is the actual bit in a wire, in a specific evaluation. The Δj value of the input wire j of Pi can be calculated by the party Pi only; because only Pi knows λj. But everybody needs Δ to evaluate the circuit. So the owner of the input wire(s) will broadcast the Δ values of his input wires. In fact, after this step, all parties will get to know the Δ values of all the input wires in the circuit. For decrypting one logic gate, we need exactly one SuperSeed for each input wire. So every party will share their seeds siw,Δw so that every party will get exactly one SuperSeed corresponding to Δj for each input wire j. With this information, players can decrypt exactly one CypherBox as follows:

Δa
Δb
Decryptable Box
0
0
C1
0
1
C2
1
0
C3
1
1
4

Using the SuperSeeds Sa,Δa and Sb,Δb , all parties can decrypt the CypherBox and get the SuperSeed of the output wire, and so on. But it’s not clear how to get Δ value of the new (output) wire. But every player knows their seeds on all the wires, and SuperSeed is nothing but appending all the seeds of players. So he will just check the seed bits corresponding to that player ((i-1)*k + 1 to i*k for player Pi) in the SuperSeed. If that happened to be equal to sic,0 then the Δc is 0. Otherwise, it will be 1.

In short, after computing and sharing Δw values and SuperSeeds Sw,Δw of all input wires w, no other communication between the parties are required. The entire circuit evaluation is done as local computation. Note that, Δ values are found and propagated in the circuit. As far as λ values are chosen random, by disclosing Δ values, no information about the actual bit b will be leaked.

Correctness

Consider the case when Δa = Δb = 0. We have to prove that Δc and Sc,Δc are correctly computed.
Δa = 0 ba = λa
Δb = 0 bb = λb
As per the table of decryptable cypherboxes, we will decrypt C1.
  • If g(λa, λb) = λc , that means g(ba, bb) = λc and we will be encrypting Sc,0 as message, in C1 (see definition). We can see that Δc = 0, which is consistent with the definition of Δ. In this case,

1.      g(ba, bb) = λc
2.      g(ba, bb) = bc
1 & 2 ⇒ λc = bc
           ⇒ Δc = bc λc = 0
  •  If g(λa, λb) = λcc , that means g(ba, bb) = λcc. We will de deciphering C1, which is an encryption of SuperSeed Sc,1. We see Δc = 1 here, and consistent with definition of Δ. Here,

1.      g(ba, bb) = λcc
2.      g(ba, bb) = bc
1 & 2 λc = bcc
          Δc = λc bc  =  bcc bc = 1

When both Δa and Δb are 0, SuperSeed and Δc calculated are shown to be correct. All the other cypherboxes, we can prove with similar argument.


At the end of circuit evaluation, all parties will get to know the Δ values of output wires. We know the λ values of output wires (shared in offline phase). Hence we can compute bc using the equation bc =  λc Δc  for each output wire c.

Thursday, September 24, 2015

A Framework for Efficient and Composable Oblivious Transfer

We will explore a generic secure Oblivious Transfer protocol with the help of any dual-encryption cryptosystem. An Oblivious Transfer (OT) protocol is a cryptographic protocol between a sender A and a receiver B, which enables B to receive one out of two (or more) messages from A with respect to B's choice bit(s). The OT almost resembles an Encoder, omitting the security part. The transfer is said to be oblivious, because A is unaware of which message B received, and B does not receive any information about the remaining messages of A.

With this requirement in mind, we now see a new cryptographic primitive known as dual-mode encryption cryptosystem.  As the name suggests, this cryptosystem can be operated in 2 modes, which differ only in the Setup phase, which is run before the execution of protocol. The difference between the modes of operation is achieved through the generation of a parameter crs by the corresponding Setup algorithm, which is then passed to the remaining operations. The two modes are Messy Mode and Decryption Mode, and they each have their corresponding SetupMessy() and SetupDecryption() algorithms.

In addition to this, the cryptosystem can be operated in two branches. Denoting them as 0 and 1, it has the property that a message encrypted in one branch can only be decrypted in the same branch. This is fulfilled by giving the Key Generation algorithm an additional parameter b=0 or 1 to denote the branch.  It then outputs a public key-secret key pair for use in that particular branch.  

Additionally, Encryption also takes the branch as a parameter.  Decryption can only succeed if the given ciphertext and secret key are generated using Encryption and Key Generation (respectively) with respect to the same branch.

For a chosen mode, we can operate the cryptosystem in either of the two branches.

Given the properties we can intuitively see that a one-out-of-two OT protocol can be constructed as follows, for any mode of operation.
        Both A and B receive the same crs corresponding to either Messy Mode/Decryption Mode.
        A has messages m0 and m1
        B picks a bit b, for which message he wishes to receive, and runs the key generation for branch b. He receives a secret key (sk) and public key (pk) for this branch.
        B sends pk to A, who encrypts both his messages using this public key  as follows
        He encrypts m0 with the public key, and branch 0 to get c0
        He encrypts m1 with the public key, and branch 1 to get c1
        He then sends both c0 and c1 to B
        It is now easy to see that if B has b=0, he has the secret key for branch 0 and can decrypt c0. Similarly if he had b=1, he would have the secret key for branch 1 and he would be able to decrypt c1.

We can clearly see from the property of the dual-mode cryptosystem that B cannot decrypt the ciphertext c1-b as he does not have the secret key corresponding to the branch (1-b).  Additionally, since the sender receives only the public key, he cannot know which branch the receiver is operating in. This protocol satisfies the properties of OT. We also saw the security proof for each of the modes as follows.
                     Mode Security for
Messy
Decryption
Sender
Statistical Security
Computational Security
Receiver
Computational Security
Statistical Security

Security specified in each cell of this table can be proven using a Real World-Ideal World paradigm where we use the remaining functions defined (TrapKeyGen(), FindMessy() in cases of Decryption mode and Messy mode, respectively) along with the properties of the dual-mode cryptosystem, to aid the Simulator. The Simulator, who is the adversary in the ideal world, can then simulate the protocol with the real world adversary such that it is indistinguishable to the adversary from a complete real world execution.

Knowing that the only difference between the two modes lies in the generation of crs in the Setup phase, we can conveniently switch the mode of operation of the cryptosystem to change the levels of security for the sender and the receiver, depending on our protocol requirements.

There also exist several practical instantiations of the protocol, with security based on the DDH assumption and the Quadratic Residuosity assumption, among others.

We have seen that the dual-encryption primitive intuitively leads to a secure and practical OT protocol.

Wednesday, September 16, 2015

Multi Party Computation From Threshold Homomorphic Function in Semi-honest setting

Notation: m' is the ciphertext on encrypting m

Threshold homomorphic encryption is a homomorphic encryption scheme where t (threshold) parties alone cannot decrypt the secret. Decrypt algorithm takes common input m' and public key pk and secret input ski from party pi (secret key is distributed among all parties) decrypts m' and discloses m to all parties.

PrivateDecrypt
PrivateDecrypt is a decryption sub-protocol that decrypts an encryption m' in such a way that only one particular participant learns the message. It is implemented in the following way:
 Let the intended party to receive decrypted message be pi.
 1. pi chooses a random value d and broadcasts d'.
 2. All the parties then compute e' = m' + d' and call Decrypt.
 3. Decrypt discloses the message e to all parties.
But only pi can know original message m from the operation m = e - d.
  
Additive secret sharing
All participating parties know a' = ENC(a). They want to secret share a'.
 1. Each party pi chooses a random value di and broadcasts di'.
 2. All parties compute d' such that d' = ∑di'.
 3. All parties compute e'=a' + d' and call Decrypt.
 4. Fix an ordering among parties. The first party in the order computes its share as ai' = e' - di', ai = e - di. Rest of the parties compute -dj', -d j as their share.
 Thus if all parties add their respective shares which is e'- d' = a'.

Multiplication protocol
The goal of this protocol is given two encryptions a', b' we have to share (ab)' among n parties.
 1. All parties additively secret share a'.
 2. Then every party multiplies ai with b'.
 3. By the second homomorphic property of constant multiplication all parties together can compute (ab)' .