Next Article in Journal
Computation and Hypercomputation
Next Article in Special Issue
Efficient and Secure Pairing Protocol for Devices with Unbalanced Computational Capabilities
Previous Article in Journal
Nonlinear Differential Equations with Distributed Delay: Some New Oscillatory Solutions
Previous Article in Special Issue
Security Threats and Cryptographic Protocols for Medical Wearables
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Security and Efficiency of Linear Feedback Shift Registers in GF(2n) Using n-Bit Grouped Operations

by
Javier Espinosa García
1,
Guillermo Cotrina
2,
Alberto Peinado
2,* and
Andrés Ortiz
2
1
Institute of Physical and Information Technologies (ITEFI), Spanish National Research Council (CSIC), 28006 Madrid, Spain
2
Escuela Técnica Superior de Ingeniería de Telecomunicación, Universidad de Málaga, 29071 Málaga, Spain
*
Author to whom correspondence should be addressed.
Mathematics 2022, 10(6), 996; https://doi.org/10.3390/math10060996
Submission received: 24 January 2022 / Revised: 7 March 2022 / Accepted: 16 March 2022 / Published: 19 March 2022
(This article belongs to the Special Issue Mathematics Cryptography and Information Security 2021)

Abstract

:
Many stream ciphers employ linear feedback shift registers (LFSRs) to generate pseudorandom sequences. Many recent LFSRs are defined in G F ( 2 n ) to take advantage of the n-bit processors, instead of using the classic binary field. In this way, the bit generation rate increases at the expense of a higher complexity in computations. For this reason, only certain primitive polynomials in G F ( 2 n ) are used as feedback polynomials in real ciphers. In this article, we present an efficient implementation of the LFSRs defined in G F ( 2 n ) . The efficiency is achieved by using equivalent binary LFSRs in combination with binary n-bit grouped operations, n being the processor word’s length. This improvement affects the general considerations about the security of cryptographic systems that uses LFSR. The model also allows the development of a faster method to test the primitiveness of polynomials in G F ( 2 n ) .
MSC:
3304; 05C31; 90C23; 46B85; 6804

1. Introduction

The symmetric cryptographic systems known as stream ciphers base their operation on the generation of binary sequences that are combined with the message to be encrypted by binary addition (XOR operation). The sequence used in the transmitter must also be generated in the receiver to recover the message by applying the XOR operation to the received ciphertext [1]. The concept of perfect secrecy defined by Shannon [2] establishes as a condition that the binary sequences used to encrypt the message (ciphering sequences) are random, have a length greater than or equal to the message, and are one time use. Although excellent random generators exist, the need to reproduce the sequence in the receiver makes it necessary to use pseudo-random sequences instead of true random ones. Therefore, pseudorandom number generators (PRNGs) constitute the fundamental part of any stream cipher.
One of the simplest and most widely used methods to generate cryptographic pseudorandom sequences is the linear feedback shift register (LFSR) [3]. This generator stands out for its simplicity and for the good statistical properties of the generated sequences. In addition, the behavior of the LFSR is completely characterized by the polynomial that defines the applied feedback. Thus, if the polynomial is primitive, the generated sequence reaches the maximum length, which is known as the m-sequence. However, these sequences are easily predictable from 2 L known elements of the sequence generated by an L-stage LFSR. This makes the sequences obtained from an LFSR not directly usable. Instead, non-linear filtering or non-linear combinations of various LFSRs have to be applied to ensure the cryptographic security of stream ciphers, such as those used in mobile and wireless communication systems, e.g., Bluetooth [4], wireless area networks [5], or GSM [6]. On the other hand, although LFSRs are generically defined on a finite field G F ( q ) , practical implementations of these ciphers are carried out on G F ( 2 ) to integrate with bitwise operations. Nevertheless, these operations are clearly inefficient when using current processors that work with 16-, 32-, or 64-bit words. For this reason, the extended Galois fields G F ( 2 n ) , where 2 n matches the processor word length, have been analyzed to substitute G F ( 2 ) in cryptographic applications [7,8,9]. In the particular case of LFSR-based stream ciphers, the SNOW 3G algorithm [10] is currently used in 3G and 4G mobile communication systems, and several proposals have recently appeared to be applied to 5G communications [11,12,13]. However, computations on an extended field are time consuming, much more than in the base field [14]. Although the bit generation rate improves n times the binary case, the overall performance of the system does not, sometimes being even lower. In fact, several methods have been developed to reduce computational time, such as precomputed tables, optimized algorithms for multiplication [15], or the use of representations of the G F ( 2 n ) elements in terms of G F ( 2 m ) elements with m < n . In contrast to binary case, where any primitive polynomial guarantees a sequence of maximum length, only certain primitive polynomials that facilitate its implementation are used in extended fields. This means that they do not require excessive resource consumption, as the SNOW 3G case does, defined to work on devices with 32-bit processors by combining operations with 32-bit and 8-bit arguments. On the other hand, the identification of primitive polynomials in G F ( 2 n ) requires a much higher computational effort than in the binary case.
This article presents two methods that reduce the execution time for the implementation of an LFSR and the search for primitive polynomials in the extended filed G F ( 2 n ) . These methods are based on the model that establishes a direct relationship between the m-sequence generated by an LFSR in G F ( 2 n ) and the interleaving of n m-sequences generated by n LFSRs in G F ( 2 ) . This relationship was used by Komo and Lam [16] to build primitive polynomials in G F ( 2 n ) in terms of primitive polynomials in G F ( 2 ) , establishing the relationships that must hold between both polynomials. We propose to use these relationships in the opposite direction; that is, we propose to represent the primitive polynomial over G F ( 2 n ) in terms of binary LFSRs. In this way, the same sequences will be generated using only binary operations (XOR). However, moving from n-bit word operations to bit operations would be back to square one, since the main reason for using LFSR on extended fields is to take advantage of the capabilities of n-bit processors where bit operations are inefficient. Taking into account that the n binary LFSRs that allow generating the same sequence as the LFSR in G F ( 2 n ) have all the same primitive feedback polynomial in G F ( 2 ) , the previous obstacle can be easily overcame. Thus, the calculation of the bit operations of the n binary LFSRs can be performed jointly, giving rise to XOR operations between n-bit words and eliminating the inefficiency generated by single-bit operations in this type of processor. The efficiency improvement provided by the proposed implementation turns it into a method especially suitable for cryptanalysis tasks where any execution time reduction in the systems under analysis is very appreciated. Therefore, security assessments performed to cryptosystems based on LFSR in extended fields must take into account the proposed implementation to report a more realistic security level. Additionally, the proposed method allows any primitive polynomial in G F ( 2 n ) to be used as feedback polynomial of an LFSR, thus overcoming the current limitations.
The rest of the paper is organized as follows. In Section 2, the mathematical background and notation are introduced, with special emphasis on the LFSR fundamentals and the relationships between the m-sequences generated in extended and base fields, G F ( q n ) and G F ( q ) . Section 3 describes the proposed implementation for the particular case of LFSRs defined in G F ( 2 n ) through a different and more efficient way. Section 4 contains the algorithm proposed to test the primitiveness of polynomials making use of the same relationships. Finally, discussion about security and efficiency of the implementations and conclusion are included in Section 5 and Section 6, respectively.

