High-Speed Cryptography and Cryptanalysis
Total Page:16
File Type:pdf, Size:1020Kb
High-speed cryptography and cryptanalysis Citation for published version (APA): Schwabe, P. (2011). High-speed cryptography and cryptanalysis. Technische Universiteit Eindhoven. https://doi.org/10.6100/IR693478 DOI: 10.6100/IR693478 Document status and date: Published: 01/01/2011 Document Version: Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication: • A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website. • The final author version and the galley proof are versions of the publication after peer review. • The final published version features the final layout of the paper including the volume, issue and page numbers. Link to publication General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal. If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement: www.tue.nl/taverne Take down policy If you believe that this document breaches copyright please contact us at: [email protected] providing details and we will investigate your claim. Download date: 25. Sep. 2021 High-Speed Cryptography and Cryptanalysis Peter Schwabe High-Speed Cryptography and Cryptanalysis PROEFSCHRIFT ter verkrijging van de graad van doctor aan de Technische Universiteit Eindhoven, op gezag van de rector magnificus, prof.dr.ir. C.J. van Duijn, voor een commissie aangewezen door het College voor Promoties in het openbaar te verdedigen op maandag 24 januari 2011 om 16.00 uur door Peter Schwabe geboren te Siegburg, Duitsland Dit proefschrift is goedgekeurd door de promotoren: prof.dr. T. Lange en prof.dr. D.J. Bernstein CIP-DATA LIBRARY TECHNISCHE UNIVERSITEIT EINDHOVEN Schwabe, Peter High-Speed Cryptography and Cryptanalysis / door Peter Schwabe. – Eindhoven: Technische Universiteit Eindhoven, 2011 Proefschrift. – ISBN 978-90-386-2415-0 NUR 919 Subject heading: Cryptology 2000 Mathematics Subject Classification: 94A60, 94A62, 11Y16, 11T71 Printed by Printservice Technische Universiteit Eindhoven Cover design by Paula Schwabe Public domain Für meine Eltern Promotor: prof.dr. T. Lange prof.dr. D.J. Bernstein (University of Illinois at Chicago) Commissie: prof.dr. A.M. Cohen, chairman prof.dr. B. Preneel (Katholieke Universiteit Leuven) prof.dr. M. Scott (Dublin City University) prof.dr.ir. H.C.A. van Tilborg prof.dr. G. Woeginger prof.dr. B.-Y. Yang (Academia Sinica) Thanks This thesis would not exist without the support, help and encouragement of many people. First of all I would like to thank my supervisors Tanja Lange and Daniel J. Bern- stein. The time and effort they spent on teaching, guiding and supporting me is probably best expressed by using the German words for Ph.D. supervisor and saying that they are really a “Doktormutter” and “Doktorvater”. I also want to express my gratitude to Michael Naehrig. He supervised my Diplo- marbeit, taught me a lot about elliptic curves and pairings during our joint time in Aachen and Eindhoven, introduced me to my supervisors Tanja Lange and Daniel J. Bernstein, and always supported and encouraged me. I am very grateful for Michael’s friendship. I thank Arjeh Cohen, Bart Preneel, Michael Scott, Henk van Tilborg, Gerhard Woeginger, and Bo-Yin Yang for joining my Ph.D. committee and for reading this manuscript and giving valuable comments. Various people invited me to present my results or to work together, I am very grateful for these opportunities and wish to thank Pierrick Gaudry, Emmanuel Thomé, Jérémie Detrey, and Gaëtan Bisson at INRIA, Nancy; Bart Preneel and Emilia Käsper at Katholieke Universiteit Leuven; Christof Paar, Tim Güneysu, and Timo Kasper at Ruhr Universität Bochum; and Francisco Rodríguez-Henríquez, Debrup Chakraborty, Luis Gerardo de la Fraga, and Jorge E. González Díaz at CINVESTAV, Mexico City. Especially I want to thank Chen-Mou Cheng at National Taiwan Univer- sity and Bo-Yin Yang at Academia Sinica who invited me several times to Taipei and also hosted me for many weeks while I was writing this thesis. I also want to thank Grace Song for welcoming me as a frequent visitor in the apartment in Taipei that she shares with my girlfriend Chen-Han Lee. I thank my coauthors Gerd Ascheid, Dominik Auras, Daniel V. Bailey, Brian Bald- win, Lejla Batina, Paulo S. L. M. Barreto, Daniel J. Bernstein, Peter Birkner, Joppe W. Bos, Hsieh-Chung Chen, Chen-Mou Cheng, Neil Costigan, Gauthier van Damme, Luis Julian Dominguez Perez, Junfeng Fan, Tim Güneysu, Frank Gürkaynak, David Kamm- ler, Emilia Käsper, Thorsten Kleinjung, Tanja Lange, Markus Langenberg, Rainer Leu- pers, Nele Mentens, Heinrich Meyr, Rudolf Mathar, Giacomo de Meulenaer, Michael Naehrig, Ruben Niederhagen, Christof Paar, Christiane Peters, Francesco Regazzoni, Hanno Scharwaechter, Leif Uhsadel, Anthony Van Herrewege, Bo-Yin Yang, and Dian- dian Zhang for the fruitful collaboration. I thank the European Commission for supporting my Ph.D studies through the ICT Programme under Contract ICT-2007-216499 CACE. 7 8 Many thanks go to Michael Naehrig, Ruben Niederhagen, Christiane Peters and Anne Schwabe for proofreading earlier versions of this thesis, pointing out mistakes and suggesting improvements. I wish to thank the people at the coding and cryptology group at Eindhoven University of Technology, in particular Henk van Tilborg and Anita Klooster-Derks for making this group a very pleasant work environment. I also want to thank the other EiPSI Ph.D. students, former and current, for their company: Peter Birkner, Gaëtan Bisson, Dion Boesten, Mayla Brusò, Elisa Costante, Sebastiaan de Hoogh, Relinde Jurrius, Mehmet Sabir Kiraz, Xiao-Ping Liang Peter van Liesdonk, Michael Naehrig, Ruben Niederhagen, Jan-Jaap Osterwijk, Jing Pan, Christiane Peters, Bruno Pontes Soares Rocha, Reza Rezaeian Farashahi, Antonino Simone, Daniel Trivellato, Meilof Veeningen, and José Villegas. I also thank Çiçek Güven, Maxim Hendriks, and Shona Yu for the company in the coffee breaks and for the great time in Istanbul. Let me also mention the people at the Institute for Theoretical Information Tech- nology at RWTH Aachen University: Rudolf Mathar, Mathilde Getz, Detlef Maus, Daniel Bielefeld, Georg Böcherer, Daniel Catrein, Alexander Engels, Gernot Fabeck, Chunhui Liu, Wolfgang Meyer zu Bergsten, Melanie Neunerdt, Michael Reyer, Tobias Rick, Michael Schmeink, and Milan Zivkovic. Thank you for the support and the good time I had working together with you in Aachen. I very much thank my parents and my sister for their support. I thank my cousin Paula Schwabe for designing the cover of this thesis. Finally I deeply thank my girlfriend Chen-Han Lee for her support, understanding, and for her love. Contents List of algorithms 13 List of tables 15 1 Introduction 17 2 Preliminaries 23 2.1 Instructions and instruction sets . 24 2.2 Exploiting instruction-level parallelism . 25 2.2.1 Dependencies between instructions . 25 2.2.2 Pipelined and superscalar execution . 26 2.2.3 Optimizing code for in-order CPUs . 27 2.2.4 Optimizing code for out-of-order CPUs . 28 2.3 Exploiting data-level parallelism . 28 2.3.1 Reducing to instruction-level parallelism . 29 2.3.2 Single instruction stream, multiple data streams (SIMD) . 29 2.3.3 Algorithmic improvements . 31 2.4 Exploiting task-level parallelism . 31 2.5 Function calls, loops, and conditional statements . 32 2.6 Accessing memory . 35 2.6.1 Caching . 35 2.6.2 Virtual-address translation . 37 2.7 Limitations of compilers . 38 2.8 The qhasm programming language . 38 3 Implementations of AES 41 3.1 The Advanced Encryption Standard (AES) . 42 3.1.1 AES encryption . 42 3.1.2 Combining SUBBYTES,SHIFTROWS, and MIXCOLUMNS ....... 44 3.1.3 AES key expansion . 44 3.1.4 The Galois/Counter Mode (GCM) . 44 3.2 Cache-timing attacks against AES and GCM . 45 3.2.1 Attacks against AES encryption . 46 3.2.2 Attacks against AES key expansion . 46 3.2.3 Attacks against Galois/Counter Mode authentication . 47 3.3 Table-based implementations . 48 9 10 CONTENTS 3.3.1 Reducing instructions for table-based AES . 48 3.3.2 Reducing cycles for table-based AES . 54 3.4 Bitsliced AES for 64-bit Intel processors . 57 3.4.1 Bitsliced representation of the AES state . 58 3.4.2 The ADDROUNDKEY operation . 58 3.4.3 The SUBBYTES operation . 58 3.4.4 The SHIFTROWS operation . 59 3.4.5 The MIXCOLUMNS operation . 60 3.4.6 Key expansion . 61 3.5 AES-GCM for 64-bit Intel processors . 61 3.5.1 Table-based implementation . 61 3.5.2 Constant-time implementation . 62 3.6 Performance results and comparison . 63 3.6.1 Benchmarks of AES-CTR . 65 3.6.2 Benchmarks of AES-GCM . 72 4 Elliptic-curve cryptography on Cell processors 75 4.1 ECDH key exchange and the Curve25519 function . 76 4.1.1 Elliptic-Curve Diffie-Hellman key exchange (ECDH) . 76 4.1.2 Montgomery ladder for scalar multiplication .