A Fast and Verified Software Stackfor Secure Function Evaluation
Total Page:16
File Type:pdf, Size:1020Kb
Session I4: Verifying Crypto CCS’17, October 30-November 3, 2017, Dallas, TX, USA A Fast and Verified Software Stack for Secure Function Evaluation José Bacelar Almeida Manuel Barbosa Gilles Barthe INESC TEC and INESC TEC and FCUP IMDEA Software Institute, Spain Universidade do Minho, Portugal Universidade do Porto, Portugal François Dupressoir Benjamin Grégoire Vincent Laporte University of Surrey, UK Inria Sophia-Antipolis, France IMDEA Software Institute, Spain Vitor Pereira INESC TEC and FCUP Universidade do Porto, Portugal ABSTRACT as OpenSSL,1 s2n2 and Bouncy Castle,3 as well as prototyping We present a high-assurance software stack for secure function frameworks such as CHARM [1] and SCAPI [31]. More recently, a evaluation (SFE). Our stack consists of three components: i. a veri- series of groundbreaking cryptographic engineering projects have fied compiler (CircGen) that translates C programs into Boolean emerged, that aim to bring a new generation of cryptographic proto- circuits; ii. a verified implementation of Yao’s SFE protocol based on cols to real-world applications. In this new generation of protocols, garbled circuits and oblivious transfer; and iii. transparent applica- which has matured in the last two decades, secure computation tion integration and communications via FRESCO, an open-source over encrypted data stands out as one of the technologies with the framework for secure multiparty computation (MPC). CircGen is a highest potential to change the landscape of secure ITC, namely general purpose tool that builds on CompCert, a verified optimizing by improving cloud reliability and thus opening the way for new compiler for C. It can be used in arbitrary Boolean circuit-based secure cloud-based applications. Projects that aim to bring secure 4 cryptography deployments. The security of our SFE protocol im- computation over encrypted data to practice include FRESCO [27], plementation is formally verified using EasyCrypt, a tool-assisted TASTY [38] and Sharemind [21]. framework for building high-confidence cryptographic proofs, and In contrast to other areas of software engineering for critical it leverages a new formalization of garbled circuits based on the systems, the benefits of formal verification for cryptographic en- framework of Bellare, Hoang, and Rogaway (CCS 2012). We conduct gineering have been very limited, with some recent and notable a practical evaluation of our approach, and conclude that it is com- exceptions [2, 3, 8, 18, 22, 33]. The reasons for this are well known: petitive with state-of-the-art (unverified) approaches. Our work cryptographic software is a challenge for high-assurance software provides concrete evidence of the feasibility of building efficient, development due to the tension that arises between complex speci- verified, implementations of higher-level cryptographic systems. fications and the need for very high efficiency—security is supposed All our development is publicly available. to be invisible, and current verification technology comes with a performance penalty. The exceptions mentioned above mark the KEYWORDS emergence of a new area of research: high-assurance cryptogra- phy. This aims to apply formal verification to both cryptographic Secure Function Evaluation, Verified Implementation, Certified security proofs and the functional correctness and security of cryp- Compilation tographic implementations. In this paper we demonstrate that a tight integration of high- assurance cryptography and cryptographic engineering can deliver 1 INTRODUCTION the combined benefits of provable security and best cryptographic Cryptographic engineering is the domain-specific area of software engineering practices at a scale that significantly exceeds previous engineering that brings cryptography to practice. It encompasses experiments (typically carried out on core cryptographic primi- projects that maintain widely used cryptographic libraries such tives). We deliver a fast and verified software stack for secure com- putation over encrypted data. This choice is motivated by several factors. First, as mentioned above, this technology is among the Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed foremost practical applications of cryptography and is a fundamen- for profit or commercial advantage and that copies bear this notice and the full citation tal building block for making cloud computing secure. Second, it is on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. CCS ’17, October 30-November 3, 2017, Dallas, TX, USA 1http://openssl.org © 2017 Copyright held by the owner/author(s). Publication rights licensed to Associa- 2 tion for Computing Machinery. http://https://github.com/awslabs/s2n 3 ACM ISBN 978-1-4503-4946-8/17/10...$15.00 https://www.bouncycastle.org/ 4 https://doi.org/10.1145/3133956.3134017 https://github.com/aicis/fresco 1989 Session I4: Verifying Crypto CCS’17, October 30-November 3, 2017, Dallas, TX, USA C program leverages the foundational framework put forth by Bellare, Hoang and Rogaway [12] for the security of Yao’s garbled circuits. Our Optimized CircGen CircGen construction of SFE relies on an n-fold extension (where n is the size Boolean circuit of the selection string–or the circuit’s input) of the oblivious transfer protocol by Bellare and Micali [13], in the hashed version presented Inputs by Naor and Pinkas [47]. The implementation is proved secure Circuit reader relative to standard assumptions: the Decisional Diffie-Hellman problem, and the existence of entropy-smoothing hash functions Circuit description and pseudorandom functions. The higher-level component of our stack is a verified optimizing FRESCO application compiler from C programs to Boolean circuits that we call CircGen. Our compiler is mechanically verified using the Coq proof assistant, and builds on top of CompCert [43], a verified optimizing compiler Verified Yao Protocol Suite for C programs. It reuses the front- and middle-end of CompCert Outputs (introducing an extra loop-unrolling optimization) and it provides Verified Yao Evaluator a new verified back-end producing Boolean circuits. The back-end includes correctness proofs for several program transformations Communications that have not previously been formally verified, including the trans- FRESCO lation of RTL programs into guarded form and a memory-agnostic static single assignment (SSA) form. Our proof of semantic preser- vation is conditioned on the existence of an external oracle that Figure 1: Verified cryptographic software stack. Blue rect- provides functionally correct Boolean circuits for basic operations angles identify the verified components of the stack, while in the C language, such as 32-bit addition and multiplication. The black rectangles represent part of our trusting computing low-level circuits used in our current implementation for these base. Dashed blue rectangles are partially verified elements operations have not been formally verified and are hence part of and in dashed black rectangles one can find intermediate in- our trusted computing base. Verifying Boolean circuits for native put/output items. C operations can be done either in Coq or using other verification techniques and it is orthogonal to the reported verification effort. a tremendous challenge for high-assurance cryptography, as its se- The Boolean circuits generated by CircGen compare well with curity proofs are markedly distinct from prior work in formalizing alternative unverified solutions, namely CBMC-GC6 [34], although reductionist arguments. they are slightly less efficient (as would be expected). To widen the applicability of CircGen to scenarios where speed is more important Contributions. We present a high-assurance and high-speed soft- than assurance, we also implement some (yet unverified) global ware stack for secure multi-party computation. Figure 1 presents post-processing optimizations that make CircGen a good alternative the overall architecture of the stack. The lowest-level component to CBMC-GC for high-speed applications. is FRESCO [27]; an existing, practical, open-source, framework for Our work delivers several generic building blocks (the Boolean secure multi-party computation, which we use for communications circuit compiler, a verified implementation of oblivious transfer, ...) and input/output. The correctness of this framework (but not its that can be reused by many other verified cryptographic systems. security) is part of our trusted computing base, as verifying the However, the main strength of our results resides in the fact that, correctness of a Java-based communications infrastructure is out for the first time, we are able to produce a joining of high-assurance of the scope of high-assurance cryptography. cryptography and cryptography engineering that covers all the The intermediate component of our stack is a verified implemen- layers in a (passively) secure multiparty computation software tation of Yao’s secure function evaluation (SFE) protocol [57] based framework. on garbled circuits and oblivious transfer. This protocol allows two parties P1 and P2, holding private inputs x1 and x2, to jointly Challenges. The development