Hash Functions & Macs ECE 646 Lecture 9
Total Page:16
File Type:pdf, Size:1020Kb
ECE 646 Lecture 9 Required Reading W. Stallings, "Cryptography and Network-Security,” Chapter 11 Cryptographic Hash Functions Appendix 11A Mathematical Basis of Birthday Attack Hash functions & MACs Chapter 12 Message Authentication Codes Recommended Reading SHA-3 Project https://csrc.nist.gov/projects/hash-functions/sha-3-project 1 2 Digital Signature Hash function Alice Bob arbitrary length Message Signature Message Signature m message Hash Hash function function hash h Hash value 1 function Hash value yes no Hash value 2 Public key Public key h(m) hash value algorithm algorithm fixed length Alice’s private key Alice’s public key 3 4 1 Vocabulary Hash functions Basic requirements hash function hash value 1. Public description, NO key message digest message digest hash total 2. Compression fingerprint arbitrary length input ® fixed length output imprint 3. Ease of computation cryptographic checksum compressed encoding MDC, Message Digest Code 5 6 Hash functions Hash functions Security requirements Dependence between requirements It is computationally infeasible Given To Find 1. Preimage resistance 2nd preimage resistant y x, such that h(x) = y collision resistant 2. 2nd preimage resistance x’ ¹ x, such that x and y=h(x) h(x’) = h(x) = y 3. Collision resistance x’ ¹ x, such that h(x’) = h(x) 7 8 2 Hash functions Brute force attack against (unkeyed) One-Way Hash Function Given y mi’ One-Way Collision-Resistant i=1..2n Hash Functions Hash Functions 2n messages with the contents required by the forger OWHF CRHF h preimage resistance ? 2nd preimage resistance h(mi’) = y collision resistance n - bits 9 10 Creating multiple versions of Brute force attack against Yuval the required message Collision Resistant Hash Function state thereby borrowed I confirm - that I received r messages r messages acceptable for the signer required by the forger $10,000 Mr. Kris from m m ’ ten thousand dollars Dr. Krzysztof i i=1..r j j=1..r October 23, money h h Gaj on 2019. This 10 / 23 / sum of money should returned Mr. h(mi) h(mj’) be to Gaj is required to given back Dr. n - bits n - bits 4th December by the day of 2019. h(mi) = h(mj’) fourth Dec. 11 12 3 Creating multiple versions of Message acceptable for the signer the required message state thereby borrowed state thereby October 23, I that on 2019 I confirm - that I received confirm - 10 / 23 / borrowed Mr. Kris paper $10,000 Mr. Kris I from a from received Dr. Krzysztof manuscript ten thousand dollars Dr. Krzysztof security of Electronic Voting. text on This October 23, money side-channel attacks for PQC. item Gaj on 2019. This 10 / 23 / sum of money should returned Mr. be to Gaj should returned Mr. is required to be to Gaj given back Dr. is required to given back Dr. 4th December 4th December by the day of 2019. by the day of 2019. fourth Dec. fourth Dec. 13 14 Birthday paradox Birthday paradox How many students must be in a class so that How many students must be in a class so that there is a greater than 50% chance that there is a greater than 50% chance that 1. one of the students shares the teacher’s 1. one of the students shares the teacher’s birthday (up to the day and month)? birthday (day and month)? 2. any two of the students share the same ~ 366/2 = 183 birthday (up to the day and month)? 2. any two of the students share the same birthday (day and month)? ~Ö 366 » 19 15 16 4 Brute force attack against Brute force attack against Collision Resistant Hash Function Collision Resistant Hash Function Storage requirements Probability p that two different messages have the same hash value: J.J. Quisquater r2 p = 1 − exp − collision search algorithm ( 2n ) n/2 n/2 For r = 2n/2 p = 63% Number of operations: 2 Ö p/2 · 2 » 2.5 · 2 Storage: Negligible 17 18 Hash value size Hash function algorithms One-Way Collision-Resistant Customized Based on Based on Older algorithms (currently insecure): (dedicated) block ciphers modular arithmetic n ³ 64 n ³ 128 MD2 MDC-2 MASH-1 Rivest 1988 8 bytes 16 bytes MDC-4 1988-1996 MD4 IBM, Brachtl, Meyer, Schilling, 1988 Old standards: Rivest 1990 n ³ 80 n ³ 160 10 bytes 20 bytes MD5 SHA-0 RIPEMD NSA, 1992 Current standards (e.g., SHA-2, SHA-3): Rivest 1990 European RACE Integrity Primitives Evaluation Project, 1992 n = 128, 192, 256 n = 256, 384, 512 SHA-1 NSA, 1995 RIPEMD-160 16, 24, 32 bytes 32, 48, 64 bytes SHA-256, SHA-384, SHA-512 NSA, 2000 19 20 5 Attacks against dedicated hash functions What was discovered in 2004-2005? known by 2004 partially broken broken; MD2 MD4 Wang, Feng, Lai, Yu, Crypto 2004 (manually, without using a computer) broken, H. Dobbertin, 1995 MD4 (one hour on PC, 20 free bytes at the start of the message) attack with broken; MD5 240 operations Wang, Feng, weakness Lai, Yu, broken; SHA-0 Crypto 2004 RIPEMD Crypto 2004 MD5 SHA-0 discovered, RIPEMD Wang, Feng, Lai, Yu 1995 NSA, reduced round attack with (manully, without partially broken, Crypto 2004 263 operations 1998 France version broken, SHA-1 using a computer) collisions for the (1 hr on a PC) Dobbertin 1995 Wang, Yin, RIPEMD-160 compression function, Yu, Aug 2005 Dobbertin, 1996 SHA-1 (10 hours on PC) RIPEMD-160 SHA-256, SHA-384, SHA-512 SHA-256, SHA-384, SHA-512 21 22 263 operations Recommendations of NIST (1) Schneier, 2005 In hardware: NIST Brief Comments on Recent Cryptanalytic Attacks on SHA-1 Feb 2005 Machine similar to the one used to break DES: The new attack is applicable primarily Cost = $50,000-$70,000 Time: 18 days to the use of hash functions in digital signatures. or Cost = $0.9-$1.26M Time: 24 hours In many cases applications of digital signatures introduce additional context information, In software: which may make attacks impracticle. Computer network similar to distributed.net used to break DES (~331,252 computers) : Other applications of hash functions, such as Message Authentication Codes (MACs), Cost = ~ $0 Time: 7 months are not threatened by the new attacks. 23 24 6 SHA-3 Contest Timeline Recommendations of NIST (2) 2007 • publication of requirements NIST was already earlier planning to withdraw SHA-1 • 29.X. 2007: request for candidates 2008 in favor of SHA-224, SHA-256, SHA-384 & SHA-512 • 31.X.2008: deadline for submitting candidates by 2010. • 9.XII.2008: announcement of 51 candidates accepted for Round 1 2009 • 25-28.II.2009: 1st SHA-3 Candidate Conference, Leuven, Belgium New implementations should use new hash functions. • 24.VII.2009: 14 Round 2 candidates announced 2010 • 23-24.VIII.2010: 2nd SHA-3 Candidate Conference, Santa Barbara, CA NIST encourages government agancies to develop plans • 9.XII.2010: 5 Round 3 candidates announced for gradually moving towards new hash functions, 2012 • 22-23.III.2012: 3rd SHA-3 Candidate Conference, Washington, D.C. taking into account the sensitivity of the systems • 2.X.2012: selection of the winner when setting the timetables. 2014: • 28.V.2014: draft version of the standard published 2015: • 5.VIII.2015: final version of the standard published 25 26 Number of Submissions Basic Requirements for a new hash function • Number of submissions received by NIST: • Must support hash values of 64 224, 256, 384 and 512 bits • Available worldwide without licensinG fees • Number of submissions publicly available: • Secure over tens of years 56 • Suitable for use in - digital signatures FIPS 186 • Number of submissions qualified to the first round: - messaGe authentication codes, HMAC, FIPS 198 51 - key aGreement schemes, SP 800-56A - random number Generators, SP 800-90 • At least the same security level as SHA-2 with increased efficiency 27 28 7 SHA-3 Contest: 2008-2012 FPGA Benchmarking of Round 2 Candidates Altera Xilinx Technology Low-cost High- Low-cost High- Round 1 Round 2 Round 3 51 performance performance 14 candidates 5 1 Jul. 2009 Dec. 2010 Oct. 2012 90 nm CycloneDesigners: II Stratix II Spartan 3 Virtex 4 Oct. 2008 65 nm Cyclone III Stratix III Virtex 5 Hardware benchmarking Designers: Security Analysis & Software Benchmarking Marcin Ekawat Rogawski Homsirikamol (“Ice”) 29 30 29 30 ATHENa – Automated Tool for Hardware EvaluatioN ATHENa Inputs/Outputs • Open-source configuration files • Written in Perl • Developed 2009-2012 testbench • Automated search for optimal synthesizable source § Options of tools files § Target frequency § Starting placement point • Supporting Xilinx ISE & Altera Quartus OR FPL Community Award 2010 result summary database entries Milan, Italy, Sep. 2010 (human-friendly) (machine- friendly) Image of Athena Goddess courtesy of Carolyn Angus 31 32 31 32 8 ATHENa Database of Results ATHENa Gains http://cryptography.gmu.edu/athenadb 3 Area 2.5 Thr 2 Thr/Area 1.5 1 0.5 0 Ratios of results obtained using ATHENa suggested options vs. default options of FPGA tools 33 34 33 34 ATHENa Gains Why ATHENa? "The Greek goddess Athena was frequently called upon to settle disputes between the gods or various mortals. Athena Goddess of Wisdom was “working” with ATHENa… known for her superb logic and intellect. Her decisions were usually well-considered, highly ethical, and seldom motivated by self-interest.” old days… from "Athena, Greek Goddess of Wisdom and Craftsmanship" 35 36 35 36 9 SHA-3 Round 2 Results: 14 candidates Research: Multiple Architectures Throughput Horizontal Folding • datapath width = state size Best: Fast & Small /2(h) • two clock cycles per one round/step Throughput /2(h) Th x1 Worst: Slow & Big Area Area A Throughput vs.