Protection of cryptographic keys recodings against physical attacks - - PowerPoint PPT Presentation

β–Ά
protection of cryptographic keys
SMART_READER_LITE
LIVE PREVIEW

Protection of cryptographic keys recodings against physical attacks - - PowerPoint PPT Presentation

Protection of cryptographic keys recodings against physical attacks Supervisor: Author: Simon RASTIKIAN Arnaud TISSERAND 2 = 3 PLAN Introduction Elliptic Curve Cryptography Side Channel Attacks


slide-1
SLIDE 1

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Protection of cryptographic keys recodings against physical attacks

Author: Simon RASTIKIAN Supervisor: Arnaud TISSERAND

slide-2
SLIDE 2

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

PLAN

  • Introduction
  • Elliptic Curve Cryptography
  • Side Channel Attacks
  • Application
slide-3
SLIDE 3

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Introduction

  • Public-key cryptography conceived by W. Diffie & M. Hellman.
  • Then comes RSA.
  • Then ECC by N. Koblitz & V. Miller basing their schemes on ECDLP.
  • What about security?
slide-4
SLIDE 4

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Elliptic Curve Cryptography

  • An elliptic curve over a field K is defined by the Weierstrass equation [1]

E: 𝑧2 + 𝑏1𝑦𝑧 + 𝑏3𝑧 = 𝑦3 + 𝑏2𝑦2 + 𝑏4𝑦 + 𝑏6 Where 𝑏1, 𝑏2, 𝑏3, 𝑏4, 𝑏6 ∈ 𝐿 π‘π‘œπ‘’ Ξ” β‰  0 Ξ” = βˆ’π‘’2

2𝑒8 βˆ’ 8𝑒4 3 βˆ’ 27𝑒6 2 + 9𝑒2𝑒4𝑒6

𝑒2 = 𝑏1

2 + 4𝑏_2

𝑒4 = 2𝑏4 + 𝑏1𝑏3 𝑒6 = 𝑏3

2 + 4𝑏6

𝑒8 = 𝑏1

2𝑏6 + 4𝑏2𝑏6 βˆ’ 𝑏1𝑏3𝑏4 + 𝑏2𝑏3 2 βˆ’ 𝑏4 2

slide-5
SLIDE 5

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Elliptic Curve Cryptography

  • 𝐹1, 𝐹2 are isomorphic over K if βˆƒπ‘£, 𝑠, 𝑑, 𝑒 ∈ 𝐿 π‘₯π‘—π‘’β„Ž 𝑣 β‰  0 such that

[1]: Ξ¦ ∢ 𝐿2 β†’ 𝐿2 Transforms equation 𝐹1 into equation 𝐹2. 𝑦, 𝑧 β†’ (𝑣2𝑦 + 𝑠, 𝑣3𝑧 + 𝑣2𝑑𝑦 + 𝑒)

slide-6
SLIDE 6

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Elliptic Curve Cryptography

Over prime fields Fp p > 3 : y2 = x3 + ax + b where a, b ∈ K Ξ” = βˆ’16 (4a3 + 27b2) Over binary fields F2𝑛: If 𝑏1 β‰  0 then 𝑧2 + 𝑦𝑧 = 𝑦3 + 𝑏𝑦2 + 𝑐 π‘₯β„Žπ‘“π‘ π‘“ 𝑏, 𝑐 ∈ 𝐿 Ξ” = 𝑐 If 𝑏1 = 0 then 𝑧2 + 𝑑𝑧 = 𝑦3 + 𝑏𝑦 + 𝑐 π‘₯β„Žπ‘“π‘ π‘“ 𝑏, 𝑐, 𝑑 ∈ 𝐿 Ξ” = 𝑑4 Over optimal extension fields F3𝑛: If 𝑏1

2 β‰  βˆ’π‘2 then 𝑧2 = 𝑦3 + 𝑏𝑦2 + 𝑐 π‘₯β„Žπ‘“π‘ π‘“ 𝑏, 𝑐 ∈ 𝐿

Ξ” = βˆ’π‘3𝑐 If 𝑏1

2 = βˆ’π‘2 then 𝑧2 = 𝑦3 + 𝑏𝑦

