1.04k likes | 1.17k Views
Oblivious Search Trees. The Art of Remembering The-Right-Thing ™. Move To Front. a linked list of keys Search( x ) Scans the list for x Move x to the front Example: Search(“the onion”). slashdot. dilbert. the onion. …. citeseer. the onion. slashdot. dilbert. …. citeseer.
E N D
Oblivious Search Trees The Art of RememberingThe-Right-Thing™
Move To Front • a linked list of keys • Search(x) • Scans the list for x • Move x to the front • Example: Search(“the onion”) slashdot dilbert the onion … citeseer the onion slashdot dilbert … citeseer
The-Right-Thing? If this is how my browser stores my web-site cookies… slashdot dilbert the onion … citeseer /. Is not Research… Plus, that’s not crypto!!!
Concept HistoryDependence
Dictionary • Represents a set of keys • Supports a very typical interface • Create() • Insert(x) • Search(x) • Delete(x)
Move To Front, Again • Link list maintained by the MTF rule is an implementation of Dictionary • But would the interface allow you to infer that I visit /. VERY often? slashdot dilbert the onion … citeseer
Ideally If some information is not available through the “legitimate” interface, then it should not be available even with full access to the system.
Oblivious Informal definition • A data structure is said to be oblivious if it does not give out any knowledge about the sequence of update operations that have been applied to it other than the final result of the operations.
Sounds Cool... But then, how should we represent a Dictionary in an oblivious way?
Sorted List Canonical form ) Obliviousness • But it’s not efficient!
Search Trees Can be viewed as sorted list K C S A F P X
1 6 7 4 2 5 3 Splay Trees By design exploithistory…
2-3 Trees As Sorted Lists Mark Brown and Robert Tarjan • Design and Analysis of A Data Structure for Representing Sorted Lists@ SIAM JC 1980
3-node 2-node Example 2-3 Sorted List What are the keys in nodes? (Yes, “G” is missing. :P) H B, D J A C E, F I K, L leaf A B C D E F H I J K L M
Structure • Internal nodes store “glue” keys;External leaves store “actual” keys • Each node • Has d 2{2, 3} children (degree) • Contains keys of the rightmost leaves from the first (d-1) sub-trees
Example 2-3 Sorted List Insert(“G”) • Locate target H G B, D J G A C E, F I K, L A B C D E F H I J K L M G
Example 2-3 Sorted List Insert(“G”) • Insert as leaf H B, D J A C E, F, G I K, L A B C D E F G H I J K L M
F Example 2-3 Sorted List Insert(“G”) • Overflow H B, D J A C E, F, G I K, L A B C D E F G H I J K L M
Example 2-3 Sorted List Insert(“G”) • Node splitting H B, D, F J A C E G I K, L A B C D E F G H I J K L M
D Example 2-3 Sorted List Insert(“G”) • Overflow H B, D, F J A C E G I K, L A B C D E F G H I J K L M
Example 2-3 Sorted List Insert(“G”) • Node splitting D, H B F J A C E G I K, L A B C D E F G H I J K L M
Curious? Why do we want the leaves? D, H B F J A C E G I K, L A B C D E F G H I J K L M
Finger Search Accessing a key ranked d away take O(log d) time D, H B F J A C E G I K, L A B C D E F G H I J K L M
Initial Insert(“D”) Initial Insert(“B”) B C A C A D A B C E A C D E B C A C,D A,B D A B C D E A B C D E Oblivious?
Truth • Any other known deterministic search trees are history dependent • AVL trees • 2-3 trees (actually, all a-b trees) • Red-Black trees • Splay trees • Why???
Lower Bound Arne Andersson, Thomas Ottmann • New Tight Bounds On Uniquely Represented Dictionaries@ FOCS 1991 • Either Search or Update must require W(n1/3) time
Concept GotRandom?
Oblivious 2-3 Tree Daniele Micciancio(then MIT, now UCSD) • Oblivious Data Structures: Applications to Cryptography@ STOC 1997
Issue At Hand How do 2-3 trees “leak”? • Degree of node gives out too much information
Solution Randomize the degree! • Degrees should split uniformly between 2 and 3
Definition Let M be a set of operations, and S be a set of algorithms implementing them. We say S is oblivious if: • for any two sequences of operations p1, p2, …, pn and q1, q2, …, qm that leads to the same set of values,the execution of these sequences have identical output probability distributions.
Oblivious 2-3 Tree b doesn’t needto have order • Create(L) • Create a tree based on sorted list L • Insert(i, b, T) • Insert b as the i-th key into T • For this talk, i is an input to Insert • Delete(i, T) • Delete the i-th key in T
Structure • Internal nodes store size of span;External leaves store keys • Degree of nodes is either 2 or 3 • Except on right spine, where it can be 1 5 2 1 2 A B C D E
Slight Modification • To make the (later) proof easier, I added level-links on internal nodes. • Usage: can now find the next node on the same level in O(1) time. 5 To make figurescleaner, level linkswill be implicit. 2 1 2 A B C D E
Disclaimer Paper contains no correctness proof. Plus, now that I made some changes. • All mistakes are mine
Create L is sorted Create(L) • Start with L at bottom level • Build nodes in level j by traversing nodes in level (j+1) • Pick d from {2, 3} u.a.r. • Assign next davailable nodes at level (j+1) to new node at level j • Span is sum of the spans of the d sub-trees • Continue collapsing until root
12 7 5 2 2 3 2 2 1 A B C D E F H I J K L M Create Example L = {“A”, …, “F”, “H”, …, “M”}
Coin Flips Required Worst case when n = 2k+1 and all coins give 2 2k-1 + 1 + k = 2k + k = n – 1 + b log(n) c 1 2k-1 k
12 7 5 2 2 3 2 2 1 A B C D E F H I J K L M Checkpoint Make sure you can dry-run Create.
Insert - Requirement What do we want from Insert(i, b, T)? • “Preserve randomness” • Insert(i, b, Create(L)) ~ Create(L’)where L’ = { L[1…i-1], b, L[i…n] }and n = |L| A ~ BA and B have the same distribution
Insert - Easy Algorithm • Extract L from the tree • Modify L to get L’ • Run Create(L’) • Surely we have Insert(i, b, Create(L)) ~ Create(L’)
Insert - High Level Idea First 3 steps • Locate the old i-th leaf • Mark the root to leaf path • Insert the new leaf to parent node • If not on right spine, “delete” all nodes to the right.Otherwise, “special treatment”.
Insert Example Range on brownpath may need tobe changed later Insert(7, “G”, T) First, locate the 7-th leaf 12 7 5 2 2 3 2 2 1 A B C D E F H I J K L M G
Insert Example “H” is now an excess… 12 7 5 2 2 3 2 2 1 A B C D E F G H I J K L M
Insert Example Imagine all the nodes to the right are gone. In reality, don’t do anything!!! 12 7 5 2 2 3 2 2 1 A B C D E F G H I J K L M
Insert - High Level Idea (continue) • Flip coins and group leaves as in Create(L’) • If the outcomes ever synchronize, update span on root path and stop.Otherwise, continue at the above level.
Insert Example Notice the brownpath changed: can exploit level-links Coin gives either 2 or 3. Let’s say it’s 3. 12 7 5 2 2 3 3 2 2 1 A B C D E F G H I J K L M
Insert Example The structures synchronize. Update span on root path and stop. 13 7 6 2 2 3 3 2 1 A B C D E F G H I J K L M
Why can we stop? Really Important All possible futures are the same in Create(L) and Create(L’). 12 7 5 2 2 3 3 2 2 1 A B C D E F G H I J K L M
Structural Agreement Lemma In a level, Create(L) and Create(L’) agree structurally, then all possible futures coincide. 12 7 5 2 2 3 3 2 2 1 A B C D E F G H I J K L M