2. Mathematical Background

Let G F ( q ) be the finite field of q elements, q being a prime, and G F [ q , x ] the set of all polynomials with coefficients in G F ( q ) . Equivalently, let G F ( q n ) be the finite field of q n elements, and G F [ q n , x ] the set of all polynomials with coefficients from G F ( q n ) . A generator of the cyclic group of a finite field is called a primitive element of that field. Hence, a polynomial p ( x ) G F [ q , x ] of degree m 1 is called primitive over G F ( q ) if it is the minimal polynomial over G F ( q ) of a primitive element α G F ( q n ) . A primitive polynomial h ( x ) of degree n allows one to construct G F ( q n ) in such a way that:
G F ( q n ) G F [ q , x ] / h ( x )
The addition and multiplication in G F ( q n ) are the ones in G F [ q , x ] , but performing the module h ( x ) reduction, as all the elements in G F ( q n ) can be represented as polynomials of degree less than n with coefficients in G F ( q ) . On the other hand, any element a G F ( q n ) can be expressed in terms of a basis { α n 1 , , α 2 , α , 1 } , α being a root of h ( x ) in G F ( q n ) . Consequently, any element a G F ( q n ) can be written as the vector ( a n 1 , , a 1 , a 0 ) where:
a = a n 1 α n 1 + + a 1 α + a 0 1 .
For q = 2 , it is very common to use the hexadecimal notation as a compact representation of the elements in G F ( q n ) . Thus, if we use h ( x ) = x 8 + x 4 + x 3 + x 2 + 1 to construct G F ( 2 8 ) , α being a root of h ( x ) , as any element in G F ( 2 8 ) can be represented as a power of α , we can write the element α 3 as ( 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ) or 0 x 08 and the element α 10 = α 6 + α 5 + α 4 + α 2 as ( 0 , 1 , 1 , 1 , 0 , 1 , 0 , 0 ) or 0 x 74 . Note that the powers of α correspond to the vector components in descending order, beginning from the left, to facilitate the conversion to and from hexadecimal values.

2.1. Linear Feedback Shift Registers