+ 𝑐 π‘₯β„Žπ‘“π‘ π‘“ 𝑏, 𝑐 ∈ 𝐿 Ξ” = βˆ’π‘3

slide-7
SLIDE 7

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Elliptic Curve Cryptography

  • Additive law +: 𝐹 𝐿 β†’ 𝐹(𝐿) defined by the chord-and-tangent rule

Point addition and point doubling on the curve 𝑧2 = 𝑦3 βˆ’ 𝑦 + 1 defined over R [5].

slide-8
SLIDE 8

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Mathematically βˆ€π‘„, 𝑅 ∈ 𝐹(𝐿) :

1. Identity : 𝑄 + ∞ = ∞ + 𝑄 = 𝑄 2. Negative : βˆ’π‘„ = βˆ’ 𝑦, 𝑧 = 𝑦, βˆ’π‘§ and 𝑦, 𝑧 + 𝑦, βˆ’π‘§ = ∞ 3. Point addition : 𝑄 = 𝑦1, 𝑧1 , 𝑅 = 𝑦2, 𝑧2 π‘π‘œπ‘’ 𝑄 β‰  ±𝑅 π‘’β„Žπ‘“π‘œ 4. Point doubling : if 𝑄 β‰  βˆ’π‘„ then 2 𝑄 = 𝑦3, 𝑧3 where

Elliptic Curve Cryptography

𝑄 + 𝑅 = 𝑦3, 𝑧3 π‘₯β„Žπ‘“π‘ π‘“ 𝑦3 =

𝑧2βˆ’π‘§1 𝑦2βˆ’π‘¦1 2

and 𝑧3 =

𝑧2βˆ’π‘§1 𝑦2βˆ’π‘¦1

𝑦1 βˆ’ 𝑦3 βˆ’ 𝑧1 𝑦3 =

3𝑦1+𝑏 2𝑧1 2

βˆ’ 2𝑦1 and 𝑧3 =

3𝑦1

2+𝑏

2𝑧1

𝑦1 βˆ’ 𝑦3 βˆ’ 𝑧1

slide-9
SLIDE 9

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Let E be an elliptic curve defined over Fp . Suppose P ∈ 𝐹(Fp) has a prime

  • rder n.

<P>={∞,P, 2P, …, (n-1) P} is a cyclic group. ECDLP: Key pair generation: Given E, p, P, n (public parameter). Choose random integer k in [1,n-1] (secret key). Compute Q=kP. ECDLP problem : Given E, p, P, n (public) and Q=kP. Find k (secret key).

Elliptic Curve Cryptography

slide-10
SLIDE 10

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • No sub-exponential complexity algorithm for solving ECDLP.
  • Pollard’s rho attack and Shanks attack solve it in Ο(βˆšπ‘œ).

Elliptic Curve Cryptography

Symmetric key size (bits) RSA and DH key size (bits) ECC key size (bits) 80 (SKIPJACK ) 1024 160 112 (Triple-DES) 2048 224 128 (AES-Small) 3072 256 192 (AES-Medium) 7680 384 256 (AES-Large) 15360 521 NIST comparision of ECC, RSA and DH key for different security requierements.

slide-11
SLIDE 11

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Projective coordinates: c,d postitive integers .

An equivalence relation on the set 𝐿3\{(0,0,0)} noted as π‘Œ1, 𝑍

1, π‘Ž1 ~(π‘Œ2, 𝑍 2, π‘Ž2) exists if π‘Œ1 = πœ‡π‘‘π‘Œ2, 𝑍 1 = πœ‡π‘’π‘ 2, π‘Ž1 = πœ‡π‘Ž2 𝑔𝑝𝑠 πœ‡ ∈ πΏβˆ—

The projective point is the representative class π‘Œ: 𝑍: π‘Ž = {(πœ‡π‘‘π‘Œ, πœ‡π‘’π‘, πœ‡π‘Ž)|πœ‡ ∈ πΏβˆ—} 1-1 correspondance between the projective points such that π‘Ž β‰  0 and the affine points.

Elliptic Curve Cryptography

