Abstract
Despite the fact that the majority of applications encountered in practice today are captured more efficiently by RAM programs, the area of secure two-party computation (2PC) has seen tremendous improvement mostly for Boolean circuits. One of the most studied objects in this domain is garbled circuits. Analogously, garbled RAM (GRAM) provide similar security guarantees for RAM programs with applications to constant round 2PC. In this work we consider the notion of gradual GRAM which requires no memory garbling algorithm. Our approach provides several qualitative advantages over prior works due to the conceptual similarity to the analogue garbling mechanism for Boolean circuits. We next revisit the GRAM construction from (In STOC (2015) 449–458) and improve it in two orthogonal aspects: match it directly with tree-based ORAMs and explore its consistency with gradual ORAM.
Introduction
Background. Secure multi-party computation (MPC) protocols allow a group of parties to compute some function f on the parties’ private inputs, while preserving a number of security properties such as privacy and correctness. This area has witnessed a tremendous progress in the past two decades both in the two-party setting [4,20,21,25,29,30,37,41,42,46,47,53], and with a larger number of parties [7,9,23,31,48]. Nevertheless, most of this research has been conducted for Boolean circuits and falls short when the computation involves accesses to a large memory, which are translated into a linear scan of the memory inside the circuit. This translation is required for every memory access and causes a huge blowup in the description of the circuit. Moreover, the majority of applications encountered in practice today are more efficiently captured using random-access memory (RAM) programs that allow constant-time memory lookup and contain branches, recursions and loops. This covers graph algorithms such as the known Dijkstra’s shortest path algorithm, binary search on sorted data, finding the kth-ranked element, the Gale-Shapely stable matching algorithm and many more. Generic transformations from RAM programs that run in time T imply circuits of size
To address these limitations secure protocols have been designed directly in the RAM model, either with round complexity that grows with the running-time of the RAM program [8,10,19,27,28] or with constant round complexity [1,10–15,24,32–34,49]. A fundamental tool in designing protocols in the RAM model is Oblivious RAM (ORAM) [16,17,38], which supports dynamic memory access with polylogarithmic cost while preventing any leakage from the memory. Namely, ORAM is a technique for hiding all the information about the memory of a RAM program, including both the content of the memory and the access pattern to it. The efficiency of ORAM constructions is evaluated by their bandwidth and storage blowups where the former refers to the number of data blocks that are sent between the parties per memory access and the later refers to the multiplicative overhead of the oblivious memory size. Recent constructions incur practical polylogarithmic overheads in the size of memory [5,44,45].
Constant round 2PC for RAM programs
Similarly to two-party protocols for Boolean circuits, achieving constant round for RAM programs is carried out by adapting the garbled circuits technique [52] to support RAM computations [12,13,15,33]. Nevertheless, as opposed to classic garbled circuits where the computation is large and the inputs are relatively small, in RAM programs the accessed memory can be huge whereas the running time of the program is typically much smaller (e.g., polylogarithmic in the memory size). Informally, garbled RAM (GRAM) is a non-interactive object that garbles the memory D into
In order to hide the access pattern to the memory, all these schemes are built on top of ORAMs. Recall that the original motivation of ORAM was to protect memory accesses to the physical RAM (or to a server with a large storage capacity), by some remote CPU (or by a client with a small storage). Nevertheless, in the distributed setting, the memory is initially empty and is occupied on the fly (see [1]). Therefore, it makes no sense to initially run the garbled memory algorithm. Another drawback is regarding the amplification from semi-honest to malicious security, which either involves using zero-knowledge proofs for highly complicated statements or running a distributed protocol for the memory initialization. For instance, proving correctness within [13] requires proving the correctness of
While some of the computation of these garbled memory algorithms can be carried out offline, it requires storing a large state that grows with the memory size.
Finally, the security analysis of these constructions have been proven relative to the weaker Unprotected Memory Access (UMA) notion, where the attacker may learn the initial contents of the memory D as well as the complete memory-access pattern throughout the computation. A transformation from any GRAM scheme with UMA security into one with full security has shown in [15].3
Informally, the transformation encrypts the memory elements and apply an ORAM construction to hide the access pattern.
Note that this construction suffers from a circularity issue in its security analysis; see [15] for a detailed discussion.
These drawbacks demonstrate that there is much room for improving the current state of affairs of GRAM schemes both theoretically and practically.
Gradual ORAM for tree-based ORAMs. Motivated by the discussion above and the fact that all GRAM constructions are based on binary trees, we start by examining tree-based ORAM constructions and explore the flexible notion of gradual ORAM. This notion is an extension of the classic notion of ORAM that does not require an initialization phase to compile the data. Instead, a new algorithm is considered, that handles the memory insertions separately and can be skipped directly to the RAM program set of instructions. An immediate advantage that is derived by the flexibility of gradual ORAM is resizability [35]. Namely, the inherent dependence on a fixed-size tree is removed, allowing flexible storage. We stress that this concept is not new, but for the sake of completeness we provide a formal definition (Section 2.9).
Gradual GRAM. Next we extend the notion of GRAM and consider an analogue gradual GRAM notion with no memory garbling algorithm. Namely, this object is defined by only two algorithms for garbling the program and the input, where all the memory operations are incorporated within the program. This modification implies that the garbling mechanism is now only involved with a sequence of small CPU-steps that are garbled using the classic garbled circuits approach. Therefore, it is conceptually closer to the analogue garbling mechanism for Boolean circuits. This new concept also introduces several advantages:
The scheme enjoys all the advancements of garbled circuits such as half gates, Free-XOR, Pipelining, and OT extension, that lead to highly optimizes semi-honest protocols. We note that garbling a large set of circuits can benefit from recent techniques for batch garbling [36] (due to garbling a large sequence of small CPU-steps). The bulk of work (e.g., generating the garbled circuits) can be shifted to an offline phase, performed independently of the data and the parties’ inputs. Amplifying security to the malicious setting is immediate by applying standard techniques such as cut-and-choose [30] or authenticated garbling [26,47], or any futuristic alternative approaches. The parties can directly proceed with the program execution whenever the initial memory is empty and build the tree on the fly. The space complexity of the garbler algorithm can be made minimal by processing each garbled circuit at the time rather than storing the entire tree of memory.
In addition, gradual GRAM can serve as a step towards supporting a broader class of data processing algorithms such as data streams or online algorithms, where the data is processed serially (compatible with memory on the fly access). We also stress that our notion maintains persistent data, where the memory updates are persistent for future executions, as similarly considered in prior work.
We next revisit the GRAM construction from [13] and improve it in two dimensions:
We first prove that it can be combined directly with tree-based ORAMs, where the best matches are with the Simple ORAM [5] and the Circuit ORAM [45] due to their root-to-leaf eviction algorithms. We observe that for some ORAM constructions it is beneficial to build a combined tree that contains both the ORAM buckets, as well as the GRAM information, and is proven directly secure rather than via UMA. This allows to reduce the number of visited nodes in the GRAM and simplifies the CPU-steps circuits; see more discussion below and a comparison in Table 1. We remark that combining a tree-based ORAM with other data structures also appeared in [50].
In addition, we observe that [13] can be made consistent with our notion of gradual GRAM, where the combined tree is built on the fly based on gradual ORAM. This requires adjusting the GRAM algorithms to support an incomplete tree while maintaining authentication. Furthermore, it allows to avoid the expensive initialization phase and saves on space resources, as the size of the tree is minimized rather then growing with the maximum size of the data. To handle the case where an internal node may not have any children, we store two additional bits that notify whether the current node has a left (resp. right) child.
Efficiency gains. To understand the quantitative differences between our gradual GRAM constructions and [13], we compare in Table 1 the number of nodes visited in the garbled memory in both cases, and the sizes of the garbled circuits involved a single ORAM access. Note first that all tree-based ORAMs require reading
This is because the translation mapping in [13] involves a PRF evaluation per stored bit.
In contrast, our construction combines the ORAM tree with the GRAM tree which eliminates a factor of
Communication and computation costs for the different GRAMs schemes. We use n to denote the number of memory entries, B the bucket size, κ the security parameter and U the size of a value
Extending to the multi-party setting. Due to the conceptual similarity to the garbled circuits approach for Boolean circuits, our approach is also easily extendable to the multi-party setting as well by applying different distributed garbling approaches [2,23,48]. These protocols scale much better than when running a distributed protocol for computing the garbled memory algorithm as done in all prior work, due to all recent optimizations.
Conference version. This full version is based on [22] which was published in SCN 2020. This version includes a complete description and proof of our gradual GRAM construction as well as more elaborated discussion on the modeling of gradual GRAM and the extension based on prior work.
Basic notations. We denote the security parameter by κ. We say that a function
We specify next the definition of computationally indistinguishability. Let
Let
The notion of garbled circuits was first introduced by [52]. A garbling scheme for a Boolean circuit is a tuple of
(Garbled circuits.).
A circuit garbling scheme consists of the following two polynomial-time procedures:
The circuit garbling procedure:
The evaluation procedure:
Correctness. For correctness, we require that for any circuit C and any input x, we have that:
Privacy. For privacy, we require that there exists a
Authenticity. In the authenticity game, the adversary obtains a set of garbled circuits and garbled inputs for which it can only output a valid garbling of an invalid output with a negligible probability. This notion was first introduced by Bellare et al. in [3] and is not captured by the above privacy definition. Authenticity is required since it must be ensured that a corrupted evaluator does not evaluate the CPU-steps circuits on multiple inputs. We note that this concern is raised even in the presence of semi-honest adversaries.
The RAM model of computation
We start with the notation of computation in the RAM model. Given a program P, with access to memory D of size n, that obtains a “short” input x which we alternatively think of as the initial state of the program. We use the notation
CPU-step circuit. We consider a RAM program as a sequence of at most T small CPU-steps, where each of them is represented by a circuit that computes the following functionality:
Oblivious RAM (ORAM)
In a sequence of seminal works [16,17,38], Goldreich and Ostrovsky introduced the notion of Oblivious RAM (ORAM) which is a mechanism that simulates read/write access to an underlying memory D via a sequence of accesses to a compiler memory
An oblivious RAM (ORAM) scheme consists of two algorithms
A
Note that the above definition (just as the definition from [17]) only requires an oblivious compilation of deterministic programs P. This is without loss of generality as we can always view a randomized program as a deterministic one that receives random coins as part of its input.
The most common data-structure used in ORAM constructions is a binary tree where the data is associated with the tree leaves and updates operations are implemented by re-entering the new block. Namely, the server stores a binary tree of height L with
Simple ORAM [
5
]. We outline the ORAM construction of Chung et al. [5] which is based on the tree ORAM of [43] but with some crucial modifications that significantly simplify the analysis. We next present the two algorithms
More formally,
Then

