You are on page 1of 11

Learning Strategies for Cryptography Using

Embedded Systems

Edwar Jacinto, Fredy Martínez and Fernando Martínez

Abstract In the technological formation of students, specially for Technology and


Electronic Engineering at the District University Francisco José de Caldas of Colom-
bia, South America, it is required that students in addition of the theorical bases and
the use of tools possess skills in implementation of real applications, where the use
of mathematics in daily problems of engineering is necessary. Therefore, it is sought
to do academic exercises to have theorical components along with a strong practical
component, in this case, a secure information application, specifically a lightweight
block cipher type, designed in embedded systems and made in both hardware and
software. With this exercise, it is want to apply the knowledge acquired in the area of
embedded digital devices, whether using digital devices configurable FPGA type or
microcontroller devices. In this paper, an exercise of application using the smart ped-
agogy of lightweight cypher that is used as a tool for teaching the use of embedded
hardware and software platforms.

Keywords Problem-based learning ⋅ Significant learning ⋅ Embedded systems ⋅


Cypher block

1 Introduction

An application in digital electronic area using the know-how concept is wanted to


generate [9] and along with skills in the telecommunications area, in this way, to use it
as a smart teaching strategy in students of technology in electronic and especially for

E. Jacinto (✉) ⋅ F. Martínez ⋅ F. Martínez


District University Francisco José de Caldas, Bogotá D.C., Colombia
e-mail: ejacintog@udistrital.edu.co
URL: http://www.udistrital.edu.co
F. Martínez
e-mail: fhmartinezs@udistrital.edu.co
F. Martínez
e-mail: fmartinezs@udistrital.edu.co

© Springer International Publishing Switzerland 2016 495


V.L. Uskov et al. (eds.), Smart Education and e-Learning 2016,
Smart Innovation, Systems and Technologies 59,
DOI 10.1007/978-3-319-39690-3_44
496 E. Jacinto et al.

students from undergraduate and postgraduate of telecommunication engineering,


using the smart pedagogy strategy.
The need for secure communications, for different types of applications is ana-
lyzed, such applications can be made in configurable hardware [1, 18, 23], using
software embedded systems [5, 20], as an application for a mobile device or personal
computer, therefore the know-how applied in a smart pedagogy for the students to
teach a developer embedded systems, the main objective is that they acquire certain
skills in the know-how of the firmware developer, for this reason, this paper shows
the step by step of the implementation of the lightweight block cipher for applications
with small data transfer as a educational tool [3], for this task, a low cost embedded
hardware was used. In this way, they learn to make real applications in devices with
a low computational capacity [2, 8, 27].
When choosing block ciphers [4, 15] as one of the standard encryption schemes
[25], students must make a bibliographic revision of different algorithms and their
features [10, 14, 15] and the tests over embedded software systems type microcon-
troller [5, 13, 20]. To acquire the knowledge of data encryption specifically in block
ciphers they must understand the basics steps of AES algoritthm (Advanced Encryp-
tion Standard) [5, 14, 26] with the necessary mathematical bases.
In order to the students get the mathematics knowledge for the implementation
of called algorithms, this academic exercise tries to implement a block cypher to
achieve with the philosophy of lightweight by the possibility of making a hardware
and software.With this prior knowledge and making the respective bibliographic
revision, all possible algorithms to work, it is decided to work with the PRESENT
algorithm [6–8, 18, 23], since this is standardized by NIST and NSA [16, 19].
PRESENT is the smallest symmetric encryption algorithm as it uses substitution
and permutation blocks such as 4-bit basis. This word size allows that it suits to
reduced hardware devices or processors with a small bus also, it has wide keys rela-
tively small compared with other algorithms of the same type and requires a reduced
amount of rounds; on the other hand, from the point of view of design and imple-
mentation, it presents an interesting challenge, because it requires a strategy taking
into account the balance between amount of resource used and communication speed
system [3, 21, 24].
The paper is organized as follows. In Sect. 2 the basic concepts of cryptogra-
phy are discussed, Sect. 3 describes the design methodology of embedded system.
Section 4 analyses the performance by simulation. Section 5 shows some results.
Finally, conclusion is presented in Sect. 6.

2 Basic Concepts of Cryptology

The student before having read on the theoretical foundations of cryptographic