slide-12
SLIDE 12

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Several projective coordinates :
  • 1. Standard projective coordinates (c=1 and d=1): (X,Y,Z) with π‘Ž β‰  0

corresponds to the affine point (

π‘Œ π‘Ž , 𝑍 π‘Ž) and (0:1:0) to ∞

  • 2. Jacobian projective coordinates (c=2 and d=3): (X,Y,Z) with π‘Ž β‰  0

corresponds to the affine point(

π‘Œ π‘Ž2 , 𝑍 π‘Ž3) and (1:1:0) to ∞.

  • 3. Chudnovsky coordiates: The Jacobian point is represented with redundancy

(X:Y:Z:ZΒ²:ZΒ³)

Elliptic Curve Cryptography

slide-13
SLIDE 13

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Side Channel Attacks

  • Making assumption about the knowledge that an attacker has about the

security.

  • It is best to make stronger assumption than Kerckhoff’s principle.
  • Electronic circuits are enherently leaky.
slide-14
SLIDE 14

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Power analysis attack is the observation and the study of the power

consuption of the cryptegraphic device.

  • Two types of power analysis attacks are well-known:
  • 1. Simple power attack (SPA): Visual examination of graphs of the current

used by a device overtime. Small number of power traces is needed.

  • 2. Differential power attack (DPA): Does not require detailed knowledge

about the device. It is a statistical analysis of the power consumption measurements from a cyptosystem. Large number of power traces is needed.

Side Channel Attacks

slide-15
SLIDE 15

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • How to compute Q=kP?
  • Classical algorithm : Double-and-Add

Side Channel Attacks

Input : 𝑙 = π‘™π‘œβˆ’1π‘™π‘œβˆ’2 … 𝑙0 , 𝑄 ∈ 𝐹(Fπ‘ž) Output: Q=kP 𝑅 ← ∞ For i form n-1 to 0 do Q ← 2 𝑅 (DBL) If ki = 1 then 𝑅 ← 𝑅 + 𝑄 (ADD)

slide-16
SLIDE 16

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Side Channel Attacks

Power consumption measure of Double-and-Add algorithm from left to right coded on FPGA [5].

slide-17
SLIDE 17

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

In Jacobian coordinates ADD = 12 M + 4 S DBL = 4M + 4S

Side Channel Attacks

Power consumption measure of Double-and-Add algorithm from left to right coded on FPGA [5].

slide-18
SLIDE 18

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

In Jacobian coordinates ADD = 12 M + 4 S DBL = 4M + 4S

Side Channel Attacks

Power consumption measure of Double-and-Add algorithm from left to right coded on FPGA [5].

slide-19
SLIDE 19

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • NAF algorithms coded in C language.
  • w-NAF algorithm for point multiplication ressembles to Double-and-Add but

with different secret key representation.

  • Subtracting a point is easy beacause -(X,Y,Z) = (X,-Y,Z).
  • A width-w NAF of k is the expression 𝑙 = 𝑗=0

π‘šβˆ’1 𝑙𝑗2𝑗 π‘₯β„Žπ‘“π‘ π‘“ 𝑙𝑗 < 2π‘₯βˆ’1 and

𝑙𝑗 are either odd or zero except π‘™π‘šβˆ’1 β‰  0. At most one of any consecutive digits is nonzero.

  • Unique representation given k and w noted 𝑂𝐡𝐺

π‘₯(𝑙).

  • π‘€π‘“π‘œπ‘•π‘’β„Ž 𝑂𝐡𝐺

π‘₯ 𝑙

= Length k + 1

Side Channel Attacks

slide-20
SLIDE 20

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Width-w NAF algorithm:

Side Channel Attacks

Input: k positive integer, w Output: 𝑂𝐡𝐺

π‘₯ 𝑙

𝑗 ← 0 While 𝑙 β‰₯ 0 do : if k is odd then 𝑙𝑗 ← 𝑙 𝑛𝑝𝑒𝑑 2π‘₯, 𝑙 ← 𝑙 βˆ’ 𝑙𝑗 else 𝑙𝑗 ← 0 𝑙 ←

𝑙 2 , 𝑗 ← i + 1

