Implementation of SIMON and SPECK Lightweight Block Ciphers On Programmable Logic Controllers PDF
Implementation of SIMON and SPECK Lightweight Block Ciphers On Programmable Logic Controllers PDF
Abstract—Programmable Logic Controllers (PLCs) are the extend over the next years, adding security features to those
key components of SCADA systems, controlling different in- systems should be a major concern [6]–[9].
dustrial processes, while handling the communication with
The introduction of cryptography at the PLC’s application
other systems via different communication protocols, which are
subject to security attacks. The introduction of cryptography at level could represent a first step in providing the needed
the PLC’s application level could represent a first step in pro- security for such systems. Furthermore, the recent devel-
viding the needed security for such systems. However, despite opments in the field [10], [11] open the possibility for
the recent technological progress, PLCs are still quite limited the implementation of cryptography on different equipment
equipment in terms of processing performance, when compared
with low computing resources. This paper presents the
to other computing systems (e.g., PCs). Consequently, running
the traditional cryptographic algorithms at PLC level is time implementation issues of the SIMON and SPECK fam-
consuming and requires a lot of resources. In this context, ily of lightweight block ciphers in PLC applications. It
the implementation of the recent lightweight cryptographic shows that, while the two block ciphers exhibit high per-
algorithms may provide more feasible solutions. This paper formances and can represent significant candidates for en-
presents the PLC implementation aspects and the results for
forcing application-layer security properties, designers need
the SIMON and SPECK families of cryptographic algorithms,
as tested on Phoenix Contact’s ILC 350 PN controller. to carefully analyse the underlying hardware architecture
and in particular the supported data types. While these can
I. I NTRODUCTION have a significant impact on the application performance,
the large number of SIMON and SPECK variants ensure
The technological progress of recent years has made it that sufficient options are available for many applications
possible for more Information and Communication Tech- and scenarios. A Phoenix Contact ILC 350-PN controller is
nology (ICT) equipment to be introduced in industrial con- used as a testbed for the implementation and results.
trol systems. The fourth industrial revolution, also known
The remainder of the paper is organized as follows:
as Industry 4.0, brings innovative and cost-efficient solu-
Section 2 contains a brief overview of the related work
tions, while imposing dramatic changes in the traditional
on the topic; Section 3 highlights the PLC implementation
technologies and infrastructures. Essentially, these systems
aspects of SIMON and SPECK cryptographic algorithms;
are industrial cyber-physical production systems [1] (also
Section 4 presents the time results for the execution of the
associated more recently to the Industrial Internet of Things
algorithms on the specified platform, while in Section 5 the
[2]) where the massive proliferation of ICT enabled the
conclusions of this work are formulated.
development of innovative applications and services, new
technologies and advanced features, increased operational II. BACKGROUND AND R ELATED W ORK
benefits, while reducing the costs of installations.
While this technological shift greatly improves the moni- A. Architectural Overview of SCADA Systems
toring and data acquisition capabilities of Supervisory Con- The architecture of modern SCADA systems is structured
trol and Data Acquisition (SCADA) systems, it also raises on two distinct layers: the physical layer and the cyber
serious concerns regarding their exposure to cyber attacks layer. The physical layer encompasses sensors, actuators,
[3]–[5]. Programmable Logic Controllers (PLCs) are key and hardware that, physically needed to control the system,
components of SCADA systems. They are very capable of while the cyber layer encompasses all the ICT hardware
controlling a large variety of industrial systems, being vir- and software needed to monitor the physical process and to
tually present in every branch of industry, but their security implement complex control loops. From an operational point
features, which until now were almost non-existent, are just of view, industrial controllers (e.g., Programmable Logical
starting to be addressed by the major producers. Since the Controllers PLCs, and Remote Terminal Units RTUs), read
life expectancy of the already installed PLCs continues to data from sensors and produce the local control strategy by
c
978-1-5090-5835-8/17/$31.00
2017 IEEE issuing commands to the actuators. These controllers also
Cyber Layer Physical Layer
PLC PLC
Telephone
SCADA server Engineering Leased Line or Control network
station Power Line-based
Communications
PLC
Generation Transmission
Process network
Radio Modem
SCADA server Microwave or
Maintenance Cellular
server
WAN Card
Satellite
Domain Communications PLC
controller Routers
Wide Area Control network
Network Customer Distribution
forward data to the SCADA servers and eventually execute key size variants. Manifas et al. confirmed in [15] the
the remote commands they receive. appropriateness of SPECK and SIMON for use in embedded
In modern industrial installations, the communication systems. The use of an ARM-NEON system to further
between SCADA servers and PLCs is usually implemented enhance the performance of these block ciphers was proven
in two ways: (i) through an Object Linking and Embed- to be highly effective in [16]. The two ciphers have been
ding (OLE) for Process Control (OPC) layer that helps shown to be applicable in 8-bit CPUs as well [11].
map the PLC devices, program, and monitor the hardware Nonetheless, despite the previous efforts, to the best of
controllers; and/or (ii) through a direct memory mapping our knowledge, this is the first attempt to implement the two
notation, which makes use of SCADA communications pro- lightweight block ciphers in PLC applications. The research
tocols such as Modbus and DNP3. An example architecture presented in this paper can be used to further enhance the
of a SCADA system is shown in Fig. 1. security of SCADA applications, and most importantly, to
deliver effective end-to-end data protection strategies.
B. Related Studies
The widely accepted cryptographic standards such as the III. PLC I MPLEMENTATION OF SIMON AND SPECK
Advanced Encryption Standard (AES) have been widely A. Brief overview of SIMON and SPECK
adopted and implemented in various scenarios. Nowadays,
we find that AES is the “de facto” symmetric cryptographic Each encryption algorithm in the SIMON and SPECK
system powering the services of our modern society, sup- cipher families processes blocks of data, representing keys
ported by a plethora of applications. Despite its popularity, and plaintext, organized as n-bit words. Depending on the
AES has been found to lack the needed flexibility to be used algorithm, n is required to be {16, 24, 32, 48, 64} bit long,
by devices with constrained computational resources [12]. while the key has a length of m-words. The available values
To cope with this issue, a significant effort towards the for m are {2, 3, 4} and depend on the encryption algorithm
development of new block ciphers was made. To this end, variant. For example, SIMON 64/128 encrypts a 64-bit long
a notable initiative was promoted by the National Security plaintext (x, y), organized as two n=32-bit words, using a
Agency and in 2013 an announcement was made on the 128-bit key k = (k[3], k[2], k[1], k[0]) organized as m=4
development of a new set of lightweight block ciphers: x n=32-bit words. In the case of SPECK 64/128, the two
the SIMON and SPECK family of ciphers [10], [11], [13]. 32-bit words representing the plaintext (x, y) are encrypted
Compared to AES, the newly developed ciphers support using the four 32-bit word key k, initially organized as: k =
many different block sizes of 32, 48, 64, 96 and 128 bit block (l[2], l[1], l[0], k[0]).
sizes, and 64, 72, 96, 128, 192, and 256 bit key sizes. They The full encryption process of the SIMON and SPECK
are based on simple arithmetic computations, which make algorithms consists of two separate iterative components: the
them feasible for integration in low-power devices (e.g., the key expansion and the encryption, both of which require sev-
IoT, industrial systems). eral rounds (T ) to complete, and make use of the following
Given their promising performances, there have been operations performed on n-bit words:
several studies which discuss the implementation of SIMON • Bitwise XOR (⊕);
and SPECK in different hardware/software environments. In • Bitwise AND (&);
[14], Buhrow et al. tested the effectiveness of the SPECK • Left and right circular shift (ROLj / RORj ) by a
lightweight block cipher on a MSP430 device. A com- specified number of bits j;
prehensive analysis was provided on different block and • Modulo 2n addition (ADD M OD 2n ).
The key expansion components of the algorithms extend The PLC natively supports 8, 16 and 32-bit size data
the initial m key words k[i], where i = 0, m − 1, to a types, named BYTE, WORD and DWORD, as part of the IEC-
number of T key words k[i], where i = 0, T − 1, which are 61131-3 elementary data types, as well as user defined data
then used one by one during each round of the encryption types which can be derived of these in the form of structures
process. and arrays [17]. The PLC can also perform the operations
The general structure of SIMON and SPECK encryption specified above up to a data size of n=8, 16 or 32 bits. For
algorithms is shown in Fig. 2 and Fig. 3, while the PLC the other cases: n=24, 48, 64 user defined data types are
implementation aspects of the necessary operations is de- necessary and the left/right rotation as well as the modulo
scribed next. Further details regarding the two algorithms 2n addition need special attention.
are available in [10], [11], [13]. Considering the available PLC data types, in order to
implement the 24-bit word organization required by SI-
for i=m to T-1 for i=0 to T-1 MON48/72, SIMON48/96, SPECK48/72 and SPECK48/96
a 3-BYTE structure was implemented to store the informa-
tmpĸx
tion and all the necessary operations were tailored to it. The
tmpĸROR3(k[i-1])
same procedure was applied for n=48, where a 3-WORD
no
structure was implemented and for n=64 which needed a
m=4? tmp2ĸROL1(x) & ROL8(x)
yes
structure containing two DWORD type elements.
This data organization resulted as the most obvious way to
tmpĸtmp k[i-3] tmp2ĸy tmp2 correlate the compatible PLC data types, with the PLC data
to be encrypted and the n-bit word organization required
tmp2ĸtmp2 ROL2(x) by the algorithms. This way, the messages which are to be
tmpĸtmp ROR1(tmp)
encrypted and the keys needed for this process would be
xĸtmp2 k[i] encoded using data types of the same size (either BYTE,
tmpĸtmp NOT(k[i-m])
WORD or DWORD), which would eventually lead to an easier
yĸtmp
integration of the proposed implementation in PLC projects.
tmpĸtmp BIT_TESTb(z) Since these cryptographic algorithms are intended for
use in industrial control applications, as an extension to
k[i]ĸtmp 3 the control logic implemented by the PLC, and should
a. b. provide the protection of SCADA networks communication,
a decrease in execution time was a major concern. This
Fig. 2. SIMON key expansion (a); encryption (b) lead to a second approach regarding the word organization
of the cryptographic algorithms, which mixed the basic
PLC data types as follows: for n=24 a DWORD was used
for i=0 to T-2 for i=0 to T-1 having the most significant byte (bits 31÷24) equal to 0; for
n=48 a structure with two elements was used to encode the
tmpĸROR (l[i]) tmpĸROR (x) necessary 48 bits. This structure was made of one DWORD
encoding bits 47÷16 and one WORD encoding bits 15÷0.
tmpĸADD_MOD_2n(k[i], tmp) tmpĸADD_MOD_2n(tmp, y)
The two choices specifying the PLC data organization
with respect to the different variants of SIMON and SPECK
cryptographic algorithms families are shown in Table I.
l[i+m-1]ĸtmp i xĸtmp k[i]
Since the elements of such a structure define a sequence
of n bits, the left circular shift operation (ROLj ) applied
k[i+1]ĸROL (k[i]) l[i+m-1] yĸROL (y) x on the n-bit sequence consists of rearranging the bits of
a. b. each element in the structure, by moving the final j-bit
entry of an element to the first position of the next element,
Fig. 3. SPECK key expansion (a); encryption (b)
while shifting all other bits to the next position. The inverse
operation describes the right circular shift (RORj ). This can
B. PLC Implementation Aspects be done by individually rotating, with the specified number
Our test infrastructure consisted of the Integrated Logical of bits, each element of the considered structure. Then, by
Controller (ILC) 350 produced by Phoenix Contact. This using bit masks, the bits which need to be moved from one
particular type of controller is frequently used in Romanian element in the sequence to another can be isolated, before
SCADA systems (e.g., gas transportation) due to its high being copied to their final position.
performance and low costs (compared to other controllers). This procedure makes use of basic bit-oriented operations
The PLC runs the ProConOS (Programmable Controller and functions, such as bitwise AND, bitwise OR, left (e.g.
Operating System), and is based on Windows CE technology ROL_BYTE, ROL_WORD, ROL_DWORD) and right rotations
and the .NET 4.2 framework. (e.g. ROR_BYTE, ROR_WORD, ROR_DWORD). These are all
TABLE I
PLC DATA ORGANIZATION FOR SIMON AND SPECK 2n/mn
Block Key Word Key PLC data v.1 PLC data v.2
size 2n size mn size n words m
32 64 16 4 WORD unchanged
48 72 24 3 TYPE DWORD (bits 31 ÷ 24 = 0)
96 4 BYTE_3:
STRUCT
upper_byte : BYTE;
middle_byte : BYTE;
lower_byte : BYTE;
END_STRUCT;
END_TYPE
64 96 32 3 DWORD unchanged
128 4
96 96 48 2 TYPE TYPE
144 3 WORD_3: WORD_48:
STRUCT STRUCT
upper_word : WORD; upper_dword : DWORD;
middle_word : WORD; lower_word : WORD;
lower_word : WORD; END_STRUCT;
END_STRUCT; END_TYPE
END_TYPE
128 128 64 2 TYPE unchanged
192 3 DWORD_2:
256 4 STRUCT
upper_dword : DWORD;
lower_dword : DWORD;
END_STRUCT;
END_TYPE
available for the given PLC as part of the IEC-61131-3 This means that, BYTEs (8-bit) are added as UINTs (16-
programming languages, and can be applied on the data size bit), the result indicating the state of the carry flag (C = 1
used by the individual elements of the used structures. when sum > 255 or C =sum.B8) which is to be added to
Fig. 4 shows the right circular shift operation by a number the sum of the next pair of BYTEs of the two encoding
of 3 bits (ROR3 ) as implemented on a block size of 24 structures involved in the addition and so on. Variables
bits (n=24), organized on the PLC as a structure with three of type WORD (16-bit), are added as UDINTs (32-bit), the
elements of type BYTE. The other needed rotations, to the carry out flag being bit 16 of the sum (or C = 1 when
left or right, with j bits, as demanded by each algorithm, sum > 65535) and the same procedure as above is applied
were implemented in a similar manner. to the next pair of WORDs to be added. The addition of
Another element which had to be addressed by our imple- DWORD (32-bit) elements, present in the structures encoding
mentation was the modulo 2n addition (ADD M OD 2n ). the n=64 bit data blocks, was done by decomposing the
The PLC is capable of performing unsigned integer addi- least significant DWORD into two WORDs (DWORD.W1 and
tion with numbers of the same size, which are represented DWORD.W0), which were added as UDINTs with the result-
on either 16 bits (UINT: unsigned int) or 32 bits (UDINT: ing C being added to the sum of the next pair of WORDs
unsigned double int). Conversion to these data types is and finally to the sum of the two DWORDs encoding the most
needed if addition between BYTEs, WORDs or DWORDs is significant bytes in the data block.
required. To illustrate the PLC implementation aspects of the mod-
At first glance, solving the modulo 2n addition problem ular addition, the case of the modulo-224 addition, applied
of two n-bit sequences requires summing the first elements using the 3-BYTE structures, is used as showcase in Fig. 5.
of the encoding structures, the detection of the carry out flag The second choice with respect to the data organization
(C) and its addition to the sum of the next elements of the used on the PLC (see Table I) faces the same problems in
two structures involved in the operation and so on. solving the rotations or the modulo 2n addition. A similar
However, for the given PLC, there is no predefined approach to the one described above was used.
mechanism of detecting the overflow in the addition of two It should be noted that for the case of SIMON and
variables having the same size. To overcome this problem, SPECK 48/72 and 48/96 the rotations are more easily im-
the addition is performed between the corresponding ele- plemented by making use of ROR_DWORD or ROL_DWORD
ments of the structures converted to the closest PLC data and then copying the necessary bits to the required positions.
type which enables the detection of the carry flag. Also, the modular addition is performed by adding the
BYTE BYTE BYTE
7 0 7 0 7 0
b23 b22 b21 b20 b19 b18 b17 b16 b 15 b 14 b 13 b 12 b 11 b 10 b 9 b 8 b7 b6 b5 b4 b3 b2 b1 b0
C C
two DWORDs as UDINTs and converting the result back of the 20 different algorithms was implemented as a distinct
to DWORD. In the case of SIMON and SPECK 96/96 PLC program and was allocated to the default task of the
and 96/144 the same procedures, as described above, were PLC. This task had a watchdog timer set at 500ms, which,
tailored to suit the data stored in the structures. as the results show, was never triggered.
As a result, the new data organization reduces the number The execution time for a given algorithm was determined
of operations needed to implement the rotations and the by considering 1000 calls for each of the two components
additions, thus reducing the execution time of the algorithms. (key expansion and encryption) of the algorithm. Different
The key expansion component of the SIMON algorithms, input data (key k, plaintext (x, y)) was considered on each
requires a predefined constant bit sequence z, of which call for both components. The execution time was assessed
round by round one bit is extracted and introduced, by means considering the two choices for data organization, discussed
of XOR operation, in the computation of the keys (see the in Section 3 and presented in Table I.
operation denoted by BIT T ESTb (z) in Fig. 2.a). The size Table II shows the execution time of SIMON and SPECK
and the bit sequence of this constant depend on the SIMON cryptographic algorithms as resulted from their implementa-
algorithm and on the number of rounds it uses, and varies tion on Phoenix Contact’s ILC 350 PN programmable logic
between 28 and 68 bits [10]. The necessary bit sequence controller.
can be stored using at most two DWORDs and one BYTE, or The results in Table II clearly show that the availability
less, depending on the algorithm. Access to the bit needed of proper PLC data types, which are able to accommodate
in the computation of the keys is done by identifying its as simply as possible the block size of the given algorithm
position inside the variable which stores it and using the variant, as well as the existence of predefined functions for
PLCs predefined BIT_TEST function to return it. the necessary operations, has a major influence on the com-
putation time of the algorithms. Even under these conditions,
IV. E XPERIMENTAL RESULTS the low execution times, correlated with the process time
The PLC used to support the implementation of SI- constants of industrial control applications, which most of
MON and SPECK families of cryptographic algorithms is the time extend well beyond 1ms, makes these algorithms
a product of Phoenix Contact, model ILC 350 PN, and good candidates to be used as extensions of the control logic
is programmable according to IEC 61131 using the PC implemented by the PLC, thus assuring a first step towards
WorX automation software (version 5 or later) [18]. The securing the incoming/outgoing communications.
measurable time base of the controller is of 1ms and is
provided by the so-called “system tick”. Since our initial V. C ONCLUSION
tests showed that the algorithms executed in less than We presented an implementation of the SPECK and
1ms, the following tests considered multiple calls on each SIMON family of lightweight block ciphers on a Pro-
algorithm. The total execution time for each set of calls was grammable Logical Controller (PLC) used in industrial
estimated by recording the number of elapsed ticks. Each automation systems. The implementations turned out to be
TABLE II
E XECUTION TIME OF SIMON AND SPECK CRYPTOGRAPHIC ALGORITHMS
data type-specific, a fact that was also confirmed by the [8] B. Genge, F. Graur, and P. Haller, “Experimental assessment
experimental results. It was demonstrated that the avail- of network design approaches for protecting industrial control
systems,” International Journal of Critical Infrastructure
ability of the appropriate data type significantly affects the Protection, vol. 11, pp. 24 – 38, 2015. [Online]. Available:
execution time of both ciphers. Therefore, while the analysed http://www.sciencedirect.com/science/article/pii/S1874548215000463
block ciphers can indeed be used in the application of PLCs, [9] B. Genge, P. Haller, and I. Kiss, “A framework for designing
resilient distributed intrusion detection systems for critical
the choice in the block and key size needs to be carefully infrastructures,” International Journal of Critical Infrastructure
analysed according to the supported data types. Protection, vol. 15, pp. 3 – 11, 2016. [Online]. Available:
http://www.sciencedirect.com/science/article/pii/S1874548216300816
[10] R. Beaulieu, D. Shors, J. Smith, S. Treatman-Clark, B. Weeks,
ACKNOWLEDGMENT and L. Wingers, “The simon and speck families of lightweight
block ciphers,” Cryptology ePrint Archive, Report 2013/404, 2013,
This work was supported by a grant of the Romanian http://eprint.iacr.org/2013/404.
National Authority for Scientific Research and Innovation, [11] R. Beaulieu, S. Treatman-Clark, D. Shors, B. Weeks, J. Smith, and
L. Wingers, “The simon and speck lightweight block ciphers,” in 2015
CNCS/CCCDI-UEFISCDI, project number PN-III-P2-2.1- 52nd ACM/EDAC/IEEE Design Automation Conference (DAC), June
BG-2016-0013, within PNCDI III. 2015, pp. 1–6.
[12] R. Nithya and D. S. Kumar, “Where {AES} is for internet, {SIMON}
could be for iot,” Procedia Technology, vol. 25, pp. 302 – 309,
R EFERENCES 2016, 1st Global Colloquium on Recent Advancements and Effectual
Researches in Engineering, Science and Technology - {RAEREST}
[1] R. Drath and A. Horch, “Industrie 4.0: Hit or hype? [industry forum],” 2016 on April 22nd-23rd April 2016. [Online]. Available:
IEEE Industrial Electronics Magazine, vol. 8, no. 2, pp. 56–58, June //www.sciencedirect.com/science/article/pii/S2212017316304583
2014. [13] R. Beaulieu, D. Shors, J. Smith, S. Treatman-Clark, B. Weeks,
[2] L. D. Xu, W. He, and S. Li, “Internet of things in industries: A and L. Wingers, “Simon and speck: Block ciphers for the inter-
survey,” IEEE Transactions on Industrial Informatics, vol. 10, no. 4, net of things,” Cryptology ePrint Archive, Report 2015/585, 2015,
pp. 2233–2243, Nov 2014. http://eprint.iacr.org/2015/585.
[3] M. Hagerott, “Stuxnet and the vital role of critical infrastructure oper- [14] B. Buhrow, P. Riemer, M. Shea, B. Gilbert, and E. Daniel, Block
ators and engineers,” International Journal of Critical Infrastructure Cipher Speed and Energy Efficiency Records on the MSP430: Sys-
Protection, vol. 7, no. 4, pp. 244 – 246, 2014. tem Design Trade-Offs for 16-Bit Embedded Applications. Cham:
[4] D. Goodin, “First known hacker-caused power outage signals Springer International Publishing, 2015, pp. 104–123.
troubling escalation,” http://arstechnica.com/security/2016/01/first- [15] C. Manifavas, G. Hatzivasilis, K. Fysarakis, and K. Rantos,
known-hacker-caused-power-outage-signals-troubling-escalation/, Lightweight Cryptography for Embedded Systems – A Comparative
2016, [accessed January 2016]. Analysis. Berlin, Heidelberg: Springer Berlin Heidelberg, 2014, pp.
[5] G. Liang, S. R. Weller, J. Zhao, F. Luo, and Z. Y. Dong, “The 2015 333–349.
ukraine blackout: Implications for false data injection attacks,” IEEE [16] T. Park, H. Seo, and H. Kim, “Parallel implementations of simon and
Transactions on Power Systems, vol. PP, no. 99, pp. 1–1, 2016. speck,” in 2016 International Conference on Platform Technology and
[6] B. Genge, P. Haller, C. D. Dumitru, and C. Enachescu, “Designing Service (PlatCon), Feb 2016, pp. 1–6.
optimal and resilient intrusion detection architectures for smart grids,” [17] K.-H. John and M. Tiegelkamp, Variables, Data Types and Common
IEEE Transactions on Smart Grid, vol. PP, no. 99, pp. 1–1, 2017. Elements. Berlin, Heidelberg: Springer Berlin Heidelberg, 2010, pp.
[7] B. Genge, P. Haller, and I. Kiss, “Cyber-security-aware network 67–97.
design of industrial control systems,” IEEE Systems Journal, vol. PP, [18] P. Contact, “User manual. installing and operating the ilc 330 and ilc
no. 99, pp. 1–12, 2015. 350 inline controllers,” Phoenix Contact Manual, 2014.