An LFSR defined over G F ( q ) is a collection of L memory cells b i , 0 i L 1 , whose contents belong to that field and are updated synchronously by a master clock, by the following equations:
γ = b L 1 c 1 + b L 2 c 2 + + b 1 c L 1 + b 0 c L , b i = b i + 1 , 0 i L 2 , b L 1 = γ ,
giving rise to the sequence D = d 0 d 1 d 2 , which is completely determined by the initial state of the cells, named seed, and the feedback coefficients c i G F ( q ) , 1 i L according to the linear recurrence:
d i = d i 1 c 1 + d i 2 c 2 + + d 1 c L 1 + d 0 c L ,
where d 0 , d 1 , , d L 1 correspond to the seed (see Figure 1). The length of the sequence D can be analyzed in terms of the connection polynomial p ( x ) composed with the feedback coefficients:
p ( x ) = c 0 + c 1 x + c 2 x 2 + + c L 1 x L 1 + c L x L ,
in such a way that the maximal sequence length q L 1 is achieved when p ( x ) is primitive. In such a case, the sequence is called m-sequence and is independent from the chosen seed.
Stream ciphers are mainly based on LFSRs defined over finite fields with q = 2 [1]. Hence, the cell content is one bit, and the addition and multiplication correspond to XOR and AND operations, respectively. However, for efficiency reasons, in the generation process, LFSRs defined in G F ( 2 n ) are also being used in current communication systems. When LFSR is defined in this extension field, the cells contain n-bit words, where n matches the processor’s word length. Although the equations that govern the LFSR are the same, as described above, addition and multiplication are defined as polynomial addition and multiplication modulus h ( x ) , the polynomial used to construct the G F ( 2 n ) . From now on, we shall use the notation < L , p ( x ) > to refer to an LFSR with L cells in G F ( 2 ) and connection polynomial p ( x ) G F [ 2 , x ] of degree L. The form < L , p ( x ) , n > is for an LFSR of L cells in G F ( 2 n ) and connection polynomial p ( x ) G F [ 2 n , x ] of degree L.

2.2. Binary Equivalent Model

Komo and Lam [16] proposed a method to generate primitive polynomials in G F ( q n ) using primitive polynomials in G F ( q ) based on the relationship previously discovered by Park and Komo [17] between the m-sequences produced in G F ( q n ) and G F ( q ) , in such a way that an m-sequence in G F ( q m ) can be decomposed into n m-sequences in G F ( q ) . More precisely:
Theorem 1
(cf. [17], th 7). Let p ( x ) be a primitive polynomial of degree m · n in G F [ q , x ] . Let f ( x ) be one of the n primitive polynomials of degree m in G F [ q n , x ] into which p ( x ) factors when viewed in G F [ q n , x ] . Let D = d 0 , d 1 , be an m-sequence over G F ( q n ) generated by f ( x ) . If
d i = d i , 0 λ 0 + d i , 1 λ 1 + + d i , n 1 λ n 1
where { λ 0 , λ 1 , , λ n 1 } is a basis for G F ( q n ) over G F ( q ) , then the sequence d 0 , j , d 1 , j , is an m-sequence of length q n m 1 over G F ( q ) .
As one can observe, the sequence d 0 , j , d 1 , j , is composed by the j-th component of each element d i in the sequence D. Equivalently, the sequence d 0 , j , d 1 , j , can be considered as a decimation sequence obtained from D giving rise to the following set of decimated sequences, as it is shown in Figure 2:
D j = d 0 , j , d 1 , j , d 2 , j , ,
Furthermore, as it is stated in [16], since the sequences D j , for 0 j n 1 , are generated by the same polynomial f ( x ) , all of them are shifted versions of the same m-sequence. Hence, taking D 0 as the reference, we can define θ j as the shift of D j respect to D 0 . In [16], a method to obtain a primitive polynomial f ( x ) G F [ q n , x ] in terms of a given primitive polynomial p ( x ) G F [ q , x ] is proposed by means of the computation of the shifts θ j that satisfy the relationship between the m-sequences in the extended and base fields.

3. Efficient LFSR Implementation