Return 𝑂𝐡𝐺

π‘₯ 𝑙 = (π‘™π‘—βˆ’1… 𝑙0)

mods is a function that keeps 𝑙𝑗 ∈ βˆ’2π‘₯βˆ’1 , 2π‘₯βˆ’1 βˆ’ 1

slide-21
SLIDE 21

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Window NAF method for point multiplication algorithm:

Side Channel Attacks

Input: k positive integer, w, 𝑄 ∈ 𝐹 Fπ‘Ÿ Output: 𝑙𝑄 Calculate 𝑂𝐡𝐺π‘₯ 𝑙 Compute and store all 𝑄

𝑗 = 𝑗𝑄 βˆ€π‘— 𝑝𝑒𝑒 π‘π‘œπ‘’ 𝑗 < 2π‘₯βˆ’1

𝑅 ← ∞ For i from l-1 downto 0 do : 𝑅 ← 2𝑅 if 𝑙𝑗 β‰  0 then if 𝑙𝑗 > 0 then 𝑅 ← 𝑅 + 𝑄𝑙𝑗 else 𝑅 ← 𝑅 βˆ’ π‘„βˆ’π‘™π‘—

slide-22
SLIDE 22

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Window NAF method for point multiplication algorithm:

Side Channel Attacks

Input: k positive integer, w, 𝑄 ∈ 𝐹 Fπ‘Ÿ Output: 𝑙𝑄 Calculate 𝑂𝐡𝐺π‘₯ 𝑙 Compute and store all 𝑄

𝑗 = 𝑗𝑄 βˆ€π‘— 𝑝𝑒𝑒 π‘π‘œπ‘’ 𝑗 < 2π‘₯βˆ’1

𝑅 ← ∞ For i from l-1 downto 0 do : 𝑅 ← 2𝑅 if 𝑙𝑗 β‰  0 then if 𝑙𝑗 > 0 then 𝑅 ← 𝑅 + 𝑄𝑙𝑗 else 𝑅 ← 𝑅 βˆ’ π‘„βˆ’π‘™π‘—

  • Faster computation of kP.
  • Is it safe against SPA?
slide-23
SLIDE 23

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Cryptographic device STM32L053R8 Nucleo [3]
  • Make the led twinkle.

Side Channel Attacks

  • Ultra-Low power consumption platform.
  • Processor ARM 32-bit Cortex-M0+.
  • 64 Kbytes Flash.
  • 8Kbytes RAM.
  • 32MHz CPU.
  • 1 user led and 2 buttons.
  • Mbed Enabled.
  • Etc …
slide-24
SLIDE 24

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Measurement Setup: Digital Sampling Oscilloscope. [2]
  • Records the power consumption.
  • 3 characteristics :
  • Input Bandwidth: difference between the highest and the lowest frequency component.

1GHz

  • Sampling rate: Number of points recorded per second.
  • Resolution: conversion between time-discrete signal into time and value-discrete. 8bits

means each value is mapped to one of 256 possible value.

Side Channel Attacks

slide-25
SLIDE 25

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Application

  • πœˆπ‘‚π‘π·π‘š is an ongoing library made for ECC.
  • The core coded by P. Schwabe & M. Hutter.
  • The standalone Curve25519 implementation for ARM Cortex-M0 coded by B.

Haase & A. H. SΓ‘nchez.

  • Few problems at compilation that were surpassed.
slide-26
SLIDE 26

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Width-w NAF coded for keys of 255 bits and w between 2 and 8.
  • Basic operation used.
  • Some optimisation with the size of 𝑂𝐡𝐺

2 𝑙 .

Application

slide-27
SLIDE 27

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

slide-28
SLIDE 28

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Started coding window NAF method for point multiplication.
  • Noticed that Curve25519 coded in πœˆπ‘‚π‘π·π‘š has no Y projective coordinate.
  • No subtraction because -(X,Y,Z)=(X,-Y,Z).
  • Curve25519 is a Montgomery curve. [4]
  • Curve25519 is defined over the quadratic extension of the prime field

F 2255βˆ’19

Application

𝑁

