Key Expansion

Requirements

Kalyna’s Key Scheduler is needed to be designed to satisfy the below requirements:


Properties

Block Size (b)(b)Key length (k)(k)Rounds (t)(t)Rows (c)(c)
128128128128101022
128128256256141422
256256256256141444
256256512512181844
512512512512181888

Algorithm

Key Scheduling

Intermediate Key (Kσ)(K_\sigma) Generation

Intermediate Constant (θ)(\theta)

θ=k+b+6464\theta = \frac{k +b + 64}{64}

Block Size - bb in bits

Key Size - kk in bits

Generation

Kσ=ψτπηbKαψτπκbKωψτπηb(Kα,θ)K_\sigma = \psi \circ \tau \circ \pi \circ \eta_b^{K_\alpha}\psi \circ \tau \circ \pi \circ \kappa_b^{K_\omega}\circ \psi \circ \tau \circ \pi \circ \eta_b^{(K_\alpha, \theta)}

ηb(Kα,θ)\eta_b^{(K_\alpha, \theta)} - Addition Modulus 2642^{64} between KαK_\alpha, Intermediate Constant θ\theta

π\pi - Substitution Layer

τ\tau - Shift Rows

ψ\psi - Mix Columns

κbKω\kappa_b^{K_\omega} - XOR\text{XOR} Addition with KωK_\omega and the current state of Intermediate Key of Block Size bb

ηbKα\eta_b^{K_\alpha} - Addition Modulus 2642^{64} with KαK_\alpha and the current state of Intermediate Key of Block Size bb

Intermediate Key Generation

Even Round Key Generation

Initial Round Key State (Kin)(K_\text{in})

Kin={K>>>32iif k=bLSBb(K>>>16i)if k=2b and imod4=0MSBb(K>>>64i/4)if k=2b and imod40i{0,2,4,6,,t}K_{in}={\begin{cases}K >>> 32i &{\text{if }}k = b\\ \text{LSB}_{b}(K >>> 16i) & {\text{if }}k = 2b \text{ and } i\bmod 4 = 0\\ \text{MSB}_{b}(K >>> 64\lfloor i/4\rfloor) & {\text{if }}k = 2b \text{ and } i\bmod 4 \neq 0 \end{cases}}\\ \forall i \in \{0,2,4,6,\ldots,t\}

bb - Block Size in Bits

kk - key Size in Bits

tt - Total Number of Rounds

KK - Master Key

LSBb\text{LSB}_b - Least Significant bb bits

MSBb\text{MSB}_b - Most Significant bb bits

Round Constant (tmvi/μi)(\text{tmv}_i/ \mu_i)

tmvi[bx]={0x00if xmod2=0μiif xmod20tmvi=tmvi<<<i/8i{0,2,4,6,,t}\text{tmv}_i[\mathtt{b_x}] = {\begin{cases} \mathtt{0x00} &{\text{if }}\mathtt{x \bmod 2 =0}\\ \mu_i &{\text{if }}\mathtt{x \bmod 2 \neq 0}\\ \end{cases}}\\ \text{tmv}_i = \text{tmv}_i <<< \lfloor i/8 \rfloor \\ \forall i \in \{0,2,4,6,\ldots,t\}

Generation

Ki=ηb(Kσ,tmvi)ψτπκbηb(Kσ,tmvi)ψτπηb(Kin,Kσ,tmvi)i{0,2,4,6,,t}K_{i} = \eta_b^{(K_\sigma, \text{tmv}_i)}\circ \psi \circ \tau \circ \pi \circ \kappa_b^{\eta_b^{(K_\sigma, \text{tmv}_i)}} \circ \psi \circ \tau \circ \pi \circ \eta_b^{(K_\text{in}, K_\sigma, \text{tmv}_i)}\\ \forall i \in \{0,2,4,6,\ldots,t\}

ηb(Kin,Kσ,tmvi)\eta_b^{(K_\text{in}, K_\sigma, \text{tmv}_i)} - Addition Modulus 2642^{64} between Intermediate Key KσK_\sigma, Round Constant tmvi\text{tmv}_i and Initial State KinK_{\text{in}} with Block Size bb

π\pi - Substitution Layer

τ\tau - Shift Rows

ψ\psi - Mix Columns

ηb(Kσ,tmvi)\eta_b^{(K_\sigma, \text{tmv}_i)} - Addition Modulus 2642^{64} between Intermediate Key KσK_\sigma, Round Constant tmvi\text{tmv}_i

κbX\kappa_b^{X} - XOR\text{XOR} Addition with of XX and the current state of Round Key of Block Size bb

Even Key Generation

Odd Round Key Generation

Ki=Ki1<<<(b4+24)i{1,3,5,,t1}K_i = K_{i-1} <<< \left ( \frac{b}{4} + 24\right)\\ \forall i \in \{ 1,3, 5, \ldots, t-1\}

bb - Block Size in Bits

tt - Total Number of Rounds