The relationship between the m-sequences on G F ( 2 n ) and the m-sequences on G F ( 2 ) , as described in the previous section, also allows us to establish an equivalence between the LFSRs that generate them. This section presents a practical and efficient method to obtain such LFSRs, i.e., to obtain the feedback polynomial p ( x ) and the seeds of each LFSR < L n , p ( x ) > that allow us to generate the same sequence as the LFSR < L , f ( x ) , n > from a given seed. Note that, according to the equivalent model, the n LFSRs in G F ( 2 ) have the same connection polynomial p ( x ) but different seeds, all of them related to the seed in G F ( 2 n ) . Hence, in order to efficiently implement the LFSR < L , f ( x ) , n > using the equivalent model, it is necessary to solve three main questions: the computation of p ( x ) , the computation of the seeds, and how to speed up the performance of the binary LFSRs.
Since the connection polynomial f ( x ) is primitive, the minimal polynomial p ( x ) of the decimated sequences D i is also primitive and unique for 0 i n 1 . Hence, p ( x ) can be obtained analyzing a decimated sequence using the Massey–Berlekamp algorithm [18]. Consequently, the following Algorithm 1 is defined.
Algorithm 1: Computation of connection polynomial p ( x ) .
input  : LFSR < L , f ( x ) , n >
output:  p ( x ) in LFSR < L n , p ( x ) >
  • Implement the LFSR < L , f ( x ) , n > ;
  • Generate 2 L n + 1 elements, at least, using any nonzero seed;
  • Obtain a decimated sequence D i for any i , 0 i n 1 ;
  • Obtain the minimal polynomial p ( x ) of the D i generated in step 3
Once p ( x ) has been determined, we can construct the n LFSRs < L n , p ( x ) > , but we need their respective seeds in order to generate the same sequence as that generated from the initial seed s = ( d 0 , d 1 , , d L 1 ) in the extended field. As it is derived from the equivalent model, the L known elements in G F ( 2 n ) that compose the initial seed only provide us with n L bits, while n 2 L bits are needed to complete the n seeds in G F ( 2 ) (see Figure 3). Thus, the seed s j of D j can be partially written in terms of the seed s of D as:
s j = d 0 , j , d 1 , j , , d L 1 , j , d L , j , , d n · L 1 , j
where d L , j , , d n · L 1 , j are unknown for 0 j n 1 . However, the shifts θ i that relate the binary sequences to each other allow us to obtain the seeds completely. The following subsections describes the computation of θ j and s j .

3.1. Computation of Shifts

All decimated sequences D j have the same primitive minimal polynomial p ( x ) , obtained using Algorithm 1. Hence, all of them are shifted versions of the others. The shift θ j of D j with respect to D 0 allows one to obtain the state of the j-th LFSR (the one that generates D j ) from the state of the 0-th LFSR as follows:
( d 0 , j , d 1 , j , , d n · L 1 , j ) = ( d 0 , 0 , d 1 , 0 , , d n · L 1 , 0 ) A θ j ,
where A is the connection matrix of p ( x ) , that is:
A = 0 0 0 c n · L 1 0 0 c n · L 1 0 1 0 c n · L 2 0 0 1 c 1
The computation of θ j is not an easy task. Furthermore, the computation of A θ j is time-consuming. Instead, we can obtain the matrix A ( j ) = A θ j solving the linear equation system of Equation (9). Note that we have n matrices A ( j ) to compute and thus n linear systems to solve. The linear system in Equation (9), stated using the first n L element, the seed, has n L equations and n 2 L 2 unknowns. Each new element of the sequence defines n L new equations with the same unknowns. Hence, the 2 L n + 1 elements of the m-sequence in G F ( 2 n ) generated in Algorithm 1 to obtain p ( x ) provide enough equations to solve the systems. As an example, we consider a 3-stage LFSR defined in G F ( 2 4 ) , that is, the LFSR < 3 , f ( x ) , 4 > , where f ( x ) = 1 + x + ( 0 x 9 ) x 3 is primitive over G F ( 2 4 ) and the primitive polynomial x 4 + x + 1 has been used to construct G F ( 2 4 ) . From the initial seed ( 1 , 1 , 1 , 1 ) , ( 0 , 0 , 0 , 0 ) , ( 0 , 1 , 1 , 0 ) or, equivalently, ( 1 + α + α 2 + α 3 , 0 , α + α 2 ) , α being a root of x 4 + x + 1 , the LFSR < 3 , f ( x ) , 4 > generates the following sequence:
001000001100111010010000 101001011000000001010001 101110100000001111001000 001110000001000101100011
where the elements of G F ( 2 4 ) are represented in columns with the least significant bit at the top. The four decimated sequences are all generated by the same primitive polynomial p ( x ) = x 12 + x 6 + x 5 + x 3 + 1 and, hence, all of them are shifted versions of the same m-sequence. Solving the system in Equation (9), we obtain the matrices A ( 1 ) , A ( 2 ) , A ( 3 ) :
A ( 1 ) = 100000000110 010000000011 101000000001 110100000000 011010000000 001101000000 000110100110 000011010101 000001101010 000000110011 000000011001 000000001100 A ( 2 ) = 000000101010 000000010101 100000001010 110000000101 111000000010 011100000001 101110101010 010111111111 001011111111 000101010101 000010101010 000001010101 A ( 3 ) = 000111111111 000011111111 000001111111 000000111111 100000011111 010000001111 001111111000 100000000011 110000000001 111111111111 011111111111 001111111111
Since the decimated sequences have a small period of 2 12 1 = 4095 , we have also compared them to obtain the shifts θ 1 = 3276 , θ 2 = 3549 , and θ 3 = 3822 . In a real scenario, θ j is not going to be computed. It is important to point out that the calculation of the A ( j ) matrices can be performed prior to the normal operation of the LFSR since they do not depend on the seeds.

