algebraic s-box recovery: the case of cryptomeria

34
Algebraic S-Box Recovery: the case of Cryptomeria Cryptographers follow Kerckhoffs’ principle, unless they don't. Ralf-Philipp Weinmann <[email protected]> Echternach Seminar on Symmetric Cryptography, Echternach, Luxembourg 2008-01-11 1

Upload: others

Post on 28-Apr-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algebraic S-Box Recovery: the case of Cryptomeria

Algebraic S-Box Recovery: the case of Cryptomeria

Cryptographers follow Kerckhoffs’ principle, unless they don't.

Ralf-Philipp Weinmann

<[email protected]>

Echternach Seminar on Symmetric Cryptography,Echternach, Luxembourg2008-01-11

1

Page 2: Algebraic S-Box Recovery: the case of Cryptomeria

Background

• CPRM/CPPM: Content Protection for Recordable / Pre-Recorded Media

• “The CPRM / CPPM Specification defines a renewable cryptographic method

for protecting entertainment content when recorded on physical media.”

• Uses proprietary block cipher, Cryptomeria (a.k.a. C2)

• Well, not quite proprietary... Design is public, S-Boxes are TRADE SECRETS

• This talk aims at improving interoperability... ;)

2

Page 3: Algebraic S-Box Recovery: the case of Cryptomeria

Quote of the day

“The 4C companies designed and adopted C2,

despite general cryptographic design principles which

encourage use of well-known and well-evaluated

ciphers, since no well-known alternatives had been

identified that provided the necessary balance between

suitability of hardware and software implementation,

minimal licensing fees, and the ability to exclusively

license C2 for use in 4C content protection solutions.

This last attribute is particularly important, as

circumvention of the 4C technologies will likely require

use of the C2 cipher algorithm, which must be licensed

from 4C’’

3

Page 4: Algebraic S-Box Recovery: the case of Cryptomeria

DVD-Audio

• DRM measure broken in 2004: Nero implemented C2 in software

• Result: DVD-Audio discs can be freely copied

4

Page 5: Algebraic S-Box Recovery: the case of Cryptomeria

DVD-Audio

• DRM measure broken in 2004: Nero implemented C2 in software

• Result: DVD-Audio discs can be freely copied

4

Page 6: Algebraic S-Box Recovery: the case of Cryptomeria

Video DVD-R’s and Japanese HDTV

• Japanese distributed cracking effort in 2004 that tried the DVD Audio S-Box

in a key recovery: FAILED

• S-Box reverse-engineered from software only recently (approx. July 2007)

• Different S-Box used

5

Page 7: Algebraic S-Box Recovery: the case of Cryptomeria

SD-Cards...

• Nothing known yet

• My guess: uses

different S-Box as

well.

6

Page 8: Algebraic S-Box Recovery: the case of Cryptomeria

... contain more than meets the eye

No, I didn’t pry that open myself, the picture is actually from Wikipedia7

Page 9: Algebraic S-Box Recovery: the case of Cryptomeria

... contain more than meets the eye

SD-card

controller

No, I didn’t pry that open myself, the picture is actually from Wikipedia7

Page 10: Algebraic S-Box Recovery: the case of Cryptomeria

... contain more than meets the eye

NAND-

Flash

No, I didn’t pry that open myself, the picture is actually from Wikipedia7

Page 11: Algebraic S-Box Recovery: the case of Cryptomeria

Standard for SD card quite recent

• November 29, 2007 - The 4C Entity, LLC is pleased to announce that

licensing for a new CPRM Specification, SD Memory Card: SD-Separate

Delivery Video Part (SD-SD Video), Revision 0.9

• September 25, 2007 - The 4C Entity, LLC is pleased to announce that a white

paper entitled "SDSD-CPRM: Flexible Protection for Content Protection" is

now available. SDSD-CPRM (Secure Digital - Separate Delivery) is a new

extension to the SD Memory Card that addresses the difficulties of sharing

and protecting digital content.

8

Page 12: Algebraic S-Box Recovery: the case of Cryptomeria

9

Page 13: Algebraic S-Box Recovery: the case of Cryptomeria

the cipher

9

Page 14: Algebraic S-Box Recovery: the case of Cryptomeria

The Cryptomeria cipher

• Feistel structure (modular addition)

• 64-bit block size

• 56 bit key

• 10 rounds

• key mixing: modular addition

x'0

x'1

x'2

x'3

SBox

<<< 1

<<< 5

x''0

x''1

x''2

x''3

<<< 2

0xca

0x65

0x27

X''

<<< 9 <<< 22

X'

X

RKi

Y

10

Page 15: Algebraic S-Box Recovery: the case of Cryptomeria

Observations on the cipher

x'0

x'1

x'2

x'3

SBox

<<< 1

<<< 5

x''0

x''1

x''2

x''3

<<< 2

0xca

0x65

0x27

X''

<<< 9 <<< 22

X'

X

RKi

Y

• S-Box used only once per round

• All bytes of the output word affected

by S-Box

• but... diffusion is not good

• combination of XOR and modular

addition makes things interesting

11

Page 16: Algebraic S-Box Recovery: the case of Cryptomeria

Cryptomeria key scheduling

• 56-bit cipher key K

• T(X) = (X[24..55] + (S(X[0..7]) << 4)) mod 232

• i-th round key: Rki = T((K <<< 17i) XOR i)

12

Page 17: Algebraic S-Box Recovery: the case of Cryptomeria

Objective

• recover S-Box

• brute-force: 256! ! 21684 (assumption: S-Box bijective)

• using encryption oracle, chosen-key attack scenario

