Thomas Pöppelmann Hardware Security Group Horst Görtz Institute for IT Security 05.06.2015 Implementing Lattice-Based Cryptography.

Slides:



Advertisements
Similar presentations
Side-Channel Attacks on RSA with CRT Weakness of RSA Alexander Kozak Jared Vanderbeck.
Advertisements

14. Aug Towards Practical Lattice-Based Public-Key Encryption on Reconfigurable Hardware SAC 2013, Burnaby, Canada Thomas Pöppelmann and Tim Güneysu.
Paper by: Craig Gentry Presented By: Daniel Henneberger.
Cryptography and Network Security Chapter 5 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture Implementations. The efficiency of a particular cryptographic scheme based on any one of the algebraic structures will depend on a number.
By Claudia Fiorini, Enrico Martinelli, Fabio Massacci
The Learning With Errors Problem Oded Regev Tel Aviv University (for more details, see the survey paper in the proceedings) Cambridge, 2010/6/11.
Lecture 3.3: Public Key Cryptography III CS 436/636/736 Spring 2012 Nitesh Saxena.
Hidden Markov Model Cryptanalysis Chris Karlof and David Wagner.
Dr. Lo’ai Tawalbeh Summer 2007 Chapter 9 – Public Key Cryptography and RSA Dr. Lo’ai Tawalbeh New York Institute of Technology (NYIT) Jordan’s Campus INCS.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Lattice-Based Cryptography
Asymmetric Cryptography part 1 & 2 Haya Shulman Many thanks to Amir Herzberg who donated some of the slides from
An Introduction to Cryptology and Coding Theory Discrete Math 2006.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Cryptography and Network Security Chapter 5. Chapter 5 –Advanced Encryption Standard "It seems very simple." "It is very simple. But if you don't know.
Lattice-Based Cryptography
Lecture 23 Symmetric Encryption
Radu Muresan CODES+ISSS'04, September 8-10, 2004, Stockholm, Sweden1 Current Flattening in Software and Hardware for Security Applications Authors: R.
Introduction to Computer and Network Security Iliano Cervesato 26 August 2008 – Modern Cryptography.
Introduction to Computer and Network Security Iliano Cervesato 2 September 2008 – Public-key Encryption.
1 NTRU: A Ring-Based Public Key Cryptosystem Jeffrey Hoffstein, Jill Pipher, Joseph H. Silverman LNCS 1423, 1998.
Tallinn University of Technology Quantum computer impact on public key cryptography Roman Stepanenko.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
ASYMMETRIC CIPHERS.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
Lecture 19 Page 1 CS 111 Online Security for Operating Systems: Cryptography, Authentication, and Protecting OS Resources CS 111 On-Line MS Program Operating.
Calculating Discrete Logarithms John Hawley Nicolette Nicolosi Ryan Rivard.
A Compact and Efficient FPGA Implementation of DES Algorithm Saqib, N.A et al. In:International Conference on Reconfigurable Computing and FPGAs, Sept.
AES Background and Mathematics CSCI 5857: Encoding and Encryption.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
9th IMA Conference on Cryptography & Coding Dec 2003 More Detail for a Combined Timing and Power Attack against Implementations of RSA Werner Schindler.
Public-Key Cryptography CS110 Fall Conventional Encryption.
LOGO Hardware side of Cryptography Anestis Bechtsoudis Patra 2010.
200/MAPLD 2004 Craven1 Super-Sized Multiplies: How Do FPGAs Fare in Extended Digit Multipliers? Stephen Craven Cameron Patterson Peter Athanas Configurable.
Midterm Review Cryptography & Network Security
Lattice-Based Cryptography: From Practice to Theory to Practice Vadim Lyubashevsky INRIA / CNRS / ENS Paris (September 12, 2011)
Strength of Cryptographic Systems Dr. C F Chong, Dr. K P Chow Department of Computer Science and Information Systems The University of Hong Kong.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
Utilizing Performance Monitors for Compromising keys of RSA on Intel Platforms Sarani Bhattacharya and Debdeep Mukhopadhyay Dept. of Computer Science and.
Lecture 3 Page 1 Advanced Network Security Review of Cryptography Advanced Network Security Peter Reiher August, 2014.
Accelerating Homomorphic Evaluation on Reconfigurable Hardware Thomas Pöppelmann, Michael Naehrig, Andrew Putnam, Adrian Macias.
Understanding Cryptography by Christof Paar and Jan Pelzl These slides were prepared by Tim Güneysu, Christof Paar and Jan Pelzl.
Lecture 23 Symmetric Encryption
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
China Summer School on Lattices and Cryptography Craig Gentry and Shai Halevi June 4, 2014 Homomorphic Encryption over Polynomial Rings.
Intro to Cryptography Lesson Introduction
Public Key Cryptosystem Introduced in 1976 by Diffie and Hellman [2] In PKC different keys are used for encryption and decryption 1978: First Two Implementations.
Chapter 2 Symmetric Encryption.
DES Analysis and Attacks CSCI 5857: Encoding and Encryption.
Copyright 2012, Toshiba Corporation. A Survey on the Algebraic Surface Cryptosystems Koichiro Akiyama ( TOSHIBA Corporation ) Joint work with Prof. Yasuhiro.
Lecture 9 Elliptic Curves. In 1984, Hendrik Lenstra described an ingenious algorithm for factoring integers that relies on properties of elliptic curves.
Lecture5 – Introduction to Cryptography 3/ Implementation Rice ELEC 528/ COMP 538 Farinaz Koushanfar Spring 2009.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
1 Introduction to Information Security , Spring 2016 Lecture 4: Applied cryptography: asymmetric Zvi Ostfeld Slides credit: Eran Tromer.
On Public Key Encryption from Noisy Codewords Yuval Ishai Technion & UCLA Eli Ben-Sasson (Technion) Iddo Ben-Tov (Technion) Ivan Damgård (Aarhus) Noga.
Fully Homomorphic Encryption (FHE) By: Matthew Eilertson.
Packing Techniques for Homomorphic Encryption Schemes Scott Thompson CSCI-762 4/28/2016.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
School of Computer Science and Engineering Pusan National University
Cryptography after DES
Background: Lattices and the Learning-with-Errors problem
The Fast Fourier Transform
The Fast Fourier Transform
Cryptography and Network Security Chapter 5 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Presentation transcript:

Thomas Pöppelmann Hardware Security Group Horst Görtz Institute for IT Security Implementing Lattice-Based Cryptography on Embedded Devices Summer school on real-world crypto and privacy

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation

Why Implementation of Lattices? Why focus on lattice-based cryptography? – We can get signatures and public key encryption out of lattices and also more (IBE, FHE) – A lot of development on theory side; schemes are getting better and better – Implementation of lattices is a young field; only done for 3- 4 years now (except for NTRU)

Implementation Conditions that have to be met for implementation – Parameters, parameters, parameters – Security level should be known What are the goals? – Throughput, latency, and power/energy – Code size/area (drives costs) – Small key, ciphertext, and signature size  Cross-disciplinary work and interaction between engineers and cryptographers required – Parameter selection and design decisions can make schemes more efficient but also weaker

To be Ideal or not Ideal? Random LatticesIdeal Lattices Two important lines of research: random lattices and ideal lattices Big impact on implementation (theory not that much) Security for random lattices is better understood (ideal lattices are more structured) Implementation of random lattice signatures: High-speed signatures from standard lattices, Özgür Dagdelen, Rachid El Bansarkhani, Florian Göpfert, Tim Güneysu, Tobias Oder, Thomas Pöppelmann, Ana Helena Sánchez, Peter Schwabe, Latincrypt’14

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation

Learning with Errors Solving of a system of linear equations Blue is given; Find (learn) red => Solve linear system Use Gaussian elimination secret (slides stolen from talk by Douglas Stebila at RWC’15)

Learning with Errors Solving of a system of linear equations Blue is given; Find red => Learning with errors secret random small noise looks random (slides stolen from talk by Douglas Stebila at RWC’15)

(Ring) Learning with Errors From learning with errors to ring-learning with errors Only one line has to be stored

Ring Learning with Errors … 1-2…0 01…0 3243…12 random small secret (Gaussian) small error (Gaussian) random

Ring Learning with Errors … 1-2…0 01…0 3243…12 random small secret (Gaussian) small error (Gaussian) random

Discrete Gaussian Distribution … Uniform 4-8…01 Uniform * Gaussian = Uniform Gaussian * Gaussian = larger Gaussian Gaussian e

16 Gaussian Sampling: Options Rejection Sampling Bernoulli Sampling Knuth-Yao Sampling Cumulative Distribution Table (CDT) Sampling [DG14] Efficient sampling from discrete Gaussians for lattice-based cryptography on a constrained device, Dwarakanath and Galbraith, Applicable Algebra in Engineering, Communication and Computing, 2014 [DDLL14] Lattice Signatures and Bimodal Gaussians, Léo Ducas and Alain Durmus and Tancrède Lepoint and Vadim Lyubashevsky, CRYPTO '13

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation

Ring-LWE Encryption: Scheme [LP11/LPR10] 14. Aug x x + ++ x+ 18 large small

Ring-LWE Encryption: Parameters 14. Aug … … … …10

Ring-LWE Encryption: Parameters 14. Aug

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation

Simple Implementation of RLWE-Encryption void encrypt(poly a, poly p, unsigned char * plaintext, poly c1, poly c2) { int i,j; poly e1,e2,e3; gauss_poly(e1); gauss_poly(e2); gauss_poly(e3); poly_init(c1, 0, n); // init with 0 poly_init(c2, 0, n); // init with 0 for(i = 0;i < n; i++){ // multiplication loops for(j = 0; j<n; j++){ c1[(i + j) % n] = modq(c1[(i + j) % n] + (a[i] * e1[j] * (i+j>=n ? -1 : 1))); c2[(i + j) % n] = modq(c2[(i + j) % n] + (p[i] * e1[j] * (i+j>=n ? -1 : 1))); } c1[i] = modq(c1[i] + e2[i]); c2[i] = (plaintext[i>>3] & (1<<(i%8))) ? modq(c2[i] + e3[i] + q/2) : modq(c2[i] + e3[i]); } Code will be made available: This has to be fast

Results in Software Implementation of RLWE-Encryption on the AVR 8-bit ATxmega processor running with 32 MHz SchoolMul Schoolbook multiplication (SchoolMul) Encryption is two multiplications and decryption one

Hardware Implementation: Low Area We can’t do much about the RAMs Multiplication (DSP) Modular reduction (power ot two possible)

Hardware Implementation: Low Area Post-place-and-route performance on a Spartan-6 LX9 FPGA Area savings by power of two modulus

Ring-LWE: Can we do better? Can we do better?

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation – The number theoretic transform (NTT) – Usage of the NTT for lattice-based crypto – Optimization of the NTT

Outline Motivation Ring-learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation – The number theoretic transform (NTT) – Usage of the NTT for lattice-based crypto – Optimization of the NTT

Polynomial Multiplication Using the NTT

NTT for Lattice Crypto/Convolution Theorem

Negative Wrapped/Negacyclic Convolution

Efficient Computation of the NTT (Textbook) twiddle factors

Outline Motivation Ring-Learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized implementation High-performance implementation – The number theoretic transform (NTT) – Usage of the NTT for lattice-based crypto – Optimization of the NTT

Implementation of Ring-LWE Encryption Keys are stored in frequency domain Decryption it just one inverse transformation

Implementation of Ring-LWE Encryption

Outline Motivation Ring-Learning with errors (RLWE) Public-key encryption based on RLWE Area-optimized Implementation High-performance implementation – The number theoretic transform (NTT) – Usage of the NTT for lattice-based crypto – Optimization of the NTT

Optimization of NTT Computation

Optimization of NTT Computation

Optimization of NTT Computation

Optimization of NTT Computation

Optimization of NTT Computation Code will be made available:

Optimization of NTT Computation We save several steps compared to straightforward approach Almost no additional costs (if we store twiddle factors) – No multiplication by one in first stage anymore – Can be mitigated by using lookup tables if coefficients for e are small textbook Our work (*) (*) FFT people probably know most of these tricks

Optimization of NTT Computation

Ring-LWE Encryption on ATXmega Moderate performance impact of larger parameter set Very fast decryption Some pitfalls in practice (only CPA and decryption errors)

Ring-LWE Encryption on ATXmega Schoolbook was 12 million [POG15] High-Performance Ideal Lattice-Based Cryptography on 8-bit ATxmega Microcontrollers, Thomas Pöppelmann, Tobias Oder, and Tim Güneysu, to appear in Latincrypt’15 Code size is not increased much Sampler is the bottleneck now

Ring-LWE Encryption on FPGA NTT is very fast but still quite small Lots of improvement since [GFS+12]

Future Work Cryptanalysis Protection against all forms of side channels (timing, power, EM) Another look at original NTRU Performance improvements – Talk to signal processing people over the efficient implementation of the NTT – Evaluate more algorithms for polynomial multiplication

Augment Cryptanalysis with Side-Channel SPA on RSA SPA on Sampler (obviously not measured) smalllarge zero small

Thomas Pöppelmann Hardware Security Group Horst Görtz Institute for IT Security Implementing Lattice-Based Cryptography on Embedded Devices Summer school on real-world crypto and privacy Questions? Code: Thanks to Tobias Oder and Tim Güneysu