𝐡,𝐢: 𝐢𝑧2 = 𝑦3 + 𝐡𝑦2 + 𝑦 π‘₯β„Žπ‘“π‘ π‘“ 𝐡, 𝐢 ∈ Fπ‘Ÿ π‘π‘œπ‘’ 𝐢 𝐡2 βˆ’ 4 β‰  0

𝐷𝑣𝑠𝑀𝑓25519: 𝑧2 = 𝑦3 + 486662𝑦2 + 𝑦

slide-29
SLIDE 29

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Montgomery coordinates (X:Z).
  • Try coding the radix-8 algorithm.
  • Non-possibility because of the use of differential addition.
  • Differential addition 𝑄 + 𝑅 requires the presence of 𝑄, 𝑅 π‘π‘œπ‘’ 𝑄 βˆ’ 𝑅.
  • On a Montgomery curve:
  • 𝑦𝑄+𝑅𝑦 π‘„βˆ’π‘…

𝑦𝑄 βˆ’ 𝑦𝑅

2 = 𝑦𝑄𝑦𝑅 βˆ’ 1 𝑗𝑔 𝑄 β‰  𝑅

  • 4𝑦 2 𝑄𝑦𝑄 𝑦𝑄

2 + 𝐡𝑦𝑄 + 1 = 𝑦𝑄 2 βˆ’ 1 2 𝑗𝑔 𝑄 = 𝑅

Application

slide-30
SLIDE 30

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • How to use the differential addition?
  • Secure Montgomery ladder algorithm:

Application

Input : 𝑙 = π‘™π‘šβˆ’1π‘™π‘šβˆ’2 … 𝑙0 π‘π‘œπ‘’ π‘™π‘šβˆ’1 = 1, 𝑄 ∈ 𝐹(Fπ‘ž) Output: kP 𝑅 = 𝑅0, 𝑅1 ← 𝑄, 2 𝑄 For i from l-2 to 0 do If ki = 1 then Q ← (𝑅0+𝑅1, 2 𝑅1) else Q ← ( 2 𝑅0, 𝑅0+𝑅1) Return 𝑅0

slide-31
SLIDE 31

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

  • Combining algorithms : working idea but w-1 additional point storing and w-1

additional point addition in each loop.

  • Example: width-2 NAF & Montgomery ladder algorithm:

Application

Input : 𝑙 = π‘™π‘šβˆ’1π‘™π‘šβˆ’2 … 𝑙0 π‘π‘œπ‘’ π‘™π‘šβˆ’1 = 1, 𝑄 ∈ 𝐹(Fπ‘ž) Output: kP Compute 𝑂𝐡𝐺2 𝑙 𝑅 = 𝑅0, 𝑅1, 𝑅2 ← 𝑄, 2 𝑄, ∞ For i form length(𝑂𝐡𝐺2 𝑙 )-2 to 0 do If ki = 1 then Q ← (𝑅0+𝑅1, 2 𝑅1, 𝑅2 + 𝑅1) elsif ki = 0 then Q ← ( 2 𝑅0, 𝑅0+𝑅1, 𝑅2 + 𝑅0) else Q ← (𝑅0 + 𝑅2, 𝑅1+𝑅2, [2]𝑅2) Return 𝑅0

slide-32
SLIDE 32

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

Thank you for your attentio ion

slide-33
SLIDE 33

𝑧2 = 𝑦3 βˆ’ 𝑦

𝑄 𝑆

References

  • [1] D. Hankerson, A. Menezes and S. Vanstone. Guide to Elliptic Curve Cryptography. Springer,

2004

  • [2] S. Mangard, E. Oswald and T. Popp. Power Analysis Attacks: Revealing the Secrets of

Smart Cards. Springer, 2007.

  • [3] STM32L053R8. URL: https://www.st.com/en/microcontrollers/stm32l053r8.html.
  • [4] C. Costello and B. Smith. Montgomery curves and their arithmetic: The case of large

characteristics fields. 2017. URL: https://arxiv.org/pdf/1703.01863.pdf.

  • [5] T. Chabrier. Arithmetic recodings for ECC cryptoprocessors with protection against side-

channel attacks. 2013. URL: https://www.theses.fr/174580924