Implementation and Security Analysis of Construction Algorithm for Primitive Σ-LFSR
Total Page:16
File Type:pdf, Size:1020Kb
Masaryk University Faculty}w¡¢£¤¥¦§¨ of Informatics !"#$%&'()+,-./012345<yA| Implementation and security analysis of construction algorithm for primitive s-LFSR MASTER THESIS Susil Kumar Bishoi Bangalore, December 2016 Declaration Hereby I declare that this thesis is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Susil Kumar Bishoi Advisor: Prof. RNDr. Vaclav Matyas, M.Sc., Ph.D. ii Acknowledgement I am thankful to Shri Sanjay Burman, Director, CAIR for giving me the opportunity to study at Masaryk University. Many many thanks to Himanshu Kumar Haran, Ravi Yadav, Neelesh Tamrakar and Deepak Viswakarma for their support and useful discussions during my stay at Brno, Czech Republic. I am also thankful to Shri T. S. Raghavan for his valuable ideas on this work. I am grateful to my supervisor Prof. Vaclav Matyas for his kind guidance and useful comments on the text of this thesis. Last but not least, I thank my friends, my parents and in-laws, my wife Sangeeta, son Sudeetta and brother Bhagyadhar for their pa- tience and support during my studies. iii Abstract The software implementation LFSR is inefficient for modern proces- sors as it produces only one new bit per step. This limits the speed of operation and resource utilization. So, word based LFSRs (s-LFSRs) are so popular in case of software implementation. Both search al- gorithm and construction algorithm for s-LFSRs provide a good col- lection of primitive s-LFSRs and they are efficient in both hardware and software. However, the construction algorithm for s-LFSRs us- ing Horner’s form of polynomial generates efficient s-LFSRs with lesser complexity of arithmetic operations. The aim of this thesis is the implementation of the construction algorithm on a 32/64-bit PC platform and then security analysis with respect to the cryptographic point of view. This thesis also contains the complexity analysis of the search algorithm for s-LFSRs and the comparative performance of the construction algorithm with the search algorithm for primitive s-LFSRs. iv Keywords Cryptography, Primitive LFSR, Pseudo Random Number Generator and s-LFSR v Contents 1 Introduction ............................1 2 Primitive LFSR and Primitive s-LFSR .............4 3 Horner’s Matrix .........................8 4 Algorithm for Efficient Primitive s-LFSR ........... 12 4.1 Search Algorithm ....................... 12 4.1.1 Exhaustive Search Space of the Search Algorithm ............................ 15 4.2 Construction Algorithm ................... 17 5 Implementation and Analysis of Construction Algorithm 19 5.1 Comparative Analysis with Search Algorithm ........ 19 5.2 Statistical Properties and Number of Tap Positions ..... 21 5.3 Weakness in Initialization of s-LFSR States ......... 24 5.4 Different s-LFSRs Constructed from Single Binary Primi- tive Polynomial ........................ 25 5.5 Primitive s-LFSR with Desired Number of Tap Points ... 27 6 Conclusion ............................. 28 vi List of Figures 2.1 LFSR of order n 4 2.2 s-LFSR of order n 6 4.1 s-LFSR of order n 18 5.1 Comparison results for m = 8 21 5.2 Comparison results for n = 8 and n = 16 22 5.3 Experimental results for different word size m. 26 vii List of Tables 5.1 Summary of results for No. of taps = 3 23 5.2 Summary of results for No. of taps = 4 23 5.3 Summary of results for No. of taps = 5 24 viii List of Algorithms 1 Search Algorithm for Primitive s-LFSR......... 14 2 Construction of efficient primitive s-LFSR........ 17 3 Finding an efficient primitive s-LFSR........... 20 4 Construction of Primitive s-LFSR with k tap positions 27 ix 1 Introduction Random bits are required in a wide variety of situations in cryptog- raphy. A True Random Number Generator (TRNG) can be used to generates these random bits. However, the TRNG design uses some uncontrollable physical processes as a source of true randomness and in most practical environments this is an inefficient procedure. So, a Pseudo Random Number Generator (PRNG) can be used in place of a TRNG. PRNG takes a small bit length seed (random) as input and produces a very large binary sequence which appears to be ran- dom. The concept of PRNG motivates the design of stream ciphers and in stream cipher design, Linear Feedback Shift Register (LFSR, see Golomb [3], Lidl and Niederreiter [6]) is used as one of the impor- tant basic building blocks. For example, it has been used in most of the modern stream ciphers like Grain, Mickey 2.0, Snow, Sosemanuk, etc. In each cycle, LFSR produces only one new bit, so such ciphers are often referred as bit-oriented ciphers. It is well known that if the feedback polynomial of the LFSR is primitive, then for any non-zero initial state, the LFSR produces a maximum length periodic bit se- quence, i.e., if the degree of the primitive feedback polynomial is n over F2, then the period of the non-zero bit sequence generated by LFSR is (2n − 1). Again, LFSR-based ciphers have not only a large period, but also have good statistical properties and low cost of im- plementation in hardware. So, LFSRs are quite useful in generation of pseudorandom bit sequences. However, in many situations such as high speed link encryption, an efficient software encryption is re- quired and bit-oriented ciphers do not provide adequate efficiency. In case of LFSR of order n, total n shifting along with feedback com- putation is needed to produce one bit. So, LFSR takes O(n) bit ma- nipulations in order to produce only a single bit and could not take the advantage of available word based modern processors. So, the question arises, whether it is possible to design feedback shift register (FSR) that outputs a word instead of a bit in each cycle. A very natural and obvious way is to consider the LFSR over the binary extension field F2m . However, in software, the field multiplication is an expensive operation and so affects the software efficiency. Other 1 1. Introduction technique is to exploit word operations of modern processors by us- ing logic operations (such as XOR, AND, OR, complementary oper- ation, left shift, right shift, cycle shift, etc.) and arithmetic operations (such as addition, subtraction, multiplication and division). These op- erations can be used in designing FSRs so as to enhance the efficiency in software implementation. In fact, Preneel in Fast Software Encryp- tion (FSE), 1994 [9] poses a question whether one can design fast and secure FSRs with the help of the word operations of modern proces- sors and the techniques of parallelism. Tsaban and Vishne [11] ad- dressed this problem of Preneel in 2002 by introducing the notion of Transformation Shift Registers (TSRs). In 2007, Zeng et al. [12] gen- eralized the idea of TSR and introduced the notion of word-oriented LFSR called s-LFSR. In their paper, they proposed a search algorithm for generating efficient primitive s-LFSRs. Their algorithm begins by randomly choosing some special matrices (for which matrix-vector multiplications can be computable using word operations) and then test the primitivity of the corresponding s-LFSR. The software and hardware implementation of s-LFSRs obtained through the search algorithm are quite efficient, but it is observed that for larger values of m and n, the search algorithm becomes little sluggish, that is, it finds primitive s-LFSR after a very large number of attempts. There are construction algorithms available in the literature for producing primitive s-LFSRs see for instance, [2, Theorem 6.1] and Krishnaswamy et al. [5]. These algorithms do not seem to produce ef- ficient primitive s-LFSRs. The construction algorithm based on the Horner matrix [1] is quite efficient as it uses only XOR and right shift operations for the feedback value computation. Again, this algorithm produces different s-LFSRs of order n over F2m for different primitive polynomials of degree mn. One of the main objectives of this thesis is the implementation and security analysis of the construction algo- rithm given in [1]. This report also contains the comparative perfor- mance of the construction algorithm and the search algorithm [12] for primitive s-LFSRs. In this thesis, we also propose an algorithm that generates a s-LFSR of order n with k tap positions for 1 < k < n and studied the statistical properties of the bitstream produced by the s-LFSRs generated from both the algorithms (i.e., construction and search algorithm). In the following section, some mathematical tools and techniques 2 1. Introduction are developed, those are required for constructing efficient primitive s-LFSRs. The different steps of the construction algorithm and issues pertaining to its implementation are discussed in the subsequent sec- tions. The thesis is organized as follows. In section2, some definitions and results concerning s-LFSRs are recalled. The Horner’s matrix given in [1] is revisited in the section3. Both search algorithm and construction algorithm for finding efficient primitive s-LFSRs are dis- cussed in section4, where the exhaustive search space of the search al- gorithm for s-LFSRs is derived. In section5, the discussions about the implementation of the construction algorithm for primitive s-LFSRs and then some related security analysis are discussed. Finally, con- clusion is provided in section6. 3 2 Primitive LFSR and Primitive s-LFSR Let Fq denote the finite field with q elements, where q is a prime power and Fq[X] be the ring of polynomials in one variable X with coefficients in Fq. Denote Mm(Fq) the set of all m × m matrices with entries in Fq and GLm(Fq) be the set of all m × m invertible matrices.