Presentation is loading. Please wait.

Presentation is loading. Please wait.

6. Practical Constructions of Symmetric-Key Primitives

Similar presentations


Presentation on theme: "6. Practical Constructions of Symmetric-Key Primitives"โ€” Presentation transcript:

1 6. Practical Constructions of Symmetric-Key Primitives
CIS Cryptography 6. Practical Constructions of Symmetric-Key Primitives Based on: Jonathan Katz and Yehuda Lindell Introduction to Modern Cryptography

2 Stream ciphers A stream cipher is a pair of deterministic algorithms (Init, GetBits), where Init takes input a seed ๐‘  and an optional ๐ผ๐‘‰ and outputs an initial state ๐‘ ๐‘ก 0 . That is, ๐‘ ๐‘ก 0 := Init (๐‘ ,๐ผ๐‘‰) GetBits takes as input ๐‘ ๐‘ก ๐‘– and outputs a bit ๐‘ฆ ๐‘– and an updated state ๐‘ ๐‘ก ๐‘–+1 . That is, (๐‘ฆ ๐‘– , ๐‘ ๐‘ก ๐‘– ) := GetBits( ๐‘ ๐‘ก ๐‘–โˆ’1 ), ๐‘–=1,2, . . .

3 Linear Feedback Shift Registers (LFSR)
(๐‘›=5) ๏ƒ… ๏ƒ… ๐‘  3 x ๐‘  4 ๐‘  3 x ๐‘  3 ๐‘  3 x ๐‘  2 ๐‘  3 x ๐‘  1 ๐‘  3 x ๐‘  0 ๐‘  ๐‘– ๐‘ก+1 := ๐‘  ๐‘–+1 ๐‘ก , ๐‘–=0,โ€ฆ, ๐‘›โˆ’2 ๐‘  ๐‘›โˆ’1 ๐‘ก+1 := ๏ƒ… ๐‘–=0 ๐‘›โˆ’1 ๐‘ ๐‘– ๐‘  ๐‘– ๐‘ก Output: ๐‘ฆ ๐‘– = ๐‘  ๐‘–โˆ’1 ๐‘ก , ๐‘ก=1,โ€ฆ, ๐‘›, ๐‘–=๐‘ก ๐‘ฆ ๐‘– = ๏ƒ… ๐‘—=0 ๐‘›โˆ’1 ๐‘ ๐‘— ๐‘ฆ ๐‘–โˆ’๐‘›+๐‘—โˆ’1 , ๐‘–>๐‘›

4 Reconstruction attacks
Solve for unknowns: ๐‘ 0 , , ๐‘ ๐‘›โˆ’1 So we must use nonlinear feedback ๐‘ฆ ๐‘›+1 = ๐‘ ๐‘›โˆ’1 ๐‘ฆ ๐‘› ๏ƒ… โ‹ฏ ๏ƒ… ๐‘ 0 ๐‘ฆ 1 โ‹ฎ ๐‘ฆ 2๐‘› = ๐‘ ๐‘›โˆ’1 ๐‘ฆ 2๐‘›โˆ’1 ๏ƒ… โ‹ฏ ๏ƒ… ๐‘ 0 ๐‘ฆ ๐‘› ๐‘  ๐‘– ๐‘ก+1 := ๐‘  ๐‘–+1 ๐‘ก , ๐‘–=0,โ€ฆ, ๐‘›โˆ’2 ๐‘  ๐‘›โˆ’1 ๐‘ก+1 := ๐‘”(๐‘  0 ๐‘ก , , ๐‘  ๐‘›โˆ’1 ๐‘ก ), some nonlinear function ๐‘”

5 Self-shrinking generator
The self-shrinking generator uses alternating output bits of a single register to control its final output. Clock two bits from the LFSR. If the pair is 10 output a zero. If the pair is 11 output a one. Otherwise, output nothing. Return to step one.

6 Self-shrinking generator, Example
Use polynomial: x8 + x4 + x3 + x2 + 1 Initial state: t 8 7 6 5 4 3 2 1 Out1 Out2 n/a

7 Other nonlinear stream ciphers
Trivium, eSTREAM project --see textbook These are hardware implementations of PRNG Next we shall consider a software implementation.

8 RC4 Init for RC4 (key scheduling) Algorithm 6.1 Input 16 byte key ๐‘˜
Output Initial state (๐‘†,๐‘–,๐‘—), ๐‘† is a permutation of 0, ,255, ๐‘–, ๐‘— ๐œ– {0, , 255} for ๐‘–=0 to 255 ๐‘† ๐‘– โ‰”๐‘–, ๐‘˜ ๐‘– โ‰”๐‘˜[๐‘– ๐‘š๐‘œ๐‘‘ 16] ๐‘— โ‰”0 ๐‘—โ‰”๐‘—+๐‘† ๐‘– +๐‘˜[๐‘–] Swap ๐‘†[๐‘–] and ๐‘† ๐‘— Return ๐‘†,๐‘–,๐‘—

9 RC4 GetBits for RC4 (Algorithm 6.2) Input: (๐‘†,๐‘–,๐‘—)
Output: byte y, updated state (๐‘†,๐‘–,๐‘—) ๐‘– โ‰”๐‘–+1 ๐‘— โ‰”๐‘—+๐‘† ๐‘– Swap ๐‘†[๐‘–] and ๐‘† ๐‘— ๐‘ก โ‰”๐‘† ๐‘– +๐‘†[๐‘—] ๐‘ฆ โ‰”๐‘†[๐‘ก] Return ๐‘†,๐‘–,๐‘— , ๐‘ฆ ๐‘ฆ

10 Attacks on RC4 There are several attacks on RC4 known for some time and therefore this stream cipher should not be used anymore. A serious attack occurs when an IV is prepended to the to the key. This attack can be used to recover the key (regardless of it length) This attack was used to break the WEP encryption standard, and was influential in getting the standard replaced---see textbook for details of the attack.

11 Block ciphers A block cipher is an efficient keyed permutation
๐น :{0,1 } ๐‘› ร—{0,1 } ๐‘™ โ†’{0,1 } ๐‘™ ๐น ๐‘˜ ๐‘ฅ โ‰๐น(๐‘˜,๐‘ฅ) is a bijection, and ๐น ๐‘˜ and its inverse ๐น ๐‘˜ โˆ’1 are efficiently computable given ๐‘˜. Block ciphers should be viewed as pseudorandom permutations rather than as encryption schemes. They are a basic building blocks for symmetric key applications.

12 Block ciphers We refer to ๐‘› as the key length and ๐‘™ as the block length of ๐น. These are now constants (fixed) whereas earlier they where functions of the security parameter. This takes us away from the asymptotic security to concrete security.

13 Substitution-Permutation Networks
A block cipher must behave like a random permutation. However there are 2 ๐‘™ ! permutations on ๐‘™-bit strings, so representing an arbitrary permutation with block length ๐‘™ requires roughly log ( 2 ๐‘™ !)โ‰ˆ ๐‘™โˆ™ 2 ๐‘™ bits. Thus, we need to somehow construct a concise function that behaves like a random function

14 The confusionโˆ’diffusion paradigm
Idea (Shannon): construct a random looking permutation ๐น with large block length using smaller random looking substitutions { ๐‘“ ๐‘– } with small length. A substitution-permutation network is an implementation of this paradigm.

15 The confusionโˆ’diffusion paradigm
The substitution component refers to small random functions ๐‘“ ๐‘– called S-boxes and the permutation component refers to the mixing of the outputs of the random functions. The permutation component involves the reordering of the output bits and are called mixing permutations.

16 The confusionโˆ’diffusion paradigm An example, 1
Suppose we want ๐น to have block length 128 bits, and use 16 substitutions ๐‘“ 1 , .. . , ๐‘“ 16 that have block length 8 bits. The key ๐‘˜ will specify the 16 substitutions. For input ๐‘ฅโˆˆ{0,1 } 128 we parse ๐‘ฅ as ๐‘ฅ 1 , โ€ฆ, ๐‘ฅ 16 and set ๐น ๐‘˜ ๐‘ฅ = ๐‘“ 1 ๐‘ฅ 1 || โ‹ฏ ||๐‘“ 16 ๐‘ฅ 16 The โ€œroundโ€ functions { ๐‘“ ๐‘– } are said to introduce confusion.

17 The confusionโˆ’diffusion paradigm An example, 2
A diffusion step then mixes the bits of the output. For example the bits of ๐น ๐‘˜ ๐‘ฅ are shuffled to get ๐‘ฅโ€ฒ. The confusion-diffusion process is repeated several times A substitution-permutation network is an implementation of this paradigm.

18 The confusionโˆ’diffusion paradigm An example, 3
Consider an SPN network with 64 bit block length and 8 bit ๐‘†-boxes, ๐‘† 1 , โ€ฆ, ๐‘† 8 . Evaluating the cipher proceeds in a number of rounds in which: Key mixing: set ๐‘ฅโ‰”๐‘ฅ ๏ƒ… ๐‘˜, where ๐‘˜ is the current โ€œround sub-keyโ€. Substitution: set ๐‘ฅโ‰” ๐‘† 1 ( ๐‘ฅ 1 )||โ‹ฏ|| ๐‘† 8 ๐‘ฅ 8 . Permutation: Permute the bits of ๐‘ฅ to get the output for the next round.

19 Substitution-permutation network Example 3, single round

20 The confusionโˆ’diffusion paradigm
The basic idea is to break the input up into small parts and then feed these parts through different S-boxes (random permutations). The outputs are then mixed together. The process is repeated a given number of times, called a rounds. The S-boxes introduce confusion into the construction. In order to spread the confusion throughout, the results are mixed together, achieving diffusion.

21 Any SPN is invertible (given the key)
It suffices to invert each round. Given the SPN output for a round and the key we: First invert the mixing permutation Then invert the ๐‘†-box permutations Finally XOR the result with the appropriate sub-key to get the round input.

22 The avalanche effect An important property in any block cipher is that small changes to the input must result in large changes to the output. To ensure this, block ciphers are designed so that small changes in the input propagate quickly to very large changes in the intermediate values.

23 The avalanche effect It is easy to demonstrate that the avalanche effect holds in a substitution-permutation network, when the following hold: The ๐‘†-boxes are designed so that any change of at least a single bit to the input to an ๐‘†-box results in a change of at least two bits in the output. The mixing permutations are designed so that the output bits of any given ๐‘†-box are spread into different ๐‘†-boxes in the next round.

24 Feistel Networks A Feistel* network is an alternative way of constructing a block cipher. The low-level building blocks (S-boxes, mixing permutations and key schedule) are the same. The difference is in the high-level design. The advantage of Feistel networks over substitution permutation networks is that they enable the use of S-boxes that are not necessarily invertible. * Horst Feistel who did pioneering research while working for IBM

25 Feistel Networks This is important because a good block cipher has chaotic behavior (it should look random). Requiring that all of the components of the construction be invertible inherently introduces structure, which contradicts the need for chaos.

26 Feistel Networks A Feistel network is thus a way of constructing an invertible function from non-invertible components. This seems like a contradiction in terms---if you cannot invert the components, how can you invert the overall structure. Nevertheless, the Feistel design ingeniously overcomes this obstacle.

27 A Feistel network For input ๐‘ฅ, denote by ๐‘ฅ 1 and ๐‘ฅ 2 the first and second halves of ๐‘ฅ respectively. Let ๐‘ฃ 1 = ๐‘ฅ 1 and ๐‘ฃ 2 = ๐‘ฅ 2 . For ๐‘–=1 to ๐‘Ÿ (where ๐‘Ÿ is the number of rounds in the network): Let ๐‘ค 1 = ๐‘ฃ 2 and ๐‘ค 2 = ๐‘ฃ 1 ๏ƒ… ๐‘“ ๐‘– ( ๐‘ฃ 2 ), where ๐‘“ ๐‘– denotes the ๐‘“-function in the ๐‘–-th round of the network. Let ๐‘ฃ 1 = ๐‘ค 1 and ๐‘ฃ 2 = ๐‘ค 2 . The output ๐‘ฆ is (๐‘ฃ 1 , ๐‘ฃ 2 ).

28 Feistel Network . mmm mm m


Download ppt "6. Practical Constructions of Symmetric-Key Primitives"

Similar presentations


Ads by Google