topography along with some concepts in finite fields of arithmetic, also to have clear
concepts of logical device programming and programmable microcontroller devices,
you must know the basic blocks of a block cipher. Now, some basic concepts of
Learning Strategies for Cryptography Using Embedded Systems 497

Fig. 1 Block Cipher

cryptography necessary to understand the academic exercise and with which the stu-
dent will generate respective data-path or pseudo codes to make both hardware and
software.

2.1 Block Cipher

In this type of encryption, the plain-text message is divided into blocks of n bits each
[7, 18]. The main feature of such ciphers is that each block is encrypted in the same
way, regardless of its place in the chain so all bits of the block are estimated together,
participating in operations that try to obscure the possible relationships they had with
the original message [22]. This can be seen in Fig. 1.
Symmetric algorithms encrypted text block, but this length change per each algo-
rithm.
In the block cipher four basic operations are performed:
∙ Electonic CodeBlock (ECB): within it blocks are ciphered separately.
∙ Cipher BlockChainning (CBC): the cryptogram blocks to relate between them
through OR excusive funtions.
∙ Cipher feedback (CFB): it is performed XOR between character or isolated bits of
the text along with the output to the algorithm.
∙ Output feedback (OFB): equal than CFB, it is performed XOR between character
or isolated bits of the text and the algorithms outputs, but this uses the feedback
between the output with the inputs, therefore it does not depend on text, it is a
generator of the random numbers.
The designer have to exactly know the algorithm to applied the concepts of pro-
gramming to do each of the blocks and this will be done on PLD device and embed-
ded systems.

2.2 Basic Operations of the Cipher Blocks

The basic operations of the cipher block algorithm are shown in the Fig. 2. They
could change depending on the proposed algorithm.
498 E. Jacinto et al.

Fig. 2 Round basic operation of a typical block cipher

For all of the cipher block is generated the combination of operations ByteSub,
ShiftRow, MixColum y AddRoundKey, or equivalent, when this subroutines execute
in one time is named round. the complex and security of the algorithm depending
on previous combining operations, the among of rounds made, with the key length
used [3, 4].
Each round is composed for three operations based on a uniform and invertible
transformations are named layer, which have been designed to resist the lineal and
differential cryptanalysis, they are shown next:
∙ No linear layer: It makes pass the data through the S box in parallel with non-
linearity optimal properties.
∙ Linear mix layer: It guaranties the high level of diffusion along the multiples lay-
ers.
∙ Key additions layer: It is applied for XOR operation between the intermediate state
and each round key.
After explaining each one, the functional blocks of any cipher. The next section,
the functional blocks of the PRESENT algorithm will be shown and analyzed.

2.3 PRESENT: Algorithm Structure

In the Fig. 3 the basic structure of the PRESENT algorithm is shown, it can see their
blocks and each one of their 31 rounds [8].
Learning Strategies for Cryptography Using Embedded Systems 499

Fig. 3 PRESENT algorithm


round

Fig. 4 PRESENT algorithm


structure in Pseudo-code

2.4 Algorithm: Pseudocode

The solution of the algorithm could be summarized in a simple pseudocode com-


patible with any embedded hardware or software platform [23]. This code is shown
next in the Fig. 4:
For each pseudo-code line, a function or method to perform the basic operations
of the cipher block algorithm must be created. The student must choose the options
between functions or tables for the substitutions operations for nibbles of the Sbox
layer and the operations of the Player [5, 17].
In this case, the use of the dynamic memory increases the execution time to per-
form the necessary calculus. Otherwise, when the tables are used, the processing
time will be reduced, but increasing the among of memory used to storage the sub-
stitution tables.
500 E. Jacinto et al.

Table 1 Test vector for PRESENT


Plaintext Key Ciphertext
00000000 00000000 00000000 00000000 0000 5579C138 7B228445
00000000 00000000 FFFFFFFF FFFFFFFF FFFF E72C46C0 F5945049
FFFFFFFF FFFFFFFF 00000000 00000000 0000 A112FFC7 2F68417B
FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFF 3333DCD3 213210D2

In embedded systems, the among of memory is short, for this reason the stu-
dents have to check and analyse what the best way to describe the algorithm is. After
that, simulations and resources reports are necessary to determine which is the best
methodology to guarantee the algorithm be lightweight type [2, 3, 7].

2.5 Test Vectors