The description of
Circuit ORAM [
45
]. We next outline the ORAM construction of Wang et al. [45] which is also based on the tree ORAM of [43]. The Circuit ORAM improves the complexity of the eviction procedure and achieves almost optimal circuit size for realistic choices of block sizes. We next present the two algorithms
Read all buckets on
Generate an array
Read all buckets on
Security with unprotected memory access (UMA) is a weaker security notion for GRAM schemes. In this variant, the attacker may learn the initial contents of the memory D, as well as the complete memory-access pattern throughout the computation including the locations being read/written and their contents. In particular, we let
Garbled RAM
Analogously to garbled circuits for Boolean circuits [52], garbled RAM (GRAM) provide similar guarantees in the RAM model of computation. Namely, it is a non-interactive object that ensures privacy and correctness, and implies semi-honest two-round secure two-party computation when combined with OT. The standard definition of GRAM [15] is composed out of four algorithms defined as follows.
Syntax. A garbled RAM scheme consists of four
Correctness. We require that for any program P, initial memory D and input x it holds that:
Security. We require that there exists a simulator
The details of [13] GRAM
The GRAM from [13] that is based on one-way functions and uses a novel mechanism to prevent rollback while avoiding the circularity issue that arises in [33]. Loosely speaking, given a garbled memory that is built using a tree, the evaluator traverses this tree while obliviously regenerating the nodes that it visits using fresh PRF keys that are hardwired within the CPU-circuits. Moreover, each non-leaf node contains information that allows to extract the input key labels for the next garbled circuit in the chain of the CPU-steps. Upon concluding the tree navigation and reaching a leaf, the data is being accessed via that leaf and the process repeats itself for the next RAM instruction. In more details, in this construction each internal node
Data garbling:
Program garbling:
Navigation circuit. The navigation circuits enable to traverse the tree. Each circuit
If
We note that our description is informal. Specifically, the keys are encrypted bit-by-bit implying
Step circuit. The circuit If Note that the following circuit The circuit also outputs
We next review the gradual ORAM definition in which there is no initialization phase of the compiled data where instead, the data is initialized gradually before executing the compiled program. This definition includes a new algorithm A polynomial-time algorithm C is a Gradual ORAM compiler with computational overhead
where
In this section we define the notion of gradual GRAM where the memory is not garbled separately, but rather occupied via a sequence of insert operations; details follow.
Syntax. The new garbled GRAM notion consists of four
Correctness. We require that for any program P, memory D and input x it holds that:
Security. We require that there exists a simulator
The modified [13] GRAM
We next discuss how to combine the [13] GRAM with Simple/Circuit ORAMs while building the tree gradually, starting with the modified “Program Garbling” algorithm.
Program garbling: Navigation information that includes the PRF evaluations over the key ORAM information that includes the PRF evaluations over the bucket Information about the children, that includes the PRF evaluations over
The leaf nodes, denoted by
Our garbling procedure has four subroutines: (1) reading from the root, (2) reading from the internal nodes, (3) reading from a leaf and (4) the final circuit. Each subroutine outputs a translation mapping for the children of the node it is reading from (where at the leaf level the mapping is for the root), which allows to extract the input labels for the next circuit on the navigation path (where in case a child does not exist, then the translation mapping outputs labels corresponding to 0). We denote the set of input labels corresponding to a circuit in our construction,