3.2. Computation of Seeds

Let us consider that the shift matrices A ( j ) = A θ j have already been precomputed. For any given seed ( d 0 , d 1 , , d L 1 ) , the seeds of the binary LFSRs can be represented as:
( d 0 , j , d 1 , j , , d n · L 1 , j ) = ( d 0 , 0 , d 1 , 0 , , d n · L 1 , 0 ) A ( j ) ,
where d L , j , , d n · L 1 , j are unknowns for every 0 j n 1 . The values d L , 0 , , d n · L 1 , 0 can be obtained solving the linear system composed with the ( n · L L ) equations with the known values d 0 , j , d 1 , j , , d L 1 , j , for 0 j n 1 , i.e.:
d i , j = k = 0 n · L 1 d k , 0 a k , i ( j ) , 0 i L 1 , 1 j n 1 ,
where a k , i ( j ) are the components of the matrix A ( j ) . The remaining seeds ( d 0 , j , d 1 , j , , d n · L 1 , j ) , with 1 j L 1 , are calculated using Equation (13). Considering the precomputed matrices in Equation (12) of the previous example, the Equation (13) can be written as:
( 1 , 0 , 1 , d 3 , 1 , , d 11 , 1 ) = ( 0 , 0 , 1 , d 3 , 0 , , d 11 , 0 ) A ( 1 ) ( 1 , 0 , 1 , d 3 , 2 , , d 11 , 2 ) = ( 0 , 0 , 1 , d 3 , 0 , , d 11 , 0 ) A ( 2 ) ( 0 , 0 , 1 , d 3 , 3 , , d 11 , 3 ) = ( 0 , 0 , 1 , d 3 , 0 , , d 11 , 0 ) A ( 3 )
Solving for ( d 3 , 0 , , d 11 , 0 ) , we obtained the complete seed for the sequence D 0 , that is, ( 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 ) . Next, using the matrices A ( 1 ) , A ( 2 ) and A ( 3 ) , the complete seeds of the sequences D 1 , D 2 , and D 3 are obtained. Hence, we have:
s e e d 0 = ( 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 ) s e e d 1 = ( 1 , 0 , 1 , 0 , 0 , 1 , 0 , 1 , 1 , 0 , 0 ) s e e d 2 = ( 1 , 0 , 1 , 1 , 1 , 0 , 1 , 0 , 0 , 0 , 0 ) s e e d 3 = ( 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 )

3.3. Grouped Operations

Once the n binary LFSRs have been constructed, it is time to generate the sequence. Instead of running n independent instances of the binary LFSR, which require 1-bit operations with an n-bit processor, we propose to group the n LFSRs into a unique LFSR with connection polynomial p ( x ) but using n-bit cells. The result is not an LFSR over G F ( 2 n ) but a parallel implementation of n LFSR over G F ( 2 ) using only one processor. Since the addition and multiplication in the binary LFSRs correspond to the XOR and AND bitwise operations, respectively, instead of applying the XOR to 1-bit values, we apply it over n-bit values. The processor takes the same time to perform the XOR operation with 1-bit values than with n-bit values because the word length is n, thus saving a lot of execution time. Hence, Equation (4) can be redefined as follows:
d i , 0 d i , n 1 = c 1 d i 1 , 0 d i 1 , n 1 + c 2 d i 2 , 0 d i 2 , n 1 + + c L d i L n , 0 d i L n , n 1 ,
in such a way that the n sequences stated in Equation (7) are simultaneously generated using a unique polynomial p ( x ) (see Equation (5)).
From the practical implementation perspective, there is no difference at all with respect to preforming a classical binary LFSR, which includes coding and execution, since the 1-bit XOR operation is actually performed taking n-bit operands. Hence, the n-bit grouped operation proposed in this paper is a way of not wasting the capacity of the operations of the n-bit processors. As a consequence, this implementation method increases the bit generation net rate by n because the generation of a new element of a 32-bit m-sequence takes the same amount of time as a new element of a 1-bit m-sequence.

4. Primitiveness Test