For verification to the algorithm works in a good way, the makers of the algorithm [8]
give a table in Hexadecimal notation, the plain text with their respective encrypted
known text after mixing with certain key is shown in the Table 1:

3 Desing Methodology for Embebdded Systems

In the last decade the revolution of the digital programmable devices field has been an
significant increase, which has allowed the possibilities to make designs with a high
performance in a small devices and low price [11]. For this advantage, it is possible
to make designs of the lightweight ciphers algorithms in a embedded systems type
hardware [9] and software [5]. For this reason as the universe of possible devices is
infinitive, the study case requires a check the most relevance characteristics of the
logic programmable devices and microcontroller in our local market [5].
The design meets with the Top-Down methodology and requires a certain number
of phases, in dependence of the tool, but the general list of this steps are shown next
[12]:
∙ Description a system level.
∙ Description a behaviour level.
∙ Validation (verification).
∙ Co-simulation.
∙ Estimation performance.
When the designer wants to make a whole system with different sub-systems,
He must follow the next steps to get a correct verification of the algorithm. This
procedure is called map and mapping and partitioning [11, 12]:
Learning Strategies for Cryptography Using Embedded Systems 501

∙ Functional specification input.


∙ List of the inputs/outputs of the architectures HW/SW.
∙ Interconnection mechanisms.
∙ Optimization functions cost, time, area, communication.
∙ Hardware synthesis in the different abstraction levels.
∙ Software synthesis to make simple and concurrent algorithms.
∙ Interface synthesis a buses level,communications mechanisms.
When the student has the methodology of design cleared, He must generate the
standard code, scalable and reusable. This task is achieved when he has followed the
steps shown above.
To complete the implementation, the designer requires to make a technical review
of the embedded devices and platforms, in this case, the student should make a search
in the local market of the microcontrollers, microprocessors and PLD’s suitable to
bear the PRESENT algorithm. The technical characteristics to compare the devices
and platforms are shown next: standard architecture, price, available compilers (free
or with license), programming languages (standard code), memory, speed, available
in the local market [5].
For the PLD’s devices, the student will choose a popular hardware description
language, the use of the standard tool allows the change of the device in any moment,
but the designer has prohibited the use of the IP (intellectual property) cores and
another tool with restrictions to change the code to another device manufacturer.
After analysing the problem of lightweight block cypher using hardware description
languages, the Universidad Distrital advices to use VHDL with ISE Xilinx software,
since the university has that tool with a student license and a complete laboratory
using medium and low cost devices of this brand.
On the other hand, the university has microcontollers of Microchip TM with
processor bus width 8 and 16 bits, each one with the compiler license and devel-
oper boards, this software has a standard C compiler with the respective support for
debugging and simulation. Other advantage is the compatibility of this microcon-
trollers in theirs different families, it is possible to change de device and it keep the
useful of the all pins. As families of 32 bits the microcontroller ARM Cortex-M0
with development board KL25Z have been chosen, this due has a free online com-
piler available to work in C and C++, the capabilities to manage pointers, dynamic
memory addressing, control of versions and formatting code with mercurial, low
cost, easy to programming, debugging and load programs, big amount of embed-
ded modules and other advantage is the on-line community which create a libraries
every single day, by last, this architecture bear the complete versions of different
RTOS (Real Time Operation Systems).
502 E. Jacinto et al.

Fig. 5 Hardware implementation simulation

4 Checking Algorithm: Simulations and Tests

For the result measuring of the PRESENT algorithm implementation over microcon-
trollers and PLD’s devices, it will be used the ciphering and desciphering functions
with 80 bits key length and 64 bits data blocks.
For each microcontrollers platform is necessary to define certain metrics: pro-
gram memory (FLASH), data memory (RAM) and throughput would be consider.
Depending on the previous metrics, they must be taken into account: the processor
bus length, pointers hardware, functions or manage of tables and the speed of the
CPU system measured in MIPS (Million Instruction Per Second).
As to PLD’s, the metrics are totally different, the throughput importance increases
due to the parallelism of the devices, it is searched the reduction of the resources
measured in Slices (CLB-GE).
The student must probed the algorithm through simulations using the test vectors,
one of this tests is shown in the Fig. 5:
To probe the firmware in the microcontrollers, initially the students should write
a standard code in C language, this procedure with the help of the intermediate steps
of the hardware simulation shows above en the Fig. 5. The simulation or implementa-
tion would change on depending of the device chosen. With the reports thrown from
the compiler, it is possible to compare de metrics of the different implementations.
Real tests with a measuring of one pin of the device could be made.