The translation mapping procedure.
An overview of the circuits. The program garbling procedure contains four different types of circuits:
As in the GLOS construction each internal circuit
Upon given these inputs, each circuit runs a CPU-step of the Simple ORAM which uses one of the buckets
The three other circuits are described similarly to the internal circuit with the following modifications. First, the input to the root circuit includes a single PRF key
Initialize
If
We use the variable
If
Set
Set
Set
Below,
Set
Output:
Deciding whether the next move is left or right based on the next position bit. Namely, if
Initializing
If
Set
Set also the output writing values for the opposite direction, which is not on the reading path.
The syntax
If
Output:
If
Set
Run Step 3 from the procedure for
Set
Set
Set
If
Output:
Summarizing the descriptions of the above four subroutines, the final garbling procedure consists of multiple instances of these circuits. More specifically, our complete garbling program procedure consists of two sub-procedures: the insertion program garbling denoted by
In the insertion garbled program
On the other hand, for each memory access in the garbled RAM program
Program garbling
Run
Run
Output

The description of

The description of
Data elements garbling
Input garbling
Set
Set
Set
Output
Garbled evaluation

The description of
We conclude with the following theorem.
Assuming one-way functions, then our construction is secure garbled RAM scheme (cf. Section 2.7 ).
Proof overview. In this proof we construct a simulator that outputs a sequence of simulated garbled circuits generated from the end to start. Since the simulator does not know the real input values
Proving Theorem 3.1 involves proving correctness and security. Correctness follows due to the correctness of the underlying garbled circuits that correctly realize the underlying functionalities. The more challenging part of the proof will be to prove security by proving the existence of a