• don’t want to use side-channel attacks!

• can’t use SASAS attack, too many rounds for that

13

Page 18: Algebraic S-Box Recovery: the case of Cryptomeria

Chosen-key attacks

• First (and only) chosen-key attack proposed by Saarinen against the

"#$% (GOST) 28147-89 block cipher (1998, unpublished)

• technique uses fixed points, takes advantage of weak key schedule: cannot

be used in our case

14

Page 19: Algebraic S-Box Recovery: the case of Cryptomeria

15

Page 20: Algebraic S-Box Recovery: the case of Cryptomeria

the idea

15

Page 21: Algebraic S-Box Recovery: the case of Cryptomeria

Strategy for an attack

• Merge two worlds: differential attacks and algebraic cryptanalysis

• reduce number of different (!) active S-Boxes by differential methods

• set up system of equations, S-Box outputs are unknowns (key variables)

• chosen-key model, allows to minimize S-Boxes in key schedule

• 5 S-Boxes are different for each pair in set of p/c pairs

16

Page 22: Algebraic S-Box Recovery: the case of Cryptomeria

S-Boxes in the key schedule

• Enumerate all possible combinations for less than 5 S-Boxes

• Solve large (> 106) number of small linear systems (56 vars)

• 210 keys which only trigger 4 S-Boxes

• Optimal: not possible to trigger less than 4 S-Boxes

17

Page 23: Algebraic S-Box Recovery: the case of Cryptomeria

Differentials for the cipher

• useful differentials:

!1 = 00 00 00 00 00 00 00 80

!2 = 00 00 00 00 80 00 00 00

• for p, (p!!1), (p!!2) the same S-boxes will be triggered in first 4 rounds

• carry bits need to be taken into account

• filtering on the lowest-most 8 bits of ciphertext

• assures same S-Box is used in last round

• approximately 216 trials needed

18

Page 24: Algebraic S-Box Recovery: the case of Cryptomeria

1

2

3

4

5

6

7

8

9

10

21

21

21

21

22

23

24

22

22

23

plaintext #1 plaintext #2 plaintext #3 key schedule

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

11

12

13

14

15

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

16

17

18

19

20

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

Schematics of the idea

19

Page 25: Algebraic S-Box Recovery: the case of Cryptomeria

1

2

3

4

5

6

7

8

9

10

21

21

21

21

22

23

24

22

22

23

plaintext #1 plaintext #2 plaintext #3 key schedule

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

11

12

13

14

15

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

16

17

18

19

20

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

Schematics of the idea

19

Page 26: Algebraic S-Box Recovery: the case of Cryptomeria

1

2

3

4

5

6

7

8

9

10

21

21

21

21

22

23

24

22

22

23

plaintext #1 plaintext #2 plaintext #3 key schedule

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

11

12

13

14

15

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

1

2

3

4

16

17

18

19

20

10

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

+ F

Ki

Schematics of the idea

19

Page 27: Algebraic S-Box Recovery: the case of Cryptomeria

20

Page 28: Algebraic S-Box Recovery: the case of Cryptomeria

algebraization

20

Page 29: Algebraic S-Box Recovery: the case of Cryptomeria

The equation systems

• multivariate quadratic system

• if cipher did not use modular addition:

• solve linear system & be finished

• modular addition results in carry chains

• systems composed of modular addition, register-wise logical operations and

bit-shifts: common in symmetric cryptography

• MD4/5, SHA-1, SHA-256/384/512 [hash functions]

TEA, Michael (WPA) [block ciphers]

Helix/Phelix, SALSA20 [stream ciphers]

21

Page 30: Algebraic S-Box Recovery: the case of Cryptomeria

Systems for modular addition (mod 2n)

• addition in round function: full addition of two 32 bit values

addition in the key schedule: a 12-bit quantity + 32-bit quantity.

Assume upper 19 carry bits to be zero.

• each full addition introduces 32 variables for the result and 31 carry variables.

z1 = x1 + y1

c1 = x1y1

z2 = x2 + y2 + c1

c2 = x2y2 + c2x2 + c2y2

.

.

....

zn = xn + yn + cn−1

22

Page 31: Algebraic S-Box Recovery: the case of Cryptomeria

Strategies

• variables can be guessed to “break” carry chains

• important which variables are guessed

• talk by Gregory Bard at Fq8 Conference (Deakin University) this year:(On the Connection Number of a Particular Graph of a Polynomial System of Equations over a Finite Field)

• optimal guessing for MQ systems: indications for NP-hard problem

• optimal guessing not needed, heuristics are “good enough”

23

Page 32: Algebraic S-Box Recovery: the case of Cryptomeria

Results

• equation systems for 4 rounds (5 different S-Boxes, 2 p/c pairs):

easily broken with COTS software (Magma) without guessing:

142MB, 22secs on Opteron 2218 (2.6GHz, 1MB L2 cache)

[1036 equations, 944 variables]

• equation system for up to 8 rounds (18 S-Boxes, 3 p/c pairs)

broken given enough memory and guessing (6 variables):

20GB used, 15h on HHLR (per iteration) for 8 rounds

[2816 equations, 2652 variables]

• 10 rounds are close. New tricks needed? (PolyBoRi?)

24

Page 33: Algebraic S-Box Recovery: the case of Cryptomeria

Acknowledgements / Thanks

• John Gilmore for bringing up the cipher

• Ulrich Kühn for looking at Cryptomeria with me in Dagstuhl

• Jintai Ding for the combinatorial idea for the key schedule

• You! For listening to my talk.

25

Page 34: Algebraic S-Box Recovery: the case of Cryptomeria

Questions?

26