As mentioned in Section 2.2, the m-sequences generated by an LFSR in G F ( 2 n ) can be decomposed into n m-sequences generated by n LFSRs in G F ( 2 ) , so that when the feedback polynomial of the LFSR in the extended field is primitive, all LFSRs in G F ( 2 ) have the same feedback polynomial, and it is also primitive. This relationship is what allows us to propose an algorithm to check if a polynomial is primitive over G F ( 2 n ) .
In general terms, to check if a polynomial f ( x ) over G F ( 2 n ) is primitive, we propose to build an LFSR whose feedback polynomial is f ( x ) and generate 2 · m · n + 1 elements, at least. The sequence generated by concatenating all generated elements is decomposed into n binary sequences by decimating by n, as it is stated in Equation (7). Next, the n sequences are processed to obtain the minimal polynomials of the binary LFSRs that generate them (This can be achieved using the Berlekamp–Massey algorithm). If all the n sequences are generated by the same polynomial and it is also primitive, then f ( x ) is primitive over G F ( 2 n ) . Algorithm 1 can be extended including one more step (step 5) to perform the check, resulting in Algorithm 2.
Algorithm 2: Primitiveness test.
Mathematics 10 00996 i001
As an example, let us consider the degree 6 polynomial f ( x ) = 0 x 1 + 0 x 2 · x + 0 x 4 · x 2 + 0 x 8 · x 3 + 0 x 5 · x 4 + 0 x 9 · x 5 + x 6 G F [ 2 4 , x ] , where the primitive polynomial h ( x ) = x 4 + x + 1 has been used to construct G F ( 2 4 ) . In order to check if f ( x ) is primitive, we consider f ( x ) as the feedback polynomial of an LFSR in the G F ( 2 4 ) of 6 cells. For a random seed ( 0 x 9 , 0 x 4 , 0 x 5 , 0 x 9 , 0 x 5 , 0 x 1 ) , we generate 2 m n + 1 = 49 elements, giving rise to the following decimated sequences:
D 0 = 0010011011100000011010110001000000101011001111100 D 1 = 0101100111010011110000001010111101111001011010001 D 2 = 0000000011000101110101100100010010011000001000101 D 3 = 1111011111000011001111010101101110100100010100001
The same minimal polynomial p ( x ) is obtained for each D i sequence by means of the Massey–Berlekamp algorithm [18]. The polynomial is the following:
p ( x ) = x 24 + x 23 + x 22 + x 21 + x 20 + x 19 + x 15 + x 14 + x 9 + x 8 + x 7 + x 6 + 1
Since p ( x ) is primitive over G F ( 2 ) , we can conclude that f ( x ) is primitive over G F ( 2 4 ) .

5. Efficiency and Security

The implementation presented in Section 3 considerably reduces the execution time of the LFSRs defined in G F ( 2 n ) . Specifically, an implementation of the LFSR used in the SNOW 3G stream cipher has been performed and compared with the implementation provided in the technical specification of the protocol [10]. This is an LFSR < 16 , f ( x ) , 32 > . Hence, the equivalent model is based on 32 LFSRs < 512 , p ( x ) > . The polynomial p ( x ) is built from 1024 elements generated using the official implementation [10] following the steps established in Algorithm 1. The result is that the 32 decimated sequences have the same minimal polynomial p ( x ) of degree 512, whose coefficients are represented below in compact hexadecimal format:
84009 C 624 D 4 F 75 F 17 E D A 41 C 663 C 5 D F D E D 8 A 535 D A 1 C 5 F 70824152 A 7
C 23 E D B 90 D 572852 A 765 F F 5 F 2012 A 64 F 5 D 3 F D 361 B 005 A D B A 45 A 1995
E 64 E 48362706 D 62606828
Despite the fact that p ( x ) has 250 non-zero coefficients, and therefore 250 XOR operations are required to generate the next element in the sequence, the execution time is 3.3 times lower than the original implementation. The computation of the matrices A ( j ) is not considered, since this is performed prior to the normal operating of the LFSR. The times have been calculated by taking the average of 10 repetitions of each generation of 1000, 10,000, 20,000, 50,000, and 100,000 elements. Both implementations have been made in Python 3.9 language and have been executed on an Intel(R) Core(TM) i7-10510U 64-bit processor with 16 GB of RAM. Although the SNOW 3G algorithm has been designed to be executed on 32-bit platforms, the tests carried out on a 64-bit processor are completely valid since the greater word length of the processor compared to the algorithm does not affect the normal execution of our implementation. Note that the goal is to achieve an implementation of an algorithm defined in G F ( 2 n ) using n-bit operations. The case of working with processors of more than n bits offers the possibility of developing new faster implementations to make the most of their capacity, but requires adapting the algorithms to the new processor architecture. This is outside the scope of this work.
As mentioned in the Section 3, the net bit generation rate is increased by n when compared to a single binary LFSR implementation, that is, to a binary LFSR using the same connection polynomial. However, the improvement observed in the tests on SNOW 3G does not reach the net rate. This is mainly due to the number of non-zero coefficients in p ( x ) that slow down the computation. Therefore, in the case of equivalent binary polynomials p ( x ) with a few nonzero coefficients, the real rate will reach the net rate. In the general case, the fewer non-zero coefficients in p ( x ) , the greater the improvement to the generation rate.
The efficiency of the proposed implementations, shown in Section 3 affects the security of the cryptosystems used by these LFSRs, although, in general, they are not intended to replace those currently used by most devices, such as smartphones, but rather for use in mobile devices without any type of restriction, such as personal computers or servers. Using the equivalent model implies multiplying by n, the number of bits needed to generate a new element of the m-sequence over G F ( 2 n ) , that is, to generate n bits. In the case of SNOW 3G, it goes from 512 to 16,384 bits. Therefore, the theoretical improvement of the execution time by a factor n is associated with an increase in the same factor n in the amount of memory needed to generate the same number of bits. As a consequence, this implementation provides a substantial improvement for the calculation of m-sequences that, although it could not be deployed on some devices, could always be used for cryptanalysis tasks. Regarding the cost of our proposal, an increment in the memory cells must be taken in mind, rising from n L to n 2 L bits.
Regarding the algorithm for primitiveness testing, we can conclude that it has a better performance than O’Connor’s algorithm, one of the most used ones. The main advantage is that the proposed algorithm has to generate 2 m n + 1 elements instead of the whole sequence or alternatively to perform as many divisions as elements in the maximal sequence over the extended field. The validation and comparison tests have been performed using Mathematica software, version 10.0.0 , on a 64-bits Microsoft Windows platform running on a Intel(R) Core (TM) processor with i7-4510U CPU @ 2.00 GHz and 16 GB RAM. The processor’s temperature and the amount of simultaneous running processes have been taken into account for the execution time comparison. Figure 4 shows the behavior of the algorithm with respect to O’Connor’s in G F ( 2 8 ) and G F ( 2 16 ) , respectively.

