Precise Bounds for Montgomery Modular Multiplication and Some Potentially Insecure RSA Moduli Colin D. Walter formerly: www.co.umist.ac.uk (Manchester,

Slides:



Advertisements
Similar presentations
CRT RSA Algorithm Protected Against Fault Attacks WISTP - 5/10/07 Arnaud BOSCHER Spansion EMEA Robert NACIRI Oberthur Card Systems Emmanuel PROUFF Oberthur.
Advertisements

Integer & Fixed Point Addition and Multiplication CENG 329 Lab Notes By F. Serdar TAŞEL.
Generating Random Numbers
CENG536 Computer Engineering department Çankaya University.
Is there Safety in Numbers against Side Channel Leakage? Colin D. Walter UMIST, Manchester, UK
Arithmetic Coding. Gabriele Monfardini - Corso di Basi di Dati Multimediali a.a How we can do better than Huffman? - I As we have seen, the.
Uniqueness of Optimal Mod 3 Circuits for Parity Frederic Green Amitabha Roy Frederic Green Amitabha Roy Clark University Akamai Clark University Akamai.
Digital Signatures and Hash Functions. Digital Signatures.
Online Scheduling with Known Arrival Times Nicholas G Hall (Ohio State University) Marc E Posner (Ohio State University) Chris N Potts (University of Southampton)
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Number Theory and Cryptography
C ● O ● M ● O ● D ● O RESEARCH LAB Longer Keys may Facilitate Side Channel Attacks (Bradford, UK) Colin.
MATH 685/ CSI 700/ OR 682 Lecture Notes
C. Walter, Data Integrity for Modular Arithmetic, CHES 2000 CHES 2000 Data Integrity in Hardware for Modular Arithmetic Colin Walter Computation Department,
Differential Equations MTH 242 Lecture # 11 Dr. Manshoor Ahmed.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 18: Hash Tables.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Infinite Sequences and Series
Homework #4 Solutions Brian A. LaMacchia Portions © , Brian A. LaMacchia. This material is provided without.
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
The RSA Cryptosystem and Factoring Integers (II) Rong-Jaye Chen.
Factoring 1 Factoring Factoring 2 Factoring  Security of RSA algorithm depends on (presumed) difficulty of factoring o Given N = pq, find p or q and.
Algorithm Design Techniques: Induction Chapter 5 (Except Section 5.6)
Algebraic numbers I Based on Burnikel, Fleischer, Mehlhorn, Schirra article: A Strong and Easily Computable Separation Bound for Arithmetic Expressions.
Hashing General idea: Get a large array
Montgomery’s Multiplication Technique: How to make it Smaller and Faster Colin D. Walter Computation Department, UMIST, UK
Tallinn University of Technology Quantum computer impact on public key cryptography Roman Stepanenko.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
The RSA Algorithm Rocky K. C. Chang, March
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Section 2.2: Affine Ciphers; More Modular Arithmetic Practice HW (not to hand in) From Barr Textbook p. 80 # 2a, 3e, 3f, 4, 5a, 7, 8 9, 10 (Use affinecipherbreaker.
1 AN EFFICIENT METHOD FOR FACTORING RABIN SCHEME SATTAR J ABOUD 1, 2 MAMOUN S. AL RABABAA and MOHAMMAD A AL-FAYOUMI 1 1 Middle East University for Graduate.
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
Long Modular Multiplication for Cryptographic Applications Laszlo Hars Seagate Research Workshop on Cryptographic Hardware and Embedded Systems, CHES 2004.
Continuity ( Section 1.8) Alex Karassev. Definition A function f is continuous at a number a if Thus, we can use direct substitution to compute the limit.
The Polynomial Time Algorithm for Testing Primality George T. Gilbert.
Reading and Writing Mathematical Proofs
Issues of Security with the Oswald-Aigner Exponentiation Algorithm Colin D Walter Comodo Research Lab, Bradford, UK Colin D Walter.
9th IMA Conference on Cryptography & Coding Dec 2003 More Detail for a Combined Timing and Power Attack against Implementations of RSA Werner Schindler.
Analysis of Algorithms
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter.
Hashing Sections 10.2 – 10.3 CS 302 Dr. George Bebis.
Alternative Wide Block Encryption For Discussion Only.
Some Security Aspects of the Randomized Exponentiation Algorithm (Bradford, UK) Colin D. Walter M IST.
Sliding Windows Succumbs to Big Mac Attack Colin D. Walter
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Precise Bounds for Montgomery Modular Multiplication and Some Potentially Insecure RSA Moduli Colin D. Walter formerly: (Manchester,
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
12 INFINITE SEQUENCES AND SERIES. In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series.
M IST : An Efficient, Randomized Exponentiation Algorithm for Resisting Power Analysis Colin D. Walter formerly: (Manchester, UK)
M IST : An Efficient, Randomized Exponentiation Algorithm for Resisting Power Analysis Colin D. Walter (Manchester, UK)
1/16 Seeing through M IST given a Small Fraction of an RSA Private Key Colin D. Walter Comodo Research Lab (Bradford, UK)
WISA 2007 Jeju Island, Korea, 27th – 29th Aug 2007 Longer Randomly Blinded RSA Keys may be Weaker than Shorter Ones Colin D. Walter
A Brief Maximum Entropy Tutorial Presenter: Davidson Date: 2009/02/04 Original Author: Adam Berger, 1996/07/05
Two’s and one’s complement arithmetic CLOCK ARITHMETIC.
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
Implementation of Public Key Encryption Algorithms
Simulation. Types of simulation Discrete-event simulation – Used for modeling of a system as it evolves over time by a representation in which the state.
Lecture 6. RSA Use in Encryption to encrypt a message M the sender: – obtains public key of recipient PU={e,n} – computes: C = M e mod n, where 0≤M
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
D. Cheung – IQC/UWaterloo, Canada D. K. Pradhan – UBristol, UK
Distinguishing Exponent Digits by Observing Modular Subtractions
CSE 2331/5331 Topic 8: Hash Tables CSE 2331/5331.
Hashing Sections 10.2 – 10.3 Lecture 26 CS302 Data Structures
Data Structures – Week #7
Cryptography Lecture 16.
Presentation transcript:

Precise Bounds for Montgomery Modular Multiplication and Some Potentially Insecure RSA Moduli Colin D. Walter formerly: (Manchester, UK) future: (Bradford, UK)

RSA 2002C.D. Walter, UMIST2 Motivation Modular multiplication is the foundation of most arithmetic-based cryptography: efficiency and security are important. Montgomery modular multiplication is one highly favoured method. To avoid full length comparisons or timing attacks, conditional modular reductions are skipped, but the price is a higher bound, often 2M for modulus M, and perhaps extra iterations. For typical, standard key and word lengths, 2M will overflow into the next word by just 1 bit. So an extra word may have to be processed: inefficient. Perhaps the overflow bit can be detected and allow a power analysis attack.

RSA 2002C.D. Walter, UMIST3 History P. L. Montgomery Modular multiplication without trial division Maths of Comp n 44 (1985), 519–521 C. D. Walter Montgomery Exponentiation Needs No Final Subtractions Electronics Letters 35 (1999), 1831–1832 G. Hachez & J.-J. Quisquater Montgomery Exponentiation with No Final Subtractions: improved results CHES 2000, LNCS 1965, 293 – 301

RSA 2002C.D. Walter, UMIST4 Montgomery Mod r Mult n { Pre-condition: 0  A < r n } P  0 ; For i  0 to n  1 do Begin q  (p 0 +a i b 0 )(-m 0 -1 ) mod r ; P  (P + a i B + qM) div r ; { Invariant: 0  P < M+B } End ; { Post-conditions: Pr n  A×B mod M, ABr –n  P < M + ABr –n }

RSA 2002C.D. Walter, UMIST5 Loop Invariants I Suppose P < M+B at the start of the loop. At the end of the loop, the new value of P is (P + a i B + qM) div r < ((M+B)+(r–1)B+(r–1)M)/r = M+B So the invariant holds. If B was bounded by 2M, the output would be bounded by 3M. Eitherwe perform a conditional subtraction orwe perform another iteration to keep input less than 2M. The former is banned to avoid timing attacks. If the last a i is small enough, the bound becomes M+B/2 < 2M and another iteration would be unnecessary. To achieve that we require a i  r/2 for the top digit: — unlikely if A  M and M uses all bits of the top word.

RSA 2002C.D. Walter, UMIST6 Loop Invariants II More accuracy is possible. Define: Then  i+1 = (  i + a i )/r < 1 by induction. Suppose P i is the value of P at the start of the iteration using  i. Then it is easy to establish:  i+1 B  P i+1 < M +  i+1 B because  i+1 B = (  i B + a i B)/r < (P i + a i B + q i M)/r = (P i + a i B + q i M) div r = P i+1 and similarly for the upper bound.

RSA 2002C.D. Walter, UMIST7 Post-Condition At the end of the last iteration: So the loop invariant gives: ABr –n  P < M + ABr –n This is the tightest interval possible since its width is only M. It improves on the previous upper bound M+B since Ar –n < 1. It is much better if A is known to be smaller, e.g. less than M.

RSA 2002C.D. Walter, UMIST8 Stability Under what conditions will a bound on A and B be preserved? Then output from one MMM can be re-used as input without adjustment. Suppose A and B are bounded by (1+ )M. We require M + ABr –n  (1+ )M always for such stability, i.e. M + (1+ ) 2 M 2 r –n  (1+ )M This means (1+ ) 2 Mr –n  which we can solve for suitable. It has real solutions exactly when: 4M  r n

RSA 2002C.D. Walter, UMIST9 First Results The condition 4M  r n for I/O remaining bound improves on those given by the papers cited earlier. When the condition is satisfied we can choose so that A and B are bounded by 2M or by ½r n as appropriate. Intermediate values of P are bounded above by ¾r n. For such M with n digits, there is no extra processing required to compensate for removing the final subtraction. For standard key lengths, we need to take n to be 1 more than the number of digits in M in order to satisfy the bound.

RSA 2002C.D. Walter, UMIST10 Standard Key Lengths We have seen the need for increasing n for standard key lengths. This means one more iteration than the number of digits in M. It is the cost of deleting the final subtraction. How many bits of the corresponding extra digit are required? We know the bound 2M means at most one bit is needed. Is it necessary? Its occasional existence may provide a handle for a timing or power analysis attack. The frequency of the top bit being non-zero is different for squares and multiplies. This was reported at RSA (This bit is what prompts the final conditional subtraction.)

RSA 2002C.D. Walter, UMIST11 The Extra Bit The frequency of the top bit becoming set is around 25% – 30% when n has not been increased. Increasing n decreases the upper bound M + ABr –n making it less likely to set the topmost bit, i.e. the next bit after the top bit of M. We need to discover its frequency of being 1 to determine if a difference for squares and multiplies is measurable. We will see when it is always zero. Since n is being increased by 1, we have ¼r n–1 < M < r n–1 and want I/O to be less than r n–1.

RSA 2002C.D. Walter, UMIST12 Conditions for no overflow bit The condition of interest is M + ABr –n < r n–1 when A, B < r n–1. So we need M such that M + (r n–1 ) 2 r –n < r n–1 i.e. M < r n–1 (1–r –1 ) Thus the arguments and output of MMM will have the same number of words as M unless the top word of M is all 1s. Hence, when the final conditional subtraction is omitted from MMM, there is no “overflow” bit against which a power analysis attack can be mounted unless the top word of M is all 1s.

RSA 2002C.D. Walter, UMIST13 The Unlikely Event The potentially dangerous case is therefore when the top word of M is r – 1, which is reassuringly uncommon, and the worst case is M = r n–1. By solving our previous quadratic in, the best bound on the inputs to achieve stability in that worst case is (1+ )M = ½r n (1–(1–4r –1 ) ½ ) = r n–1 + r n–2 + 2r n–3 + 5r n– With the reasonable assumptions that residues mod M are uniformly distributed, at most about r –1 of outputs will exceed r n–1. So, for a 16-bit architecture, and limited smartcard life, the overflow bit is too rare to be of use in power analysis. One could safely re-introduce a conditional subtraction here to avoid the need for extra hardware.

RSA 2002C.D. Walter, UMIST14 Exponentiation We end by noting that no final subtraction is needed in the case of MMM exponentiation: To compute T e mod M, pre-processing generates Tr n mod M so that subsequent multiplications are all larger than from standard modular multiplication by a factor of r n mod M. The output is therefore A = T e r n mod M. Post-processing removes the extra factor r n by an MMM multiplication by 1. The output is bounded above by M + Ar –n where A < 2M < ½r n. So the output is  M. Of course, equality with M is impossible, since that could only arise from T = 0 which would result in output 0. So no final modular reduction is needed for exponentiation.

RSA 2002C.D. Walter, UMIST15 Conclusion Precise output bounds have been obtained for Montgomery Modular Multiplication. This gives I/O bounds for MMM in the context of exponentiation when the final conditional subtraction is omitted. All numbers have the same word size as the modulus M when 4M  r n and M has n words. Otherwise, MMM must perform another iteration, but overflow bits are then too rare to be in danger from power analysis attacks. No final modular subtraction is required for exp n.