5 Results

This hardware and software tools were used in a test group of 10 undergraduate stu-
dents of the seed research annexed to DIGITI (Smart Digital Systems) and ARMOS
(Modern Architectures to Power Supply Systems). The research groups had worked
with the students in the second semester of the 2015, a quick bonding was achieved
Learning Strategies for Cryptography Using Embedded Systems 503

with their research projects. Because the students have got the theorical concepts and
they have acquired skills designing and working on embedded systems.
A collateral effect was seen with the increase in the academic interest of the stu-
dents in their different activities and major compromise with the researching group.
DIGITI researching group have got big amount of thesis, in the field of the cryptology
and cryptography, so far it has two undergraduate thesis, one of them in lightweight
block cipher algorithm HIGH implementation in microcontroller, the second one in
the HSM implementation in a 32 bits microcontroller. The research group just ended
the new work master thesis, this task is going to increases the performance of the
CLEFIA algorithm in a 32 bits microcontroller.

6 Conclusions

With this educational exercise the research group achieves two undergraduate and
one master thesis, without delays on the mathematical foundation; this methodology
guarantee the success of the learning process on the seed research. Students in the
firsts semesters could work in a real project which to prepare the degree work. The
mathematical foundation in the cryptology has been complicated to the undergrad-
uate students, our methodology had decreased the development time of the mathe-
matical knowledge application using the embedded systems over a real problem.
On the other hand it was detected that the design and implementation of these
ciphered algorithms on programmable logic devices clinched all previous knowl-
edgement of group students. They improves their skills on combinational and sequen-
tial digital circuits, finite state machines and of course, devices description using
VHDL and Verilog. That is why, ARMOS and DIGITI researching groups will pro-
pose to implement similar issues as practical projects for digital circuits courses for
electrical and electronical technology students. It will work as a final course project
and it is possible that it improves the learning process in that area.

Acknowledgments This work was supported by the District University Francisco Jos de Caldas,
in part through CIDC, and partly by the Technological Faculty. The views expressed in this paper
are not necessarily endorsed by District University. The authors thank the research groups DIGITI
and ARMOS for the evaluation carried out on prototypes of ideas and strategies.

References

1. Abdellatif, K.M., Chotin-Avot, R., Mehrez, H.: Lightweight and compact solutions for secure
reconfiguration of FPGAs. In: 2013 International Conference on Reconfigurable Computing
and FPGAs (ReConFig), pp. 1–4 (2013)
2. Alkhzaimi, H.A., Lauridsen, M.M.: Cryptanalysis of the simon family of block ciphers. Tech-
nical University of Denmark 1(1), 1–26 (2013)
3. Attridge, J.: An overview of hardware security modules. SANS Institute, InfoSec Reading
Room 1(1), 1–10 (2002)
504 E. Jacinto et al.