6. Conclusions

In this article, we have presented two real applications of the relationships between the m-sequences in G F ( 2 n ) and G F ( 2 ) . The first one is a new algorithm designed to verify the primitiveness of polynomials with coefficients in G F ( 2 n ) that improves the execution times of existing methods. The second one is the support of an efficient implementation of the LFSRs defined over the extended field G F ( 2 n ) , which improves the other implementations. It enables better performance of the LFSR-based stream ciphers, often used in high speed communication systems. The improvement is achieved by a combination of the binary equivalent model of LFSRs in the extended field, which uses only binary operations, and the n-bit grouped operation that take advantage of the n-bit processors. The feasibility of the implementation has been shown by applying it to the SNOW 3G stream cipher, whose execution time has been reduced by a factor of 3.3 with respect to the code provided in the technical specification of the protocol. These results can also be extended to cryptanalysis, making use of not only the grouped operations but of the underlying binary structure that may facilitate the parallelization of the operations. On the other hand, the proposed implementation is software-oriented, although the binary operations also allow hardware implementations. In this way, we provide a complete method to efficiently increase the bit generation rate.

Author Contributions

Writing of original draft and writing—review and editing, J.E.G., G.C., A.P. and A.O. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the research group BIOSIP (TIC-251) and by the Spanish State Research Agency (AEI) of the Ministry of Science and Innovation (MICINN), project P2QProMeTe (PID2020-112586RB-I00/AEI/10.13039/501100011033) co-funded by the European Regional Development Fund (ERDF, EU).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