The

The
As opposed to the garbling procedure in the real execution, we cannot simulate the garbling of the insertion program before simulating the garbling of the RAM program. This is due to the fact that the writing values output by the insertion program should be consistent with the translate table in the simulated RAM program. Consequently, the simulation will first simulate the garbling of the RAM program and then the insertion program.
The simulator
Run
We assume that
Initialize files
For each location
For
Garbling of
Garbling of
Garbling of
Garbling of
Garbling of
For
Garbling of
Garbling of
Garbling of
Garbling of
Set
Output
This concludes the simulation. Let
In order to prove indistinguishability, we first define a hybrid experiment denoted by
We next prove the following claim,
Assume the existence of inputs
In the next part of the proof we prove the next claim,
From here on, the proof is very similar to the proof from [13] and we therefore give the a high level of the proof. We define a sequence of hybrid experiments where we gradually replace a garbled circuit with a simulated one. Let Translate table for both directions using a PRF key from level Write to the two children in level In the circuit In the output
In
Note that the only difference between the hybrid
In the
In the last
Efficiency. In our construction, the size of the garbled program, as well as the time it takes to create and evaluate it is
In this section we describe our two-party semi-honest protocol for RAM programs, which follows immediately from our GRAM and any semi-honest oblivious transfer. The main difference of our protocol compared to prior protocols is the lack of a memory initialization phase.
Semi honest 2PC
S runs
S parses S computes
S sends For every R sets
In a distributed RAM model there are several options to model the memory as an input. Namely, the memory can either be initialized as empty. In this case, the parties do not need to garble the insertion program and can simply start with the execution of the garbled RAM program, while the garbled memory will be created on-the-fly during evaluation. Alternatively, the memory can be shared amongst the two parties. In this case, each party inserts to every root circuit in the insertion program the input labels that correspond to its shared elements for D (while R obtains these labels by running OT instances with S).
Assuming a semi-honest OT, then Protocol 1 securely computes any RAM program P in the presence of semi-honest adversaries.
The proof is straightforward based on the security of our GRAM and the OT.
Footnotes
Acknowledgment
Supported by the BIU Center for Research in Applied Cryptography and Cyber Security in conjunction with the Israel National Cyber Bureau in the Prime Minister’s Office, and by ISF grant No. 1316/18.