4. Aysu, A., Gulcan, E., Schaumont, P.: SIMOn says: break area records of block ciphers on
FPGAs. IEEE Embed. Syst. Lett. 6(2), 37–40 (2014)
5. Azuero, R., Jacinto, E., Castano, J.: A low-memory implementation of 128 aes for 32 bits
architectures. En Congreso Argentino de Sistemas Embebidos CASE, pp. 67–73 (2012)
6. Beaulieu, R., Shors, D., Smith, J.: The simon and speck block ciphers on avr 8-bit microcon-
trollers. In: LightSec 2014 Proceedings, vol. 1, no. 1, pp. 1–18 (2014)
7. Beaulieu, R., Shors, D., Smith, J., Treatman-Clark, S., Weeks, B., Wingers, L.: The simon and
speck families of lightweight block ciphers. Cryptology ePrint Archive, Report 2013/404 (4)
(2013). http://eprint.iacr.org/
8. Bogdanov, A., Knudsen, L., Leander, G., Paar1, C.: PRESENT: An Ultra-Lightweight Block
Cipher, chap. 5, pp. 450–466. Springer-Verlag Berlin Heidelberg (2007)
9. Camargo, C.: Teching/learning methods for embedded systems using copyleft hardware. IEEE
(Rev. IEEE Am. Lat.) Lat. Am. Trans. 9(4), 503–509 (2011)
10. Chih-Peng, F., Jun-Kui, H.: Implementations of high throughput sequential and fully pipelined
AES processors on FPGA. In: International Symposium on Intelligent Signal Processing and
Communication Systems ISPACS 2007, pp. 353–356 (2007)
11. Delgadillo, A., Pena, N., Guerrero, M.: Diseno de un criptosistema para redes de sensores
inalambricos WSN basado en MPSOC. Master’s thesis, Universidad de los Andes (2008)
12. Densmore, D., Passerone, R.: A platform-based taxonomy for esl design. IEEE Des. Test Com-
put. 23(5), 359–374 (2006)
13. Engels, S., Kavun, E., Paar, C., Yalcin, T., Mihajloska, H.: A non-linear/linear instruction set
extension for lightweight ciphers. In: 2013 21st IEEE Symposium on Computer Arithmetic
(ARITH), pp. 67–75 (2013)
14. Fan, C.P., Hwang, J.K.: Implementations of high throughput sequential and fully pipelined
AES processors on FPGA. In: International Symposium on Intelligent Signal Processing and
Communication Systems, 2007. ISPACS 2007, pp. 353–356 (2007)
15. Feizi, S., Ahmadi, A., Nemati, A.: A hardware implementation of simon cryptography algo-
rithm. In: 2014 4th International eConference on Computer and Knowledge Engineering
(ICCKE), pp. 245–250 (2014)
16. Hanley, N., O’Neill, M.: Hardware comparison of the ISO/IEC 29192-2 Block ciphers. In:
IEEE Computer Society Annual Symposium on VLSI (ISVLSI), 2012, pp. 57–62 (2012)
17. Kavun, E., Leander, G., Yalcind, T.: A reconfigurable architecture for searching optimal soft-
ware code to implement block cipher permutation matrices. In: 2013 International Conference
on Reconfigurable Computing and FPGAs (ReConFig), pp. 1–8 (2013)
18. Kavun, E., Yalcin, T.: RAM-based ultra-lightweight FPGA implementation of present. In: 2011
International Conference on Reconfigurable Computing and FPGAs (ReConFig), pp. 280–285
(2011)
19. Klinc, D., Hazay, C., Jagmohan, A., Krawczyk, H., Rabin, T.: On compression of data
encrypted with block ciphers 58(11), 6989–7001 (2012)
20. Kumar, M., Singhal, A.: Efficient implementation of advanced encryption standard (AES) for
arm based platforms. In: 2012 1st International Conference on Recent Advances in Information
Technology (RAIT), pp. 23–27 (2012)
21. Mane, S., Taha, M., Schaumont, P.: Efficient and side-channel-secure block cipher implemen-
tation with custom instructions on FPGA. In: 2012 22nd International Conference on Field
Programmable Logic and Applications (FPL), pp. 20–25 (2012)
22. Pineda, N., Velasquez, N.: Diseño e implementación de un prototipo criptoprocesador AES-
Rijndael en FPGA. Master’s thesis, Universidad de Los Llanos (2007)
23. Pospiil, J., Novotny, M.: Evaluating cryptanalytical strength of lightweight cipher present
on reconfigurable hardware. In: 2012 15th Euromicro Conference on Digital System Design
(DSD), pp. 560–567 (2012)
24. Qatan, F., Damaj, I.: High-speed katan ciphers on-a-chip. In: 2012 International Conference
on Computer Systems and Industrial Informatics (ICCSII), pp. 1–6 (2012)
25. Shuangqing Wei, L., Wang, J., Yin, R., Yuan, J.: Trade-off between security and performance
in block ciphered systems with erroneous ciphertexts 8(4), 636–645 (2013)
Learning Strategies for Cryptography Using Embedded Systems 505

26. Tay, J.J., Wong, M.M., Hijazin, I.: Compact and low power AES block cipher using lightweight
key expansion mechanism and optimal number of s-boxes. In: 2014 International Symposium
on Intelligent Signal Processing and Communication Systems (ISPACS), pp. 108–114 (2014)
27. Yalla, P., Kaps, J.: Lightweight cryptography for FPGAs. In: International Conference on
Reconfigurable Computing and FPGAs, 2009. ReConFig’09, pp. 225–230 (2009)

You might also like