References

  1. Menezes, A.J.; Van Oorschot, P.C.; Vanstone, S.A. Handbook of Applied Cryptography; CRC Press: Boca Ratón, FL, USA, 2020. [Google Scholar]
  2. Shannon, C. Communication Theory of Secrecy Systems. Bell Syst. Tech. J. 1949, 28, 656–715. [Google Scholar] [CrossRef]
  3. Golomb, S.W. Shift Register Sequences, 3rd Revised ed.; Aegean Park Press: Laguna Hills, CA, USA, 2017. [Google Scholar]
  4. Padgette, J.; Bahr, J.; Batra, M.; Holtmann, M.; Smithbey, R.; Lily, C.; Scarfone, K. Guide to Bluetooth Security; NIST: Gaithersburg, MD, USA, 2017. [Google Scholar]
  5. Jindal, P.; Singh, B. RC4 Encryption-A Literature Survey. Procedia Comput. Sci. 2015, 46, 697–705. [Google Scholar] [CrossRef] [Green Version]
  6. Biham, E.; Dunkelman, O. Cryptanalysis of the A5/1 GSM stream cipher. In Proceedings of the International Conference on Cryptology in India, Calcutta, India, 10–13 December 2000; pp. 43–51. [Google Scholar]
  7. Kiyomoto, S.; Tanaka, T.; Sakurai, K. K2: A stream cipher algorithm using dynamic feedback control. In Proceedings of the International Conference on Security and Cryptography, SECRYPT, Barcelona, Spain, 28–13 July 2007; Hernando, J., Fernández-Medina, E., Malek, M., Eds.; INSTICC Press: Lisboa, Portugal, 2007; pp. 204–213. [Google Scholar]
  8. George, K.; Michaels, A.J. Designing a Block Cipher in Galois Extension Fields for IoT Security. IoT 2021, 2, 669–687. [Google Scholar] [CrossRef]
  9. Panario, D.; Reis, L. The functional graph of linear maps over finite fields and applications. Des. Codes Cryptogr. 2019, 87, 437–453. [Google Scholar] [CrossRef]
  10. ETSI/SAGE. Specification of the 3GPP, Confidentiality and Integrity Algorithm UEA2 and UIA2; Document 2: SNOW 3G Specification; ETSI: Sophia Antipolis, France, 2006. [Google Scholar]
  11. Caforio, A.; Balli, F.; Banik, S. Melting SNOW-V: Improved lightweight architectures. J. Cryptogr. Eng. 2020, 12, 53–73. [Google Scholar] [CrossRef]
  12. Ekdahl, P.; Johansson, T.; Maximov, A.; Yang, J. A new SNOW stream cipher called SNOW-V. IACR Trans. Symmetr. Cryptol. 2019, 3, 1–42. [Google Scholar] [CrossRef]
  13. Ekdahl, P.; Maximov, A. SNOW-Vi: An Extreme Performance Variant of SNOW-V for Lower Grade CPUs. In Proceedings of the 14th ACM Conference on Security and Privacy in Wireless and Mobile Networks, WiSec ’21, Abu Dhabi, United Arab Emirates, 28 June–2 July 2021; pp. 261–272. [Google Scholar]
  14. Avanzi, R.; Theriault, N. Effects of optimization for software implementations of small binary field arithmetic. In International Workshop on the Arithmetic of Finite Fields; Springer: Berlin/Heidelberg, Germany, 2007; pp. 69–84. [Google Scholar]
  15. Delgado-Mohatar, O.; Fúster-Sabater, A.; Sierra, J.M. Performance evaluation of highly efficient techniques for software implementation of LFSR. Comput. Electr. Eng. 2011, 37, 1222–1231. [Google Scholar] [CrossRef]
  16. Komo, J.J.; Lam, M.S. Primitive Polynomials and m-sequences over GF(qm). IEEE Trans. Inf. Theory 1993, 39, 643–647. [Google Scholar] [CrossRef]
  17. Park, W.J.; Komo, J.J. Relationships Between m-Sequences over GF(q) and GF(qm). IEEE Trans. Inf. Theory 1989, 35, 183–186. [Google Scholar] [CrossRef]
  18. Massey, J.L. Shift register synthesis and BCH decoding. IEEE Trans. Inf. Theory 1969, 15, 122–127. [Google Scholar] [CrossRef] [Green Version]
Figure 1. Linear feedback shift register.
Figure 1. Linear feedback shift register.
Mathematics 10 00996 g001
Figure 2. Relationship between m-sequences in the extended and base fields.
Figure 2. Relationship between m-sequences in the extended and base fields.
Mathematics 10 00996 g002
Figure 3. LFSR seeds in the binary equivalent model.
Figure 3. LFSR seeds in the binary equivalent model.
Mathematics 10 00996 g003
Figure 4. Execution time in G F ( 2 8 ) and G F ( 2 16 ) .
Figure 4. Execution time in G F ( 2 8 ) and G F ( 2 16 ) .
Mathematics 10 00996 g004
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Espinosa García, J.; Cotrina, G.; Peinado, A.; Ortiz, A. Security and Efficiency of Linear Feedback Shift Registers in GF(2n) Using n-Bit Grouped Operations. Mathematics 2022, 10, 996. https://doi.org/10.3390/math10060996

AMA Style

Espinosa García J, Cotrina G, Peinado A, Ortiz A. Security and Efficiency of Linear Feedback Shift Registers in GF(2n) Using n-Bit Grouped Operations. Mathematics. 2022; 10(6):996. https://doi.org/10.3390/math10060996

Chicago/Turabian Style

Espinosa García, Javier, Guillermo Cotrina, Alberto Peinado, and Andrés Ortiz. 2022. "Security and Efficiency of Linear Feedback Shift Registers in GF(2n) Using n-Bit Grouped Operations" Mathematics 10, no. 6: 996. https://doi.org/10.3390/math10060996

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop