# Timed Automaton-Based Quantitative Feasibility Analysis of Symmetric Cipher in Embedded RTOS: A Case Study of AES

Authors: Yawen Ke; Xiaofeng Xia
Journal: Security and Communication Networks
 (2022)

---

## Abstract

The real-time operating system (RTOS) has a wide range of application domains and provides devices with the ability to schedule resources. Because of the restricted resources of embedded devices and the real-time constraints of RTOS, the application of cryptographic algorithms in these devices will affect the running systems. The existing approaches for RTOS ciphers’ evaluation are mainly provided by experimental data performance analysis, which, however, lack a clear judgment on the affected RTOS performance indicators, such as task schedulability, bandwidth, as well as a quantitative prediction of the remaining resources of RTOS. By focusing on task schedulability in RTOS, this paper provides a timed automaton-based quantitative approach to judge the feasibility of ciphers in embedded RTOS. First, a cryptographic algorithm execution overhead estimation model is established. Then, by combining the overhead model with a sensitivity analysis method, we can analyze the feasibility of the cryptographic algorithm. Finally, a task-oriented and timed automaton-based model is built to verify the analysis results. We take AES as a case study and carry out experiments on embedded devices. The experimental results show the effectiveness of our approach, which will provide specific feasibility indicators for the application of cryptographic algorithms in RTOS.


---

## Body

## 1. Introduction

### 1.1. Motivation

For applications in critical fields such as industrial control systems (ICSs), aerospace, national defense and military, and communications, most of the embedded devices play an important role and undertake a large number of operation and control tasks. In embedded devices with complex functions, embedded systems are generally used to improve resource utilization. To take the needs of real-time control into account, embedded devices are usually equipped with RTOS, includingμ C/OS-II, eCos, FreeRTOS, Mbed OS, RTX, and Vxworks. In recent years, with the development of the Internet of Things (IoT), increasing embedded devices are connected to the Internet for data transmission and realize more functions. From the perspective of security, this also brings new challenges. As a key component, the security of embedded devices is related to the overall security of the system, so it is necessary to add security technology protection to embedded devices.However, due to its resource constraints and real-time restrictions of RTOS, most embedded RTOSs will encounter an adaptability problem when implementing security technologies. Taking cryptographic algorithms as an example, in embedded RTOS, the application of ciphers will cause additional overhead based on the original tasks, which not only leads to an increase in the utilization of hardware resources such as processor, RAM, and FLASH, but the longer execution time after encryption also affects the schedulability of tasks in the system and further affects the RTOS real-time performance even at the normal realization of system functions.It can be seen that when the current common cryptographic algorithms are implemented on resource-constrained devices, the performance of the embedded RTOS may be clearly affected by them. At present, the most common cryptographic algorithms are aimed at PCs, servers, and smart mobile devices that do not require high real-time performance and have sufficient resources. Therefore, how to ensure that they can be effectively deployed in embedded RTOS has become a new challenge. Furthermore, how to quantitatively evaluate the cryptographic algorithm configuration allowed by embedded RTOS has also become the focus of security researchers.On the evaluation of cryptographic algorithms on embedded devices, the performance [1, 2] of cryptographic algorithms on different devices and simple models of cryptographic overhead [3–6] are presented in prior work. Meanwhile, in the task scheduling problem of RTOS, the existing work indicates that there is a sensitivity analysis method, which can calculate the feasible region of the task set. This brings us to present: we wonder whether we can combine the cryptographic algorithm overhead model and the sensitivity analysis method to achieve a quantitative measure of the cryptographic algorithm feasibility in the RTOS task set. This is the primary motivation for this study.


### 1.2. Our Contribution

In this paper, we present a method to provide a quantitative evaluation of the feasibility of ciphers in embedded RTOS. First, we propose a model for symmetric cryptographic algorithm overhead prediction; then, we combine the sensitivity analysis method to analyze the feasibility of the cryptographic algorithm. Finally, the model based on task automaton is used to verify the analysis results formally. Our major contributions can be summarized as follows:(i)
We analyze the encryption and decryption processes of symmetric ciphers (AES−Rijndael) and construct a model according to the instruction set of the application platform to predict the time overhead of the cipher execution(ii)
By applying the sensitivity analysis method to handle the scheduling problem, we analyze the parameter feasible space of the original task set and combine the cost model to quantify the performance upper bound of the cryptographic algorithm in this task set, that is, the upper throughput bound(iii)
We use the labeled transition system (LTS) to give the definition of schedulability of the task automaton model and verify our analysis results by modeling the case in the formal verification tool Uppaal to evaluate the impact of ciphers on the real-time performance of the system(iv)
We port FreeRTOS to a real embedded platform and implement our case. The tracked running data prove the practicability of our proposed evaluation method.


### 1.3. Organization

The rest of this paper is organized as follows: Section2 introduces RTOS and the execution on STM32F103 core Cortex-M3. Section 3 introduces the symmetric cryptographic algorithms in detail and models the algorithm’s overhead estimation on the platform. Section 4 defines the task automaton and the quantitative definition of schedulability. Section 5 mainly describes the experimental method of this paper, including embedded experiments and validation of the automaton model with formal tools. Before giving the conclusions and prospects in Section 8, we present the experimental data and analyze our evaluation model in Section 6 and discuss prior work related to this paper in Section 7.


## 1.1. Motivation

For applications in critical fields such as industrial control systems (ICSs), aerospace, national defense and military, and communications, most of the embedded devices play an important role and undertake a large number of operation and control tasks. In embedded devices with complex functions, embedded systems are generally used to improve resource utilization. To take the needs of real-time control into account, embedded devices are usually equipped with RTOS, includingμ C/OS-II, eCos, FreeRTOS, Mbed OS, RTX, and Vxworks. In recent years, with the development of the Internet of Things (IoT), increasing embedded devices are connected to the Internet for data transmission and realize more functions. From the perspective of security, this also brings new challenges. As a key component, the security of embedded devices is related to the overall security of the system, so it is necessary to add security technology protection to embedded devices.However, due to its resource constraints and real-time restrictions of RTOS, most embedded RTOSs will encounter an adaptability problem when implementing security technologies. Taking cryptographic algorithms as an example, in embedded RTOS, the application of ciphers will cause additional overhead based on the original tasks, which not only leads to an increase in the utilization of hardware resources such as processor, RAM, and FLASH, but the longer execution time after encryption also affects the schedulability of tasks in the system and further affects the RTOS real-time performance even at the normal realization of system functions.It can be seen that when the current common cryptographic algorithms are implemented on resource-constrained devices, the performance of the embedded RTOS may be clearly affected by them. At present, the most common cryptographic algorithms are aimed at PCs, servers, and smart mobile devices that do not require high real-time performance and have sufficient resources. Therefore, how to ensure that they can be effectively deployed in embedded RTOS has become a new challenge. Furthermore, how to quantitatively evaluate the cryptographic algorithm configuration allowed by embedded RTOS has also become the focus of security researchers.On the evaluation of cryptographic algorithms on embedded devices, the performance [1, 2] of cryptographic algorithms on different devices and simple models of cryptographic overhead [3–6] are presented in prior work. Meanwhile, in the task scheduling problem of RTOS, the existing work indicates that there is a sensitivity analysis method, which can calculate the feasible region of the task set. This brings us to present: we wonder whether we can combine the cryptographic algorithm overhead model and the sensitivity analysis method to achieve a quantitative measure of the cryptographic algorithm feasibility in the RTOS task set. This is the primary motivation for this study.


## 1.2. Our Contribution

In this paper, we present a method to provide a quantitative evaluation of the feasibility of ciphers in embedded RTOS. First, we propose a model for symmetric cryptographic algorithm overhead prediction; then, we combine the sensitivity analysis method to analyze the feasibility of the cryptographic algorithm. Finally, the model based on task automaton is used to verify the analysis results formally. Our major contributions can be summarized as follows:(i)
We analyze the encryption and decryption processes of symmetric ciphers (AES−Rijndael) and construct a model according to the instruction set of the application platform to predict the time overhead of the cipher execution(ii)
By applying the sensitivity analysis method to handle the scheduling problem, we analyze the parameter feasible space of the original task set and combine the cost model to quantify the performance upper bound of the cryptographic algorithm in this task set, that is, the upper throughput bound(iii)
We use the labeled transition system (LTS) to give the definition of schedulability of the task automaton model and verify our analysis results by modeling the case in the formal verification tool Uppaal to evaluate the impact of ciphers on the real-time performance of the system(iv)
We port FreeRTOS to a real embedded platform and implement our case. The tracked running data prove the practicability of our proposed evaluation method.


## 1.3. Organization

The rest of this paper is organized as follows: Section2 introduces RTOS and the execution on STM32F103 core Cortex-M3. Section 3 introduces the symmetric cryptographic algorithms in detail and models the algorithm’s overhead estimation on the platform. Section 4 defines the task automaton and the quantitative definition of schedulability. Section 5 mainly describes the experimental method of this paper, including embedded experiments and validation of the automaton model with formal tools. Before giving the conclusions and prospects in Section 8, we present the experimental data and analyze our evaluation model in Section 6 and discuss prior work related to this paper in Section 7.


## 2. Background

### 2.1. RTOS and FreeRTOS

A real-time operating system (RTOS) is a kind of operating system that guarantees the completion of functions within a certain time limit. RTOS is divided into hard real time and soft real time. Hard RTOS requires the operations to be completed within the specified time, which is guaranteed by the design of the operating system, while for soft RTOS, the operations are completed as quickly as possible according to the priority of the tasks. A real-time task scheduler must be included in an RTOS to allocate CPU time strictly according to priority.In RTOS, a task is an executable program unit. Tasks can be divided into two types: periodic and nonperiodic, depending on whether there are periodic changes during task execution. On the one hand, for periodic tasks, the external device periodically sends out an excitation signal to the computer, requiring it to execute cyclically according to a specified period so as to periodically control a certain external device. On the other hand, nonperiodic tasks are different. Excitation signals sent by external devices have no obvious periodicity, but they must be linked to a deadline. It can be divided into two parts: start deadline (task must be executed before a certain time) and completion deadline (task must be completed before a certain time).The task cycles of periodic tasks generally include task initial offset, deadline, WCET (worst-case execution time), and WCRT (worst-case response time). A periodic task model can be expressed, as shown in Figure1.Figure 1
Periodic task execution parameters.In the embedded field, RTOS is widely used. The application of embedded RTOS can make more reasonable and effective use of CPU resources, simplify the design of application software, shorten the system development time, and ensure the real-time performance and reliability of the system better. FreeRTOS is a mini RTOS kernel with the following characteristics: open-source code, portability, scalable, and flexible scheduling strategy. It can be easily ported to various embedded devices. FreeRTOS has no limit on the number of system tasks, and meanwhile, the scheduling algorithm supports priority and round-robin scheduling algorithms.


### 2.2. Execution on STM32 Cortex-M3

The internal structure of the CPU divides the execution of an instruction into three stages: fetch, decode, and execute. In the first phase, one or more instructions are loaded from the program counter points. Then, in the next state, the instruction is decoded, the opcodes in the instruction register are taken out, and the instruction is analyzed. After recognition, the instruction will be executed. During execution, it may also need to access the memory bus, depending on what the opcode does.The popular 32-bit Cortex-M architecture uses the ARM Thumb-2 instruction set [7]. This instruction set opcodes are encoded in a narrow 16-bit or a wide 32-bit form. Most of the instructions in Cortex-M require one or two clock cycles to execute, and for load/store operation, there is an additional overhead that is proportional to the amount of data to load or store.Like the other architectures in the Cortex-M series, M3 is based on Harvard memory architecture. This means that data and instructions are accessed through different buses, so the loading, decoding, and execution of instructions can be parallelized. This feature is called pipelining, as shown in Figure2. When the CPU executes the first instruction, it can fetch the next instruction in the same clock cycle. However, if the CPU has prefetched the instruction and fills the pipeline, but it notices that the prefetched instruction is not the next line to execute during the decoding phase, the pipeline needs to be refreshed and repopulated with the correct instruction.Figure 2
Pipelined instruction execution.Besides pipeline operation, bus contention and cache also have a great impact on the actual runtime of the system. When devices on the bus are working beyond their designed speed, the bus mediation may fail, which leads to bus competition. Cache misses are associated with the overhead of performing actual reads from the bus because the access to cached data is usually the orders of magnitude faster.STM32 series products have an official cryptographic algorithm library. It provides a series of compact implementations of cryptographic algorithms [8] on the platform. We decompile the binary files generated by compiling the cryptographic algorithm library to get the assembly code under the Thumb-2 instruction set; then, we analyze the code structure based on the implementation of the cryptographic algorithm. We also classified the instructions for the Thumb-2 instruction set in Table 1.Table 1
Thumb-2 instruction grouping and cycle count.
GroupnameDescriptionExamplesCycle countAddsubAddition and subtractionADC, ADD, SBC, SUB, ADDW, SUBWADC {S}, ADD {S}, RSB {S}, SBC {S}, SUB {S}1 (+P)BranchesBranch on condition codeB<cond>, B, BL, BX, BLX1 +PBitwiseBitwise operationsAND, BIC, EOR, ORR, NEG, LSL, LSR, TST, REV, UBFX, AND {S}, BIC {S}, EOR {S}, ORR {S}, LSL{S}, LSR {S}1 (+P)ls singleLoad store single operationsLDR, LDRB, LDRH, LDRSB, LDRSH, STR, STRB, STRH2 (+P)ls multipleLoad store multiple operationsLDMIA, POP, PUSH1 +N (+P)MovFamily of move operationsMOV, MOV {S}, MOVW, MOVT1 (+P)ExtendedExtendedIT and NOP (includes YIELD).0-1MiscMiscellaneousSXTB, SXTH, UXTB, UXTH, CMP, CBZ1In Table1, P represents the pipe reload. Branches take 1 cycle for instruction and then pipeline reload for target instruction. Nontaken branches are 1 cycle totally. Taken branches with an immediate are normally 1 cycle of pipeline reload (2 cycles total). Taken branches with register operand are normally 2 cycles of pipeline reload (3 cycles total). +P means that the pipe reload is counted conditionally when the PC is destined or loaded. N represents the count of elements. Generally, load-store instructions take 2 cycles for the first access and 1 cycle for each additional access. Stores with immediate offsets take 1 cycle.


## 2.1. RTOS and FreeRTOS

A real-time operating system (RTOS) is a kind of operating system that guarantees the completion of functions within a certain time limit. RTOS is divided into hard real time and soft real time. Hard RTOS requires the operations to be completed within the specified time, which is guaranteed by the design of the operating system, while for soft RTOS, the operations are completed as quickly as possible according to the priority of the tasks. A real-time task scheduler must be included in an RTOS to allocate CPU time strictly according to priority.In RTOS, a task is an executable program unit. Tasks can be divided into two types: periodic and nonperiodic, depending on whether there are periodic changes during task execution. On the one hand, for periodic tasks, the external device periodically sends out an excitation signal to the computer, requiring it to execute cyclically according to a specified period so as to periodically control a certain external device. On the other hand, nonperiodic tasks are different. Excitation signals sent by external devices have no obvious periodicity, but they must be linked to a deadline. It can be divided into two parts: start deadline (task must be executed before a certain time) and completion deadline (task must be completed before a certain time).The task cycles of periodic tasks generally include task initial offset, deadline, WCET (worst-case execution time), and WCRT (worst-case response time). A periodic task model can be expressed, as shown in Figure1.Figure 1
Periodic task execution parameters.In the embedded field, RTOS is widely used. The application of embedded RTOS can make more reasonable and effective use of CPU resources, simplify the design of application software, shorten the system development time, and ensure the real-time performance and reliability of the system better. FreeRTOS is a mini RTOS kernel with the following characteristics: open-source code, portability, scalable, and flexible scheduling strategy. It can be easily ported to various embedded devices. FreeRTOS has no limit on the number of system tasks, and meanwhile, the scheduling algorithm supports priority and round-robin scheduling algorithms.


## 2.2. Execution on STM32 Cortex-M3

The internal structure of the CPU divides the execution of an instruction into three stages: fetch, decode, and execute. In the first phase, one or more instructions are loaded from the program counter points. Then, in the next state, the instruction is decoded, the opcodes in the instruction register are taken out, and the instruction is analyzed. After recognition, the instruction will be executed. During execution, it may also need to access the memory bus, depending on what the opcode does.The popular 32-bit Cortex-M architecture uses the ARM Thumb-2 instruction set [7]. This instruction set opcodes are encoded in a narrow 16-bit or a wide 32-bit form. Most of the instructions in Cortex-M require one or two clock cycles to execute, and for load/store operation, there is an additional overhead that is proportional to the amount of data to load or store.Like the other architectures in the Cortex-M series, M3 is based on Harvard memory architecture. This means that data and instructions are accessed through different buses, so the loading, decoding, and execution of instructions can be parallelized. This feature is called pipelining, as shown in Figure2. When the CPU executes the first instruction, it can fetch the next instruction in the same clock cycle. However, if the CPU has prefetched the instruction and fills the pipeline, but it notices that the prefetched instruction is not the next line to execute during the decoding phase, the pipeline needs to be refreshed and repopulated with the correct instruction.Figure 2
Pipelined instruction execution.Besides pipeline operation, bus contention and cache also have a great impact on the actual runtime of the system. When devices on the bus are working beyond their designed speed, the bus mediation may fail, which leads to bus competition. Cache misses are associated with the overhead of performing actual reads from the bus because the access to cached data is usually the orders of magnitude faster.STM32 series products have an official cryptographic algorithm library. It provides a series of compact implementations of cryptographic algorithms [8] on the platform. We decompile the binary files generated by compiling the cryptographic algorithm library to get the assembly code under the Thumb-2 instruction set; then, we analyze the code structure based on the implementation of the cryptographic algorithm. We also classified the instructions for the Thumb-2 instruction set in Table 1.Table 1
Thumb-2 instruction grouping and cycle count.
GroupnameDescriptionExamplesCycle countAddsubAddition and subtractionADC, ADD, SBC, SUB, ADDW, SUBWADC {S}, ADD {S}, RSB {S}, SBC {S}, SUB {S}1 (+P)BranchesBranch on condition codeB<cond>, B, BL, BX, BLX1 +PBitwiseBitwise operationsAND, BIC, EOR, ORR, NEG, LSL, LSR, TST, REV, UBFX, AND {S}, BIC {S}, EOR {S}, ORR {S}, LSL{S}, LSR {S}1 (+P)ls singleLoad store single operationsLDR, LDRB, LDRH, LDRSB, LDRSH, STR, STRB, STRH2 (+P)ls multipleLoad store multiple operationsLDMIA, POP, PUSH1 +N (+P)MovFamily of move operationsMOV, MOV {S}, MOVW, MOVT1 (+P)ExtendedExtendedIT and NOP (includes YIELD).0-1MiscMiscellaneousSXTB, SXTH, UXTB, UXTH, CMP, CBZ1In Table1, P represents the pipe reload. Branches take 1 cycle for instruction and then pipeline reload for target instruction. Nontaken branches are 1 cycle totally. Taken branches with an immediate are normally 1 cycle of pipeline reload (2 cycles total). Taken branches with register operand are normally 2 cycles of pipeline reload (3 cycles total). +P means that the pipe reload is counted conditionally when the PC is destined or loaded. N represents the count of elements. Generally, load-store instructions take 2 cycles for the first access and 1 cycle for each additional access. Stores with immediate offsets take 1 cycle.


## 3. Cryptography Algorithm Analysis

### 3.1. Cipher Analysis Model

To evaluate the impact of the use of cryptographic algorithms on embedded devices, we need to model the resource usage of these ciphers in terms of clock cycles. For a certain microcontroller, the software implementation of cryptographic algorithms is finally determined by the corresponding instructions, and the overhead of the assembly instruction is also fixed. On this basis, we propose an instruction-level overhead model for cryptographic algorithm implementation. The dominant idea of this method is to extract and simplify the assembly instructions in implementing the ciphers; then, by counting the number of instructions and clock cycles required for execution, we can estimate the computational overhead. Essentially, a mathematical model for the overheads of ciphers can be expressed as follows:(1)Ocipher=∑OinsiNinsi,where Ocipher represents the overhead of a kind of the cryptographic algorithm, Oinsi and Ninsi are the overhead and occurrence number of each kind of assembly instructions.From the perspective of assembly instruction-level analysis, we can use the instruction cycle to estimate the running cost of the program. For a cryptographic algorithm, we can abstract the model that expresses its structural features according to the algorithm flow. Taking the block cipher as an example, it can be represented by the following model:(2)Oexectext_len=Oinitial+Oappend+Ofinish=Omisc_proc+Nr·Or+Ob_proc⋅Nb=Omisc_proc+Nr·Or+Ob_proc⋅text_lenblock_size,where Oexectext_len represents the overhead required to process a piece of content with a length of text_len, Oinitial, Oappend, and Ofinish are the overhead of these 3 phases of the cryptographic algorithm, Omisc_proc includes all other overheads except block processing, including initial and finish overhead, Or and Nr are the overhead of each round and the number of rounds, respectively, Ob_proc is the overhead of processing and appending blocks, which depends on the block size and cryptographic mode it applied, and Nb is the number of blocks.


### 3.2. AES-Rijndael

Rijndael is an iterative block cipher with a variable block and a key length. AES (the Advanced Encryption Standard) [9] is a special implementation of the Rijndael algorithm. The block size of AES is fixed to be 128 bits (16 bytes), the key can be 128, 192, and 256 bits (16, 24, and 32 bytes), and the number of rounds Nr can be 10, 12, and 14, respectively.The input of the AES algorithm is a 128-bit block mapped to a byte array named “State”, and the operations of AES encryption and decryption are performed on the State. The number of roundsNr depends on the key length; a 16 -byte key corresponds to 10 rounds, a 24-byte key corresponds to 12 rounds, and a 32-byte key corresponds to 14 rounds. The first Nr−1 rounds comprise 4 different transformations: SubBytes, shiftRows, Mix Columns, and AddRoundKeys, while the last round only contains 3 transformations except the Mix Columns.The Key Expansion for AES-Rijndael is a simple expansion using XOR and cyclic shifts, which takes a word as a basic unit (a word is 4 bytes), and the purpose is to expand the input key intoNr+1 subkeys.


#### 3.2.1. AES-Rijndael Model

For the AES implementation on an instruction set, according to the above formula, it can be expressed in the following form:(3)Texectext_len=∑OimNim+Nr·∑OirNir+∑OibNib·text_len/block_sizeprocessor_freq.In this model, we use the instruction-level overhead expression in formula (1) to replace the content in formula (2), and then, we get formula (3). The number of instruction cycles in the Thumb-2 instruction set can be queried in Table 1. The processor_freq is the basic frequency of the microcontroller in the running platform. We can calculate the clock cycle, which is the reciprocal of the basic frequency. Based on formula (3), we can estimate the AES execution time [10] of a specific configuration on Cortex-M3.


### 3.3. Model Analysis

To evaluate the accuracy of the model, we performed it on an embedded platform STM32F103VE as a concrete example. We use different modes of the AES [11] algorithm to encrypt 64-byte plaintext on Thumb-2. Under our model, the statistical results of the amount of instruction groups are shown in Table 2. Figures 3 and 4 show the comparison between the actual encryption process overhead and our predicted results. Figure 3 mainly shows the difference between the predicted and actual value when the length of the plaintext is fixed to 64 bytes. The predicted execution time is greater than the actual execution time with several configurations of the AES. This is because we chose the longest program flow to calculate in the instruction-level static analysis of the AES assembly file, so our prediction can be viewed as the WCET of this AES implementation for a specific plaintext length. While Figure 4 shows the distinction of different plaintext lengths, we can see that the predicted value of our model is still higher than the actual execution time in terms of changing plaintext length. It can be seen that our model can more accurately predict the implementation cost of the AES algorithm on the instruction set.Table 2
Thumb-2 assembly instructions used in AES encryption.
GroupnameAES-128AES-192AES-256AES-128AES-192AES-256AES-128AES-192AES-256ECBECBECBCBCCBCCBCCTRCTRCTRAddsub174190206210226242161177193Branches848914985891498492152Bitwise321935633935325135953967321935633935ls single178221022422179821182438181621362456ls multiple101010101010101010Mov466554646464552556461549641Extended666111222Misc818966112282096811248209721124Figure 3
AES encryption prediction accuracy.Figure 4
AES encryption with variable plaintext length.


## 3.1. Cipher Analysis Model

To evaluate the impact of the use of cryptographic algorithms on embedded devices, we need to model the resource usage of these ciphers in terms of clock cycles. For a certain microcontroller, the software implementation of cryptographic algorithms is finally determined by the corresponding instructions, and the overhead of the assembly instruction is also fixed. On this basis, we propose an instruction-level overhead model for cryptographic algorithm implementation. The dominant idea of this method is to extract and simplify the assembly instructions in implementing the ciphers; then, by counting the number of instructions and clock cycles required for execution, we can estimate the computational overhead. Essentially, a mathematical model for the overheads of ciphers can be expressed as follows:(1)Ocipher=∑OinsiNinsi,where Ocipher represents the overhead of a kind of the cryptographic algorithm, Oinsi and Ninsi are the overhead and occurrence number of each kind of assembly instructions.From the perspective of assembly instruction-level analysis, we can use the instruction cycle to estimate the running cost of the program. For a cryptographic algorithm, we can abstract the model that expresses its structural features according to the algorithm flow. Taking the block cipher as an example, it can be represented by the following model:(2)Oexectext_len=Oinitial+Oappend+Ofinish=Omisc_proc+Nr·Or+Ob_proc⋅Nb=Omisc_proc+Nr·Or+Ob_proc⋅text_lenblock_size,where Oexectext_len represents the overhead required to process a piece of content with a length of text_len, Oinitial, Oappend, and Ofinish are the overhead of these 3 phases of the cryptographic algorithm, Omisc_proc includes all other overheads except block processing, including initial and finish overhead, Or and Nr are the overhead of each round and the number of rounds, respectively, Ob_proc is the overhead of processing and appending blocks, which depends on the block size and cryptographic mode it applied, and Nb is the number of blocks.


## 3.2. AES-Rijndael

Rijndael is an iterative block cipher with a variable block and a key length. AES (the Advanced Encryption Standard) [9] is a special implementation of the Rijndael algorithm. The block size of AES is fixed to be 128 bits (16 bytes), the key can be 128, 192, and 256 bits (16, 24, and 32 bytes), and the number of rounds Nr can be 10, 12, and 14, respectively.The input of the AES algorithm is a 128-bit block mapped to a byte array named “State”, and the operations of AES encryption and decryption are performed on the State. The number of roundsNr depends on the key length; a 16 -byte key corresponds to 10 rounds, a 24-byte key corresponds to 12 rounds, and a 32-byte key corresponds to 14 rounds. The first Nr−1 rounds comprise 4 different transformations: SubBytes, shiftRows, Mix Columns, and AddRoundKeys, while the last round only contains 3 transformations except the Mix Columns.The Key Expansion for AES-Rijndael is a simple expansion using XOR and cyclic shifts, which takes a word as a basic unit (a word is 4 bytes), and the purpose is to expand the input key intoNr+1 subkeys.


### 3.2.1. AES-Rijndael Model

For the AES implementation on an instruction set, according to the above formula, it can be expressed in the following form:(3)Texectext_len=∑OimNim+Nr·∑OirNir+∑OibNib·text_len/block_sizeprocessor_freq.In this model, we use the instruction-level overhead expression in formula (1) to replace the content in formula (2), and then, we get formula (3). The number of instruction cycles in the Thumb-2 instruction set can be queried in Table 1. The processor_freq is the basic frequency of the microcontroller in the running platform. We can calculate the clock cycle, which is the reciprocal of the basic frequency. Based on formula (3), we can estimate the AES execution time [10] of a specific configuration on Cortex-M3.


## 3.2.1. AES-Rijndael Model

For the AES implementation on an instruction set, according to the above formula, it can be expressed in the following form:(3)Texectext_len=∑OimNim+Nr·∑OirNir+∑OibNib·text_len/block_sizeprocessor_freq.In this model, we use the instruction-level overhead expression in formula (1) to replace the content in formula (2), and then, we get formula (3). The number of instruction cycles in the Thumb-2 instruction set can be queried in Table 1. The processor_freq is the basic frequency of the microcontroller in the running platform. We can calculate the clock cycle, which is the reciprocal of the basic frequency. Based on formula (3), we can estimate the AES execution time [10] of a specific configuration on Cortex-M3.


## 3.3. Model Analysis

To evaluate the accuracy of the model, we performed it on an embedded platform STM32F103VE as a concrete example. We use different modes of the AES [11] algorithm to encrypt 64-byte plaintext on Thumb-2. Under our model, the statistical results of the amount of instruction groups are shown in Table 2. Figures 3 and 4 show the comparison between the actual encryption process overhead and our predicted results. Figure 3 mainly shows the difference between the predicted and actual value when the length of the plaintext is fixed to 64 bytes. The predicted execution time is greater than the actual execution time with several configurations of the AES. This is because we chose the longest program flow to calculate in the instruction-level static analysis of the AES assembly file, so our prediction can be viewed as the WCET of this AES implementation for a specific plaintext length. While Figure 4 shows the distinction of different plaintext lengths, we can see that the predicted value of our model is still higher than the actual execution time in terms of changing plaintext length. It can be seen that our model can more accurately predict the implementation cost of the AES algorithm on the instruction set.Table 2
Thumb-2 assembly instructions used in AES encryption.
GroupnameAES-128AES-192AES-256AES-128AES-192AES-256AES-128AES-192AES-256ECBECBECBCBCCBCCBCCTRCTRCTRAddsub174190206210226242161177193Branches848914985891498492152Bitwise321935633935325135953967321935633935ls single178221022422179821182438181621362456ls multiple101010101010101010Mov466554646464552556461549641Extended666111222Misc818966112282096811248209721124Figure 3
AES encryption prediction accuracy.Figure 4
AES encryption with variable plaintext length.


## 4. TA Model and Schedulability Analysis

### 4.1. Timed Automaton (TA)

Timed automaton is a set of theories for modeling and verifying [12] real-time systems. Many verification tools (such as Uppaal [13]) are based on the theory of timed automaton. A timed automaton is a finite automaton (a graph composed of a finite number of nodes or locations and edges) attached to several real-valued clocks. The transition between the states can only occur if the clock constraints are met. Timed automaton is an abstract model of the time-sequential [14] system. In this paper, the task set scheduling problem in RTOS is our focus, so we choose timed automaton theory for modeling.Definition 1 (timed automaton).
Assuming a finite set of real-valued clocksC and ℬC is the set of constraints on the clocks in C. The clock constraints (guards) are conjunctions of expressions of the form x∞N and x−y∞N, where x,y∈C,N∈ℕ and ∞∈,≤,=,≥,. A timed automaton over the set of clocks C is a tuple A=L,l0,Σ,C,I,E∈A, where(i)
L: a set of locations that represent the system status(ii)
l0∈L: the initial location(iii)
Σ: a set of actions(iv)
C: a set of clocks. All clocks are initialized to 0 at l0 and may be reset after executing a transition.(v)
I:L⟼ℬC: a function assigning each location with a clock constraint (a location invariant)(vi)
E⊆L×ℬC×Σ×2C×L is the set of transitions, where transition l,g,a,r,l′ from location l to location l′ labeled with action a is executed only if guard g is true and clocks in r⊆C are reset
A transition in TA is denoted byl⟶g,a,rl′, where l and l′ represent the source and destination locations, respectively; a is the action taken during the transition; g is the guard clock that should hold to execute the transition; r is the subset of clocks to be reset when the transition is over. When a timed automaton A∈A, we use LA,l0A,ΣA,CA to represent its system status, initial locations, set of actions, and set of clocks. It is similar for other automatons.Definition 2 (timed automaton semantics).
LetA=L,l0,Σ,C,I,E∈A be a timed automaton with the configuration l,u, where location l∈L and clock valuation u∈C. The semantics are defined by a LTS<S,s0,⟶> as follows:(i)
S⊆L×ℝC: a set of state(ii)
s0=l0,u0: the initial state of TA, u0=0(iii)
⟶⊆S×ℝ≥0∪Σ×S: the transition relation such as–-
(i)l,u⟶dAl,u+dand∀d′,if0≤d′≤d,u+d′⊨Ilwhered∈ℝ≥0,-
(ii)l,u⟶aAl′,u′,if∃e=l,a,g,r,l′∈Σandu′=r⟼0u,u′⊨Il′.
When an actiona∈Σ received or sent a clock value that satisfies the clock guard g (u⊨g), the transition l⟶g,a,rl′ will happen, and the TA will change its location as well.


### 4.2. Timed Automaton with Tasks

#### 4.2.1. Tasks

We consider a multiprocessor system withm identical processors and a set of n independent, preemptive real-time tasks Γ=τ1,τ2,…,τn. A real-time task τi, where τi∈Γ, is represented by a tuple as follows:(4)τi=Ti,Di,Oi,Pi,Ri,Bi,Wi,where τi is the task identification, Ti is the period (or equivalently, the minimum interarrival time), Di≤Ti is the relative deadline, Oi is the initial offset, and Pi is the priority, smaller values of Pi indicate lower priorities. Without loss of generality, we assume global fixed-priority scheduling and that P1>P2>…>Pn so that τ1 is the highest priority task. Ri is the resource, Bi and Wi are the best and worst execution time of the task, respectively, such that Bi≤Wi≤Di and 0<Wi.We shall useτi to denote a task instance, and τi can also be shown as Ti,Di,Oi,Pi,Ri,Bi,Wi. Then, a task queue can be denoted by a poset ordering by the priority of task set Γ. A set of all task queues including instances of tasks from Γ is denoted QΓ.


#### 4.2.2. Scheduling Strategy

The research of this paper is scheduling problems on single-processor systems, and the task queue mentioned in the previous part can be assumed as a list sorted with a specific scheduling strategy. The first element in this list is the task executed by the processor, and the others are tasks waiting for resources. A scheduling strategy can be assumed as a function that can insert released tasks into the task queue, such asFIFO (first in first out), FPS (fixed-priority scheduling), and EDF (earliest deadline first).A scheduling strategy can be indicated bySCℋ:Γ×QΓ⟼QΓ. this function can insert a task instance into the task queue and keep the other tasks in the queue preserved when receiving a task instance and a task queue. Finished tasks are removed from the task queue, and the tasks must finish before its WCET.


#### 4.2.3. Task Automaton

The task automaton model is based on the timed automaton and adds a clock namedxfinished. It resets at the time when a task finishes its computation removed from the queue and prepares to start a new period.Definition 3 (task automaton).
A task automaton is a timed automaton extended with tasks. A task automaton over actionsΣ, clocks C, and tasks Γ is a tuple L,l0,E,I,M,xfinished, where(i)
L: a set of locations that represents the system status(ii)
l0∈L: the initial location(iii)
E⊆L×ℬC×Σ×2C×L is the set of transitions, indicated by edges(iv)
I:L⟼ℬC: a function assigning each location with a clock constraint (a location invariant)(v)
M:L⟶Γ: a partial function assigning locations with tasks(vi)
xfinished∈C: the clock which is reset when the task finished
A transition in task automaton is denoted byl⟶g,a,rl′.
We useVℝ≥0 to denote the set of clock assignments for C; a semantic state of an automaton is a triple l,u,q, where l is the current location, u∈V denotes the current values of clocks, and q is the current task queue. By u0, we denote a clock assignment such that u0x=0 for all clocks x. We can then present the operational semantics in LTS.Definition 4 (scheduling semantics).
Given a scheduling strategySCH, the semantics of an automaton A=<L,l0,E,I,M,xfinished> is a labeled transition system ASCH with an initial state l0,u0,, and the transitions are defined by the following rules:(i)
l,u,q⟶aSCHl′,ur,SCHMl′,qifl⟶g,a,rl′,u⊨g,andur⊨Il′,(ii)
l,u,⟶tSCHl,u+t,ift∈ℝ≥0andu+t⊨Il,(iii)
l,u,τi::q⟶tSCHl,u+t,Execτi::q,tift∈ℝ≥0,t≤Wiandu+t⊨Il,(iv)
l,u,τi::q⟶finishSCHl,uxfinished,qifBi≤0≤Wianduxfinshed⊨Il,where τi::q denotes the queue with the task instance τi inserted into q (at the first position),  denotes the empty queue, and finish∉Σ is a distinct action name.Definition 5 (reachability).
We can usel,u,q⟶SCHl′,u′,q′ to indicate l,u,q⟶aSCHl′,u′′,q′ for an action a or l,u,q⟶tSCHl′,u′,q′ for a delay t or l,u,q⟶finishSCHl′,u′,q′. We define that l,u,q is reachable for l0,u0, with the scheduling strategy SCH by l0,u0,⟶SCH∗l,u,q.
As all deadlines in task automaton are hard, we define schedulability for a given scheduling strategy as an impossibility of reaching a state where some deadline is missed. We useqℓerr to denote queues containing a task instance Ti,Di,Oi,Pi,Ri,Bi,Wi with Di−Wi<0.Definition 6 (schedulability).
A task automatonA with the initial state l0,u0, is nonschedulable with SCH if l0,u0,⟶SCH∗l,u,qℓerr for some l and u. Otherwise, we say that A is schedulable with SCH. More generally, we say that A is schedulable if and only if there exists a scheduling strategy SCH with which A is schedulable.
If each task automaton in the task set is schedulable in terms of scheduling strategy and system resources, the task set is schedulable. Fersman et al. and Krcal. [15, 16] proved that the problem of checking schedulability relative to a preemptive scheduling strategy is decidable for task automaton with fixed computation times [17]. Therefore, we fixed the execution time of the task to WCET [18] so that the task automaton is decidable.


### 4.3. Schedulability Analysis

One of the most interesting properties of task automaton is schedulability. In Definition6, we define schedulability in the task automaton; then, in this section, we study the schedulability problems with cryptographic parameters [19] related to the overhead model presented in Section 3. Merely, yes or no answers about schedulability do not provide useful results to help designers understand how changes in task parameters will affect the schedulability of the system. [20] Therefore, the schedulability analysis [21, 22] should show the amount of slack in each task that can be used to plan other actions and accurately measure the allowable changes. Thus, we not only consider whether the system is schedulable but also apply sensitivity analysis [23] to provide information about how changes in task WCET parameters affect the system. Starting from a feasible task set, sensitivity analysis will provide an accurate amount of change that can be tolerated in the task calculation time to keep the task set feasible.


#### 4.3.1. Feasibility Region in theW Space

The space where each coordinate represents a task’s WCET (Wi) is called W space. When working in the W space, we assume that the variable is only Wi, and the period (Ti), deadline (Di), and other parameters of tasks are fixed. The origin of W space is O.In our feasible region analysis, the task set is regarded as a point in a specific space of task parameters, just asW space for WCET feasible region analysis. Therefore, the judgment of schedulability can be equivalent to verifying whether a point belongs to the feasible region of the task set. In this way, the relationship between task Wi parameters can be established, and the feasible value of Wi for a specific task can be determined. In particular, using the FPS scheduling strategy, the feasible region ℳn of the task set Γ is defined in the following way:(5)ℳnT1,…,Tn,D1,…,Dn=W1,…,Wn∈R+n:Γnis schedulable by FPS.Lehoczky et al. [24] completed the first attempt to analyze and characterize the ℳn region in W space. In their work, the deadline is assumed to be equal to the period, and they proved the following theorem:Theorem 1.
Given a periodic task setΓ under fixed priorities,(i)
τi is feasibly schedulable if and only if(6)Li=mint∈Si∑j=1it/TjWjt≤1,whereSi=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.(ii)
The entire task set is feasibly schedulable if and only if(7)maxi=1,…,nLi≤1.Theorem 2.
This can be restated in a more expressive form:(8)maxi=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,n∨t∈Si∑j=1it/TjWjt≤1.Theorem 3.
This provides a way to express the feasible region ofℳn under rate monotonic (RM) priorities, which is optimal in static scheduling [25]. It can be expressed by the following theorem in the form of logical operators:Theorem 4.
WhenDi is equal to Ti, the region of the schedulable task sets ℳn is defined as follows:(9)ℳnT1,…,Tn,D1,…,Dn∣Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈Si∑j=1itTjWj≤t,where Si=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.Bini and Buttazzo [26] simplified the above theorem and significantly reduced the number of equations required to define the ℳn region. Theorem 3 is proposed to facilitate the establishment of the relationship between the task set parameters, by which we can infer the feasible value of Wi.Theorem 5.
Given a periodic task setΓ under fixed priorities, when Di is equal to Ti, its feasible region ℳn can be defined as follows:(10)ℳnT1,…,Tn,D1,…,Dn|Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈schedPi∑j=1itTjWj≤t,where SchedPi is a set of scheduling points defined as schedPi=Pi−1Di, and Pit is given by the expression as follows:(11)P0t=t,Pit=Pi−1tTiTi∪Pi−1t.


#### 4.3.2. Sensitivity Analysis inW Space

Changes to the task content in RTOS often lead to changes in the schedulability of the task set. In many cases, people hope to accurately describe the slack degree of task scheduling for system scheduling problems. At this time, sensitivity analysis [27–29] is very useful. For example, when a developer wants to add a new function to a task, sensitivity analysis can give the allowable Wi range of the task, which can help change the task without affecting the schedulability of the task.Continuing to focus onW space, a task set Γ can be expressed as a point WΓ in W space, where WΓ=W1,…,Wn. Changes to tasks in the task set Γ will lead to linear changes of Wi, and the modified point WΓ′ can be expressed in the following formal form:(12)WΓ′=WΓ+εd⟶.d⟶ is a non-negative vector used to set the direction of change, and ε is a scalar used to measure the change from the original position. In this paper, only the schedulability after the modification of the original schedulable task set is considered, so ε>=0.When the change in the task set is determined, andd⟶ is also determined accordingly, the satisfaction of the task set Γ′ schedulability condition is equivalent to restricting WΓ′ in the feasible region ℳn so that the range of slack ε can be determined. If we denote the first i elements of d⟶ by di and Wi′⟶ is consisted of the first i WCET in Γ′, then Γ′ is schedulable if and only if:(13)∧i=1,…,n∨t∈schedPini⟶⋅Wi′⟶≤t⇔∧i=1,…,n∨t∈schedPini⟶⋅Wi⟶+εdi⟶≤t⇔∧i=1,…,n∨t∈schedPiε≤t−ni⟶⋅Wi⟶ni⟶⋅di⟶⇔ε≤mini=1,…,nmaxt∈schedPit−ni⟶⋅Wi⟶ni⟶⋅di⟶,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.This formula provides the maximum linear slack along thed⟶ direction.Changing a taskτk is considered in a given schedulable task set Γ, and its WCET will change accordingly, Wk′=Wk+Δk, the direction vector d⟶=0,…,1,…0 in the change. Except the k-th bit, which is set to 1, all other bits are all 0. We can use the above formula to calculate the maximum value of Δk. The actual meaning of Δk is the maximum WCET increase amount allowed by task τk under schedulability.(14)ΔWkmax=mini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


#### 4.3.3. CPU Utilization Constraints

The analysis in Section2 is based on a situation where no additional constraints are imposed. Now, adding utilization constraints to a single CPU system is considered. The ratio Ui=Wi/Ti is called the utilization of task τi and represents the processor clock cycles used by that task, and the value is as follows:(15)Up=∑i=1nUi.Up is called total processor utilization; it represents the proportion of processor time used by the periodic task set. Obviously, if Up>1, there is no feasible plan for this task set. So, we can set the CPU utilization of the original task set as follows:(16)Uori=∑i=1nUi=∑i=1nWiTi.Then, after changing the taskk, the new CPU utilization is as follows:(17)Unew=W1T1+⋯+Wk+ΔWkTk+⋯+WnTn.With constrainedUnew<=Umax, Umax is the constraints of CPU utilization, when Unew>1, the CPU is overloaded. Obviously, this configuration is not feasible. The constraint of ΔWk under this condition is(18)ΔWk≤TkUmax−Uori.Combined with the sensitivity analysis in Section4.3.2, under the condition of CPU utilization constraints, the maximum value of the task k whose execution time changes is(19)ΔWkmax=minmini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,TkUmax−Uori,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


#### 4.3.4. Throughput Evaluation of Cryptographic Algorithms

In Section3, we propose a model for estimating the CPU clock cycle cost of a specific configuration of the cryptographic algorithm on the chip and the corresponding instruction set. In Sections 4.3.1–4.3.3, we introduce a sensitivity analysis method for determining the parameter feasible region of a task set. Then, in this section, we combine the model and the sensitivity analysis method to give the evaluation index of the application of the cryptographic algorithm in RTOS: throughput. It can reflect the performance of cryptographic algorithms.First, Formula (3) is simplified; when the block cipher is the subject of investigation, we have(20)Texectext_len=Tmisc+Tblock⋅text_lenblock_size.Encrypting and decrypting a piece of content with a length oftext_len is considered as the added part of the task k. From the previous formula, we know(21)Texectext_len≤ΔWkmax⇔Tmisc+Tblock⋅text_lenblock_size≤ΔWkmax⇔text_len≤ΔWkmax−Tmisc⋅block_sizeTblock.The throughput of a cryptographic algorithm is defined as the length of plaintext/ciphertext. It processes in a unit time. Then, according to the above formula, it can be concluded that in RTOS, when a fixed priority scheduling strategy is used on the premise that the task set is schedulable and the CPU occupancy rate is withinUmax, a specific configuration of cryptographic algorithm protection for task k is added; then, the upper bound of throughput can be expressed as follows:(22)TPSCrypto=text_lenTk≤ΔWkmax−Tmisc⋅block_sizeTk·Tblock.Among them,Tmisc is the initial cost of encrypting and decrypting each piece of text, block_size is the size of each block; taking AES as an example, there are three choices of 128, 192, and 256 (in bits), and Tblock is the time to process each block.


## 4.1. Timed Automaton (TA)

Timed automaton is a set of theories for modeling and verifying [12] real-time systems. Many verification tools (such as Uppaal [13]) are based on the theory of timed automaton. A timed automaton is a finite automaton (a graph composed of a finite number of nodes or locations and edges) attached to several real-valued clocks. The transition between the states can only occur if the clock constraints are met. Timed automaton is an abstract model of the time-sequential [14] system. In this paper, the task set scheduling problem in RTOS is our focus, so we choose timed automaton theory for modeling.Definition 1 (timed automaton).
Assuming a finite set of real-valued clocksC and ℬC is the set of constraints on the clocks in C. The clock constraints (guards) are conjunctions of expressions of the form x∞N and x−y∞N, where x,y∈C,N∈ℕ and ∞∈,≤,=,≥,. A timed automaton over the set of clocks C is a tuple A=L,l0,Σ,C,I,E∈A, where(i)
L: a set of locations that represent the system status(ii)
l0∈L: the initial location(iii)
Σ: a set of actions(iv)
C: a set of clocks. All clocks are initialized to 0 at l0 and may be reset after executing a transition.(v)
I:L⟼ℬC: a function assigning each location with a clock constraint (a location invariant)(vi)
E⊆L×ℬC×Σ×2C×L is the set of transitions, where transition l,g,a,r,l′ from location l to location l′ labeled with action a is executed only if guard g is true and clocks in r⊆C are reset
A transition in TA is denoted byl⟶g,a,rl′, where l and l′ represent the source and destination locations, respectively; a is the action taken during the transition; g is the guard clock that should hold to execute the transition; r is the subset of clocks to be reset when the transition is over. When a timed automaton A∈A, we use LA,l0A,ΣA,CA to represent its system status, initial locations, set of actions, and set of clocks. It is similar for other automatons.Definition 2 (timed automaton semantics).
LetA=L,l0,Σ,C,I,E∈A be a timed automaton with the configuration l,u, where location l∈L and clock valuation u∈C. The semantics are defined by a LTS<S,s0,⟶> as follows:(i)
S⊆L×ℝC: a set of state(ii)
s0=l0,u0: the initial state of TA, u0=0(iii)
⟶⊆S×ℝ≥0∪Σ×S: the transition relation such as–-
(i)l,u⟶dAl,u+dand∀d′,if0≤d′≤d,u+d′⊨Ilwhered∈ℝ≥0,-
(ii)l,u⟶aAl′,u′,if∃e=l,a,g,r,l′∈Σandu′=r⟼0u,u′⊨Il′.
When an actiona∈Σ received or sent a clock value that satisfies the clock guard g (u⊨g), the transition l⟶g,a,rl′ will happen, and the TA will change its location as well.


## 4.2. Timed Automaton with Tasks

### 4.2.1. Tasks

We consider a multiprocessor system withm identical processors and a set of n independent, preemptive real-time tasks Γ=τ1,τ2,…,τn. A real-time task τi, where τi∈Γ, is represented by a tuple as follows:(4)τi=Ti,Di,Oi,Pi,Ri,Bi,Wi,where τi is the task identification, Ti is the period (or equivalently, the minimum interarrival time), Di≤Ti is the relative deadline, Oi is the initial offset, and Pi is the priority, smaller values of Pi indicate lower priorities. Without loss of generality, we assume global fixed-priority scheduling and that P1>P2>…>Pn so that τ1 is the highest priority task. Ri is the resource, Bi and Wi are the best and worst execution time of the task, respectively, such that Bi≤Wi≤Di and 0<Wi.We shall useτi to denote a task instance, and τi can also be shown as Ti,Di,Oi,Pi,Ri,Bi,Wi. Then, a task queue can be denoted by a poset ordering by the priority of task set Γ. A set of all task queues including instances of tasks from Γ is denoted QΓ.


### 4.2.2. Scheduling Strategy

The research of this paper is scheduling problems on single-processor systems, and the task queue mentioned in the previous part can be assumed as a list sorted with a specific scheduling strategy. The first element in this list is the task executed by the processor, and the others are tasks waiting for resources. A scheduling strategy can be assumed as a function that can insert released tasks into the task queue, such asFIFO (first in first out), FPS (fixed-priority scheduling), and EDF (earliest deadline first).A scheduling strategy can be indicated bySCℋ:Γ×QΓ⟼QΓ. this function can insert a task instance into the task queue and keep the other tasks in the queue preserved when receiving a task instance and a task queue. Finished tasks are removed from the task queue, and the tasks must finish before its WCET.


### 4.2.3. Task Automaton

The task automaton model is based on the timed automaton and adds a clock namedxfinished. It resets at the time when a task finishes its computation removed from the queue and prepares to start a new period.Definition 3 (task automaton).
A task automaton is a timed automaton extended with tasks. A task automaton over actionsΣ, clocks C, and tasks Γ is a tuple L,l0,E,I,M,xfinished, where(i)
L: a set of locations that represents the system status(ii)
l0∈L: the initial location(iii)
E⊆L×ℬC×Σ×2C×L is the set of transitions, indicated by edges(iv)
I:L⟼ℬC: a function assigning each location with a clock constraint (a location invariant)(v)
M:L⟶Γ: a partial function assigning locations with tasks(vi)
xfinished∈C: the clock which is reset when the task finished
A transition in task automaton is denoted byl⟶g,a,rl′.
We useVℝ≥0 to denote the set of clock assignments for C; a semantic state of an automaton is a triple l,u,q, where l is the current location, u∈V denotes the current values of clocks, and q is the current task queue. By u0, we denote a clock assignment such that u0x=0 for all clocks x. We can then present the operational semantics in LTS.Definition 4 (scheduling semantics).
Given a scheduling strategySCH, the semantics of an automaton A=<L,l0,E,I,M,xfinished> is a labeled transition system ASCH with an initial state l0,u0,, and the transitions are defined by the following rules:(i)
l,u,q⟶aSCHl′,ur,SCHMl′,qifl⟶g,a,rl′,u⊨g,andur⊨Il′,(ii)
l,u,⟶tSCHl,u+t,ift∈ℝ≥0andu+t⊨Il,(iii)
l,u,τi::q⟶tSCHl,u+t,Execτi::q,tift∈ℝ≥0,t≤Wiandu+t⊨Il,(iv)
l,u,τi::q⟶finishSCHl,uxfinished,qifBi≤0≤Wianduxfinshed⊨Il,where τi::q denotes the queue with the task instance τi inserted into q (at the first position),  denotes the empty queue, and finish∉Σ is a distinct action name.Definition 5 (reachability).
We can usel,u,q⟶SCHl′,u′,q′ to indicate l,u,q⟶aSCHl′,u′′,q′ for an action a or l,u,q⟶tSCHl′,u′,q′ for a delay t or l,u,q⟶finishSCHl′,u′,q′. We define that l,u,q is reachable for l0,u0, with the scheduling strategy SCH by l0,u0,⟶SCH∗l,u,q.
As all deadlines in task automaton are hard, we define schedulability for a given scheduling strategy as an impossibility of reaching a state where some deadline is missed. We useqℓerr to denote queues containing a task instance Ti,Di,Oi,Pi,Ri,Bi,Wi with Di−Wi<0.Definition 6 (schedulability).
A task automatonA with the initial state l0,u0, is nonschedulable with SCH if l0,u0,⟶SCH∗l,u,qℓerr for some l and u. Otherwise, we say that A is schedulable with SCH. More generally, we say that A is schedulable if and only if there exists a scheduling strategy SCH with which A is schedulable.
If each task automaton in the task set is schedulable in terms of scheduling strategy and system resources, the task set is schedulable. Fersman et al. and Krcal. [15, 16] proved that the problem of checking schedulability relative to a preemptive scheduling strategy is decidable for task automaton with fixed computation times [17]. Therefore, we fixed the execution time of the task to WCET [18] so that the task automaton is decidable.


## 4.2.1. Tasks

We consider a multiprocessor system withm identical processors and a set of n independent, preemptive real-time tasks Γ=τ1,τ2,…,τn. A real-time task τi, where τi∈Γ, is represented by a tuple as follows:(4)τi=Ti,Di,Oi,Pi,Ri,Bi,Wi,where τi is the task identification, Ti is the period (or equivalently, the minimum interarrival time), Di≤Ti is the relative deadline, Oi is the initial offset, and Pi is the priority, smaller values of Pi indicate lower priorities. Without loss of generality, we assume global fixed-priority scheduling and that P1>P2>…>Pn so that τ1 is the highest priority task. Ri is the resource, Bi and Wi are the best and worst execution time of the task, respectively, such that Bi≤Wi≤Di and 0<Wi.We shall useτi to denote a task instance, and τi can also be shown as Ti,Di,Oi,Pi,Ri,Bi,Wi. Then, a task queue can be denoted by a poset ordering by the priority of task set Γ. A set of all task queues including instances of tasks from Γ is denoted QΓ.


## 4.2.2. Scheduling Strategy

The research of this paper is scheduling problems on single-processor systems, and the task queue mentioned in the previous part can be assumed as a list sorted with a specific scheduling strategy. The first element in this list is the task executed by the processor, and the others are tasks waiting for resources. A scheduling strategy can be assumed as a function that can insert released tasks into the task queue, such asFIFO (first in first out), FPS (fixed-priority scheduling), and EDF (earliest deadline first).A scheduling strategy can be indicated bySCℋ:Γ×QΓ⟼QΓ. this function can insert a task instance into the task queue and keep the other tasks in the queue preserved when receiving a task instance and a task queue. Finished tasks are removed from the task queue, and the tasks must finish before its WCET.


## 4.2.3. Task Automaton

The task automaton model is based on the timed automaton and adds a clock namedxfinished. It resets at the time when a task finishes its computation removed from the queue and prepares to start a new period.Definition 3 (task automaton).
A task automaton is a timed automaton extended with tasks. A task automaton over actionsΣ, clocks C, and tasks Γ is a tuple L,l0,E,I,M,xfinished, where(i)
L: a set of locations that represents the system status(ii)
l0∈L: the initial location(iii)
E⊆L×ℬC×Σ×2C×L is the set of transitions, indicated by edges(iv)
I:L⟼ℬC: a function assigning each location with a clock constraint (a location invariant)(v)
M:L⟶Γ: a partial function assigning locations with tasks(vi)
xfinished∈C: the clock which is reset when the task finished
A transition in task automaton is denoted byl⟶g,a,rl′.
We useVℝ≥0 to denote the set of clock assignments for C; a semantic state of an automaton is a triple l,u,q, where l is the current location, u∈V denotes the current values of clocks, and q is the current task queue. By u0, we denote a clock assignment such that u0x=0 for all clocks x. We can then present the operational semantics in LTS.Definition 4 (scheduling semantics).
Given a scheduling strategySCH, the semantics of an automaton A=<L,l0,E,I,M,xfinished> is a labeled transition system ASCH with an initial state l0,u0,, and the transitions are defined by the following rules:(i)
l,u,q⟶aSCHl′,ur,SCHMl′,qifl⟶g,a,rl′,u⊨g,andur⊨Il′,(ii)
l,u,⟶tSCHl,u+t,ift∈ℝ≥0andu+t⊨Il,(iii)
l,u,τi::q⟶tSCHl,u+t,Execτi::q,tift∈ℝ≥0,t≤Wiandu+t⊨Il,(iv)
l,u,τi::q⟶finishSCHl,uxfinished,qifBi≤0≤Wianduxfinshed⊨Il,where τi::q denotes the queue with the task instance τi inserted into q (at the first position),  denotes the empty queue, and finish∉Σ is a distinct action name.Definition 5 (reachability).
We can usel,u,q⟶SCHl′,u′,q′ to indicate l,u,q⟶aSCHl′,u′′,q′ for an action a or l,u,q⟶tSCHl′,u′,q′ for a delay t or l,u,q⟶finishSCHl′,u′,q′. We define that l,u,q is reachable for l0,u0, with the scheduling strategy SCH by l0,u0,⟶SCH∗l,u,q.
As all deadlines in task automaton are hard, we define schedulability for a given scheduling strategy as an impossibility of reaching a state where some deadline is missed. We useqℓerr to denote queues containing a task instance Ti,Di,Oi,Pi,Ri,Bi,Wi with Di−Wi<0.Definition 6 (schedulability).
A task automatonA with the initial state l0,u0, is nonschedulable with SCH if l0,u0,⟶SCH∗l,u,qℓerr for some l and u. Otherwise, we say that A is schedulable with SCH. More generally, we say that A is schedulable if and only if there exists a scheduling strategy SCH with which A is schedulable.
If each task automaton in the task set is schedulable in terms of scheduling strategy and system resources, the task set is schedulable. Fersman et al. and Krcal. [15, 16] proved that the problem of checking schedulability relative to a preemptive scheduling strategy is decidable for task automaton with fixed computation times [17]. Therefore, we fixed the execution time of the task to WCET [18] so that the task automaton is decidable.


## 4.3. Schedulability Analysis

One of the most interesting properties of task automaton is schedulability. In Definition6, we define schedulability in the task automaton; then, in this section, we study the schedulability problems with cryptographic parameters [19] related to the overhead model presented in Section 3. Merely, yes or no answers about schedulability do not provide useful results to help designers understand how changes in task parameters will affect the schedulability of the system. [20] Therefore, the schedulability analysis [21, 22] should show the amount of slack in each task that can be used to plan other actions and accurately measure the allowable changes. Thus, we not only consider whether the system is schedulable but also apply sensitivity analysis [23] to provide information about how changes in task WCET parameters affect the system. Starting from a feasible task set, sensitivity analysis will provide an accurate amount of change that can be tolerated in the task calculation time to keep the task set feasible.


### 4.3.1. Feasibility Region in theW Space

The space where each coordinate represents a task’s WCET (Wi) is called W space. When working in the W space, we assume that the variable is only Wi, and the period (Ti), deadline (Di), and other parameters of tasks are fixed. The origin of W space is O.In our feasible region analysis, the task set is regarded as a point in a specific space of task parameters, just asW space for WCET feasible region analysis. Therefore, the judgment of schedulability can be equivalent to verifying whether a point belongs to the feasible region of the task set. In this way, the relationship between task Wi parameters can be established, and the feasible value of Wi for a specific task can be determined. In particular, using the FPS scheduling strategy, the feasible region ℳn of the task set Γ is defined in the following way:(5)ℳnT1,…,Tn,D1,…,Dn=W1,…,Wn∈R+n:Γnis schedulable by FPS.Lehoczky et al. [24] completed the first attempt to analyze and characterize the ℳn region in W space. In their work, the deadline is assumed to be equal to the period, and they proved the following theorem:Theorem 1.
Given a periodic task setΓ under fixed priorities,(i)
τi is feasibly schedulable if and only if(6)Li=mint∈Si∑j=1it/TjWjt≤1,whereSi=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.(ii)
The entire task set is feasibly schedulable if and only if(7)maxi=1,…,nLi≤1.Theorem 2.
This can be restated in a more expressive form:(8)maxi=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,n∨t∈Si∑j=1it/TjWjt≤1.Theorem 3.
This provides a way to express the feasible region ofℳn under rate monotonic (RM) priorities, which is optimal in static scheduling [25]. It can be expressed by the following theorem in the form of logical operators:Theorem 4.
WhenDi is equal to Ti, the region of the schedulable task sets ℳn is defined as follows:(9)ℳnT1,…,Tn,D1,…,Dn∣Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈Si∑j=1itTjWj≤t,where Si=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.Bini and Buttazzo [26] simplified the above theorem and significantly reduced the number of equations required to define the ℳn region. Theorem 3 is proposed to facilitate the establishment of the relationship between the task set parameters, by which we can infer the feasible value of Wi.Theorem 5.
Given a periodic task setΓ under fixed priorities, when Di is equal to Ti, its feasible region ℳn can be defined as follows:(10)ℳnT1,…,Tn,D1,…,Dn|Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈schedPi∑j=1itTjWj≤t,where SchedPi is a set of scheduling points defined as schedPi=Pi−1Di, and Pit is given by the expression as follows:(11)P0t=t,Pit=Pi−1tTiTi∪Pi−1t.


### 4.3.2. Sensitivity Analysis inW Space

Changes to the task content in RTOS often lead to changes in the schedulability of the task set. In many cases, people hope to accurately describe the slack degree of task scheduling for system scheduling problems. At this time, sensitivity analysis [27–29] is very useful. For example, when a developer wants to add a new function to a task, sensitivity analysis can give the allowable Wi range of the task, which can help change the task without affecting the schedulability of the task.Continuing to focus onW space, a task set Γ can be expressed as a point WΓ in W space, where WΓ=W1,…,Wn. Changes to tasks in the task set Γ will lead to linear changes of Wi, and the modified point WΓ′ can be expressed in the following formal form:(12)WΓ′=WΓ+εd⟶.d⟶ is a non-negative vector used to set the direction of change, and ε is a scalar used to measure the change from the original position. In this paper, only the schedulability after the modification of the original schedulable task set is considered, so ε>=0.When the change in the task set is determined, andd⟶ is also determined accordingly, the satisfaction of the task set Γ′ schedulability condition is equivalent to restricting WΓ′ in the feasible region ℳn so that the range of slack ε can be determined. If we denote the first i elements of d⟶ by di and Wi′⟶ is consisted of the first i WCET in Γ′, then Γ′ is schedulable if and only if:(13)∧i=1,…,n∨t∈schedPini⟶⋅Wi′⟶≤t⇔∧i=1,…,n∨t∈schedPini⟶⋅Wi⟶+εdi⟶≤t⇔∧i=1,…,n∨t∈schedPiε≤t−ni⟶⋅Wi⟶ni⟶⋅di⟶⇔ε≤mini=1,…,nmaxt∈schedPit−ni⟶⋅Wi⟶ni⟶⋅di⟶,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.This formula provides the maximum linear slack along thed⟶ direction.Changing a taskτk is considered in a given schedulable task set Γ, and its WCET will change accordingly, Wk′=Wk+Δk, the direction vector d⟶=0,…,1,…0 in the change. Except the k-th bit, which is set to 1, all other bits are all 0. We can use the above formula to calculate the maximum value of Δk. The actual meaning of Δk is the maximum WCET increase amount allowed by task τk under schedulability.(14)ΔWkmax=mini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


### 4.3.3. CPU Utilization Constraints

The analysis in Section2 is based on a situation where no additional constraints are imposed. Now, adding utilization constraints to a single CPU system is considered. The ratio Ui=Wi/Ti is called the utilization of task τi and represents the processor clock cycles used by that task, and the value is as follows:(15)Up=∑i=1nUi.Up is called total processor utilization; it represents the proportion of processor time used by the periodic task set. Obviously, if Up>1, there is no feasible plan for this task set. So, we can set the CPU utilization of the original task set as follows:(16)Uori=∑i=1nUi=∑i=1nWiTi.Then, after changing the taskk, the new CPU utilization is as follows:(17)Unew=W1T1+⋯+Wk+ΔWkTk+⋯+WnTn.With constrainedUnew<=Umax, Umax is the constraints of CPU utilization, when Unew>1, the CPU is overloaded. Obviously, this configuration is not feasible. The constraint of ΔWk under this condition is(18)ΔWk≤TkUmax−Uori.Combined with the sensitivity analysis in Section4.3.2, under the condition of CPU utilization constraints, the maximum value of the task k whose execution time changes is(19)ΔWkmax=minmini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,TkUmax−Uori,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


### 4.3.4. Throughput Evaluation of Cryptographic Algorithms

In Section3, we propose a model for estimating the CPU clock cycle cost of a specific configuration of the cryptographic algorithm on the chip and the corresponding instruction set. In Sections 4.3.1–4.3.3, we introduce a sensitivity analysis method for determining the parameter feasible region of a task set. Then, in this section, we combine the model and the sensitivity analysis method to give the evaluation index of the application of the cryptographic algorithm in RTOS: throughput. It can reflect the performance of cryptographic algorithms.First, Formula (3) is simplified; when the block cipher is the subject of investigation, we have(20)Texectext_len=Tmisc+Tblock⋅text_lenblock_size.Encrypting and decrypting a piece of content with a length oftext_len is considered as the added part of the task k. From the previous formula, we know(21)Texectext_len≤ΔWkmax⇔Tmisc+Tblock⋅text_lenblock_size≤ΔWkmax⇔text_len≤ΔWkmax−Tmisc⋅block_sizeTblock.The throughput of a cryptographic algorithm is defined as the length of plaintext/ciphertext. It processes in a unit time. Then, according to the above formula, it can be concluded that in RTOS, when a fixed priority scheduling strategy is used on the premise that the task set is schedulable and the CPU occupancy rate is withinUmax, a specific configuration of cryptographic algorithm protection for task k is added; then, the upper bound of throughput can be expressed as follows:(22)TPSCrypto=text_lenTk≤ΔWkmax−Tmisc⋅block_sizeTk·Tblock.Among them,Tmisc is the initial cost of encrypting and decrypting each piece of text, block_size is the size of each block; taking AES as an example, there are three choices of 128, 192, and 256 (in bits), and Tblock is the time to process each block.


## 4.3.1. Feasibility Region in theW Space

The space where each coordinate represents a task’s WCET (Wi) is called W space. When working in the W space, we assume that the variable is only Wi, and the period (Ti), deadline (Di), and other parameters of tasks are fixed. The origin of W space is O.In our feasible region analysis, the task set is regarded as a point in a specific space of task parameters, just asW space for WCET feasible region analysis. Therefore, the judgment of schedulability can be equivalent to verifying whether a point belongs to the feasible region of the task set. In this way, the relationship between task Wi parameters can be established, and the feasible value of Wi for a specific task can be determined. In particular, using the FPS scheduling strategy, the feasible region ℳn of the task set Γ is defined in the following way:(5)ℳnT1,…,Tn,D1,…,Dn=W1,…,Wn∈R+n:Γnis schedulable by FPS.Lehoczky et al. [24] completed the first attempt to analyze and characterize the ℳn region in W space. In their work, the deadline is assumed to be equal to the period, and they proved the following theorem:Theorem 1.
Given a periodic task setΓ under fixed priorities,(i)
τi is feasibly schedulable if and only if(6)Li=mint∈Si∑j=1it/TjWjt≤1,whereSi=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.(ii)
The entire task set is feasibly schedulable if and only if(7)maxi=1,…,nLi≤1.Theorem 2.
This can be restated in a more expressive form:(8)maxi=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,nmint∈Si∑j=1it/TjWjt≤1⇔∧i=1,…,n∨t∈Si∑j=1it/TjWjt≤1.Theorem 3.
This provides a way to express the feasible region ofℳn under rate monotonic (RM) priorities, which is optimal in static scheduling [25]. It can be expressed by the following theorem in the form of logical operators:Theorem 4.
WhenDi is equal to Ti, the region of the schedulable task sets ℳn is defined as follows:(9)ℳnT1,…,Tn,D1,…,Dn∣Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈Si∑j=1itTjWj≤t,where Si=rTj:j=1,…,i,r=1,…,⌊Ti/Tj⌋.Bini and Buttazzo [26] simplified the above theorem and significantly reduced the number of equations required to define the ℳn region. Theorem 3 is proposed to facilitate the establishment of the relationship between the task set parameters, by which we can infer the feasible value of Wi.Theorem 5.
Given a periodic task setΓ under fixed priorities, when Di is equal to Ti, its feasible region ℳn can be defined as follows:(10)ℳnT1,…,Tn,D1,…,Dn|Di=Ti=W1,…,Wn∈R+n:∧i=1,…,n∨t∈schedPi∑j=1itTjWj≤t,where SchedPi is a set of scheduling points defined as schedPi=Pi−1Di, and Pit is given by the expression as follows:(11)P0t=t,Pit=Pi−1tTiTi∪Pi−1t.


## 4.3.2. Sensitivity Analysis inW Space

Changes to the task content in RTOS often lead to changes in the schedulability of the task set. In many cases, people hope to accurately describe the slack degree of task scheduling for system scheduling problems. At this time, sensitivity analysis [27–29] is very useful. For example, when a developer wants to add a new function to a task, sensitivity analysis can give the allowable Wi range of the task, which can help change the task without affecting the schedulability of the task.Continuing to focus onW space, a task set Γ can be expressed as a point WΓ in W space, where WΓ=W1,…,Wn. Changes to tasks in the task set Γ will lead to linear changes of Wi, and the modified point WΓ′ can be expressed in the following formal form:(12)WΓ′=WΓ+εd⟶.d⟶ is a non-negative vector used to set the direction of change, and ε is a scalar used to measure the change from the original position. In this paper, only the schedulability after the modification of the original schedulable task set is considered, so ε>=0.When the change in the task set is determined, andd⟶ is also determined accordingly, the satisfaction of the task set Γ′ schedulability condition is equivalent to restricting WΓ′ in the feasible region ℳn so that the range of slack ε can be determined. If we denote the first i elements of d⟶ by di and Wi′⟶ is consisted of the first i WCET in Γ′, then Γ′ is schedulable if and only if:(13)∧i=1,…,n∨t∈schedPini⟶⋅Wi′⟶≤t⇔∧i=1,…,n∨t∈schedPini⟶⋅Wi⟶+εdi⟶≤t⇔∧i=1,…,n∨t∈schedPiε≤t−ni⟶⋅Wi⟶ni⟶⋅di⟶⇔ε≤mini=1,…,nmaxt∈schedPit−ni⟶⋅Wi⟶ni⟶⋅di⟶,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.This formula provides the maximum linear slack along thed⟶ direction.Changing a taskτk is considered in a given schedulable task set Γ, and its WCET will change accordingly, Wk′=Wk+Δk, the direction vector d⟶=0,…,1,…0 in the change. Except the k-th bit, which is set to 1, all other bits are all 0. We can use the above formula to calculate the maximum value of Δk. The actual meaning of Δk is the maximum WCET increase amount allowed by task τk under schedulability.(14)ΔWkmax=mini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


## 4.3.3. CPU Utilization Constraints

The analysis in Section2 is based on a situation where no additional constraints are imposed. Now, adding utilization constraints to a single CPU system is considered. The ratio Ui=Wi/Ti is called the utilization of task τi and represents the processor clock cycles used by that task, and the value is as follows:(15)Up=∑i=1nUi.Up is called total processor utilization; it represents the proportion of processor time used by the periodic task set. Obviously, if Up>1, there is no feasible plan for this task set. So, we can set the CPU utilization of the original task set as follows:(16)Uori=∑i=1nUi=∑i=1nWiTi.Then, after changing the taskk, the new CPU utilization is as follows:(17)Unew=W1T1+⋯+Wk+ΔWkTk+⋯+WnTn.With constrainedUnew<=Umax, Umax is the constraints of CPU utilization, when Unew>1, the CPU is overloaded. Obviously, this configuration is not feasible. The constraint of ΔWk under this condition is(18)ΔWk≤TkUmax−Uori.Combined with the sensitivity analysis in Section4.3.2, under the condition of CPU utilization constraints, the maximum value of the task k whose execution time changes is(19)ΔWkmax=minmini=k,…,nmaxt∈schedPit−ni⟶⋅Wi⟶t/Tk,TkUmax−Uori,where ni⟶=t/T1,t/T2,…,t/Ti−1,1.


## 4.3.4. Throughput Evaluation of Cryptographic Algorithms

In Section3, we propose a model for estimating the CPU clock cycle cost of a specific configuration of the cryptographic algorithm on the chip and the corresponding instruction set. In Sections 4.3.1–4.3.3, we introduce a sensitivity analysis method for determining the parameter feasible region of a task set. Then, in this section, we combine the model and the sensitivity analysis method to give the evaluation index of the application of the cryptographic algorithm in RTOS: throughput. It can reflect the performance of cryptographic algorithms.First, Formula (3) is simplified; when the block cipher is the subject of investigation, we have(20)Texectext_len=Tmisc+Tblock⋅text_lenblock_size.Encrypting and decrypting a piece of content with a length oftext_len is considered as the added part of the task k. From the previous formula, we know(21)Texectext_len≤ΔWkmax⇔Tmisc+Tblock⋅text_lenblock_size≤ΔWkmax⇔text_len≤ΔWkmax−Tmisc⋅block_sizeTblock.The throughput of a cryptographic algorithm is defined as the length of plaintext/ciphertext. It processes in a unit time. Then, according to the above formula, it can be concluded that in RTOS, when a fixed priority scheduling strategy is used on the premise that the task set is schedulable and the CPU occupancy rate is withinUmax, a specific configuration of cryptographic algorithm protection for task k is added; then, the upper bound of throughput can be expressed as follows:(22)TPSCrypto=text_lenTk≤ΔWkmax−Tmisc⋅block_sizeTk·Tblock.Among them,Tmisc is the initial cost of encrypting and decrypting each piece of text, block_size is the size of each block; taking AES as an example, there are three choices of 128, 192, and 256 (in bits), and Tblock is the time to process each block.


## 5. Experimental Method

This section explains the experimental steps of this paper, in addition to the description of the automata model in detail.Our research goal is to determine the schedulability changes on a single-core processor before and after including a cryptographic algorithm to a specific task set; then, we can determine the applicability of the cryptographic algorithm on this hardware platform under this configuration. The process is outlined as follows:(i)
Step 1. Use the cryptographic overhead estimation model in Section3 to evaluate a cryptographic algorithm on the target platform at the instruction level and get the estimated overhead of the cryptographic algorithm under a certain configuration.(ii)
Step 2. Perform sensitivity analysis on the original task set in RTOS and analyze the allowable variation of the task WCET under the guarantee of schedulability. The other parameters of the task are fixed.(iii)
Step 3. Add the estimated overhead of the cryptographic algorithm in Step 1 to the task and judge whether the WCET of this task meets the schedulability constraint analyzed in Step 2.(iv)
Step 4. Model the task scheduling of RTOS according to the content of Section4, construct a set of task automata models with time constraints, set parameters for the automata according to the research case, and verify the schedulability of the task set through the automata operation.(v)
Step 5. Port RTOS to the embedded platform and set task attributes. After running the system, use the Tracealyzer [30] to track the execution of the tasks and compare with the results in the previous steps.(vi)
Step 6. Compare and analyze the experimental data to judge the accuracy of this process and the feasibility of this method.The fundamental idea of the verifying step is to convert the schedulability analysis problem into the reachability problem of timed automata and use the real-time model validator Uppaal to find the WCRT and processor utilization, and check whether all deadlines are satisfied. In the response time analysis, to prove schedulability, it is sufficient to calculate the WCRT of each task and compare it with the deadline [31]. If the WCRT of each task does not exceed the corresponding deadline, then the system is schedulable and vice versa. Some tasks are periodic, and some are sporadic, but we simplify the model by treating all tasks as periodic.We use STM32F103VE (Cortex-M3) [32] as a development platform and port FreeRTOS [33] as the operating system on this platform, which employs a preemptive fixed priority scheduler and a time slice round scheduler under the same priority. In a hard RTOS, a task that misses the deadline means that the system is not schedulable. The workflow of our experiment is shown in Figure 5.Figure 5
Workflow diagram.As the cryptographic overhead prediction, automaton theory, and sensitivity analysis are mentioned in the former sections, we will introduce the model construction of task automata in detail.We use Uppaal [34] as a formal verification tool to verify our schedulability analysis model by using verification queries [35]. We use a stopwatch to record the progress of the task, and the stopwatch will stop running when the task is preempted. In Uppaal, the stopwatch is implemented as clock derivatives, where the running rate can be set to 1 or 0.1 means the clock runs at a normal speed, and 0 means the clock stops. Syntactically, the stopwatch expression appears in the invariant constraint of the node as x′==c, where x is declared as a clock type and c is an integer. By verifying whether the stopwatch satisfies the clock constraints, you can check whether the task meets the real-time restrictions of the system.


### 5.1. The Uppaal Framework

The Uppaal framework [36] consists of the following process models: a fixed-priority preemptive scheduling strategy, a system resource model, a task model, and a model to ensure global invariance. The template we provide for the task model is parameterized using an explicit sequence of task attributes, and we can customize the protocols that the tasks share on specific resources [37]. The main modeling elements are summarized below:(i)
A system resource sharing template. The system has two states: Idle and Inuse. The states switch through the interaction with tasks and scheduling strategy; therefore, the resource utilization rate can be calculated;(ii)
A scheduling strategy template to process tasks in the queue according to different scheduling strategies;(iii)
A task template that can set attributes according to the definition in Section4.2 task automaton. Each task uses the following clocks and data variables:(iv)
the task and its clocks are parameterized by the identifier id; the local clockx is used to control the execution status of its own tasks, and the global clock time [id] is used to control the execution status of the task set in the entire system.


### 5.2. Resource and Scheduler Model

Figures6 and 7 show a model of system resources (CPU) and scheduling strategy. First, the system resource model is initialized. Since no user task is running, the CPU runs idle tasks and is in the Idle position. When a task is ready, it sends the signal ready [id]! on the resource preparation channel so that the system resource moves from Idle to an intermediate state position and then sends the signal insert_task [policy]! on the channel to insert the new task into the scheduling queue. Then, the scheduling strategy model FPS receives the signal. If the scheduling queue is not empty, the priority of the current task is compared with the priority in the queue in turn and then inserted into the task queue by insert_task_in_buffer (); otherwise, the current task is directly inserted into the head position of the task queue by insert_at (0, ready_task, id). Then, the resource selects the highest priority task from the task queue and enters the running state position Inuse.Figure 6
Resource.Figure 7
Scheduler.The task releases the CPU through the signal finished [id]!. In this case, the scheduling policy model removes the task from the task queue by removeTask (). If the task queue is empty at this time, the CPU runs the idle task and moves to the Idle position. If it is not empty, the highest priority task is extracted from the task queue, and the CPU is still in the running state, Inuse position. It also uses the stopwatch usedTime to calculate the CPU usage time and then to calculate the total CPU load asused Time/global Time.


### 5.3. Task Template

Figure8 shows the task model. The task model is built according to the task automaton template proposed in Section 4.2. Each task is instantiated by in it_off set, min_period, max_period, off set, dead line, BCET, WCET, resource, and priority. First, the task is initialized; after initialization, a new cycle is started, and it is on the WaitingOffset position and waits for the initial offset. Then, the task is on the WaitingDepedency position and waits for the end of the predecessor task it depends on. When the dependency constraint is reached, the task will send ready[id]! to the CPU resource. The system resource and scheduling strategy will insert the task into the queue, and the task will enter the Ready position. After that, the task will switch between Running and Suspend according to its position in the task scheduling queue, at a different rate of local clock x. When completed, the task will send finished[id]! to the CPU resource, and the system resource and scheduling policy will remove the task from the scheduling queue. At last, the task is completed; the periodic task will continue to start a new cycle, and the nonperiodic task will enter the Done position.Figure 8
Task template.


### 5.4. Verification Queries

We use the following query statement to verify schedulability:(i)
Check the schedulability of the system (the error location is not reachable):A[] forall (i: t_id) not Task (i).Error(ii)
Find the total worst CPU usage:sup: usedTime, idleTime, globalTime(iii)
Find the worst-case response times inn tasks:sup:WCRT[0], ..., WCRT[n-1]


## 5.1. The Uppaal Framework

The Uppaal framework [36] consists of the following process models: a fixed-priority preemptive scheduling strategy, a system resource model, a task model, and a model to ensure global invariance. The template we provide for the task model is parameterized using an explicit sequence of task attributes, and we can customize the protocols that the tasks share on specific resources [37]. The main modeling elements are summarized below:(i)
A system resource sharing template. The system has two states: Idle and Inuse. The states switch through the interaction with tasks and scheduling strategy; therefore, the resource utilization rate can be calculated;(ii)
A scheduling strategy template to process tasks in the queue according to different scheduling strategies;(iii)
A task template that can set attributes according to the definition in Section4.2 task automaton. Each task uses the following clocks and data variables:(iv)
the task and its clocks are parameterized by the identifier id; the local clockx is used to control the execution status of its own tasks, and the global clock time [id] is used to control the execution status of the task set in the entire system.


## 5.2. Resource and Scheduler Model

Figures6 and 7 show a model of system resources (CPU) and scheduling strategy. First, the system resource model is initialized. Since no user task is running, the CPU runs idle tasks and is in the Idle position. When a task is ready, it sends the signal ready [id]! on the resource preparation channel so that the system resource moves from Idle to an intermediate state position and then sends the signal insert_task [policy]! on the channel to insert the new task into the scheduling queue. Then, the scheduling strategy model FPS receives the signal. If the scheduling queue is not empty, the priority of the current task is compared with the priority in the queue in turn and then inserted into the task queue by insert_task_in_buffer (); otherwise, the current task is directly inserted into the head position of the task queue by insert_at (0, ready_task, id). Then, the resource selects the highest priority task from the task queue and enters the running state position Inuse.Figure 6
Resource.Figure 7
Scheduler.The task releases the CPU through the signal finished [id]!. In this case, the scheduling policy model removes the task from the task queue by removeTask (). If the task queue is empty at this time, the CPU runs the idle task and moves to the Idle position. If it is not empty, the highest priority task is extracted from the task queue, and the CPU is still in the running state, Inuse position. It also uses the stopwatch usedTime to calculate the CPU usage time and then to calculate the total CPU load asused Time/global Time.


## 5.3. Task Template

Figure8 shows the task model. The task model is built according to the task automaton template proposed in Section 4.2. Each task is instantiated by in it_off set, min_period, max_period, off set, dead line, BCET, WCET, resource, and priority. First, the task is initialized; after initialization, a new cycle is started, and it is on the WaitingOffset position and waits for the initial offset. Then, the task is on the WaitingDepedency position and waits for the end of the predecessor task it depends on. When the dependency constraint is reached, the task will send ready[id]! to the CPU resource. The system resource and scheduling strategy will insert the task into the queue, and the task will enter the Ready position. After that, the task will switch between Running and Suspend according to its position in the task scheduling queue, at a different rate of local clock x. When completed, the task will send finished[id]! to the CPU resource, and the system resource and scheduling policy will remove the task from the scheduling queue. At last, the task is completed; the periodic task will continue to start a new cycle, and the nonperiodic task will enter the Done position.Figure 8
Task template.


## 5.4. Verification Queries

We use the following query statement to verify schedulability:(i)
Check the schedulability of the system (the error location is not reachable):A[] forall (i: t_id) not Task (i).Error(ii)
Find the total worst CPU usage:sup: usedTime, idleTime, globalTime(iii)
Find the worst-case response times inn tasks:sup:WCRT[0], ..., WCRT[n-1]


## 6. Case Study and Data Analysis

We present a case study to evaluate our method. The original task set configuration is shown in Table3. The column attributes include WCET, period, deadline, priority, scheduled point, and CPU utilization of each task. Now, adding the AES algorithm to task 3 is considered to protect it without affecting its schedulability. Task 3 needs to encrypt 5.0kb of data and send it in each period. And the CPU occupancy rate is required to be less than 95%. Under this condition, we evaluate the feasibility of the AES algorithm with different configurations. Figure 9 shows the algorithm’s flow diagram for the analysis of tasks related to AES.Table 3
Task set configuration.
iWi (μ s)Ti (ms)Di (ms)PiSchedPi (ms)Ui (%)110 05030303{30}33.5230 15080802{30, 60}37.69337 9892002001{150, 160, 180, 200}18.99Figure 9
AES-related analysis process.Sensitivity analysis is performed on the original task set, and the maximum allowable change in WCET of task 3 is calculated. According to the formula, we have(23)ΔW3max=minmaxt∈schedP3t−n3⟶⋅W3⟶t/T3,T3⋅Umax−Uori,ΔW3max=minmax150000−148539,160000−158589,180000−188739,200000−198789,3636,ΔW3max=1461.We can see that in the sensitivity analysis of this task set, the factor restricting the WCET of task 3 is schedulability rather than CPU utilization. After calculating the maximum change in WCET of task 3, we calculate the upper bound of the throughput of different configurations of AES under this constraint, which can be expressed as(24)TPSAES≤ΔW3max−Tmisc⋅block_sizeT3·Tblock.Through formula (24) and the instruction-level overhead prediction model in Section 3, we can calculate the upper throughput bound of AES with different key lengths and encryption modes in the task set of the case. As a reference, it can be a performance measurement for the selection of cryptographic algorithms and encryption mode. For example, for the configuration of AES-192-CBC, the upper bound of its throughput rate is 27.52kb/s, and for AES-256-CBC, the value is 23.68kb/s.The encryption requirement of task 3 is5.0kb per period, so the required throughput rate is 25kb/s. According to the sensitivity analysis, we can conclude that AES-192-CBC is feasible but AES-256-CBC is not. Next, we use the task automaton model to verify this conclusion.The results of our model-based framework include three parts: task set schedulability judgment, worst-case response time estimation, and cycle-limited verification benchmark CPU utilization estimation.Schedulability. In the task automata model, the task state that violates the time constraints will be transferred to Error. By retrieving the state space list, the formal verification tool Uppaal can transform the schedulability problem into the automata reachability problem. By using query statement 1 in Section5.4, the correctness of our analysis results has been verified.Worst-case response time. In the response time analysis, the WCRT of each task is calculated and compared with the deadline. This is a visual proof of schedulability that if the WCRT of each task does not exceed the corresponding deadline, the system is schedulable. Table4 compares the WCRT of the original task set and the task set after adding AES-192-CBC and AES-256-CBC, respectively. Task 3, which adds AES-256-CBC, will enter the Error state in Uppaal, and the task will be terminated, so its WCRT cannot be estimated.Table 4
Task set WCRT verification results.
Task setTaskPeriod (μs)Deadline (μs)WCET (μs)WCRT (μs)Original task set130 00030 00010 05010 050280 000800 00030 15050 2503200 000200 00037 989148 539Task set with AES-192-CBC130 00030 00010 05010 050280 000800 00030 15050 2503200 000200 00039 347149 897Task set with AES -256-CBC130 00030 00010 05010 050280 000800 00030 15050 2503200 000200 00039 529—CPU utilization. In the periodic task model of RTOS, tasks do not have a fixed progress measurement. To control the running progress of tasks and even the entire task set, we use the cycle count to indicate the number of cycles up to the current time. When the cycle count reaches a preset upper limit (CYCLELIMIT), it is reset to 0 along with all global clocks.Before resetting the cycle counter Cycle, exploring the hyperperiod (the least common multiple of periods) of all periodic tasks is an effective way to simplify the set of infinite periodic tasks. There are three task periods in the case:30000μs, 80000μs, and 200000μs, so the potential hyperperiod is 1200000μs. If the global cycle (CYCLE) is set to 120000μs, the number of hyperperiods is 10 global cycles. The results are shown in Table 5.Table 5
Task set (with AES-192-CBC) CPU utilization.
Cycle limitIdle (μs)Used (μs)Global (μs)Utilization (%)10120 000120 0001002103239 897240 00099.957310 156349 844360 00097.179429 906450 094480 00093.770539 959560 041600 00093.340650 062669 938720 00093.047769 762770 238840 00091.695879 865880 135960 00091.681979 8651000 1351080 00092.71810109 6681090 3321200 00090.86112109 7711330 2291440 00092.37715149 6271650 3731800 00091.67318189 5331970 4672160 00091.68720219 3362180 6642400 00090.86130329 0043270 9963600 00090.86140438 6724361 3284800 00090.861In this case, the CPU utilization is not the major factor limiting the task WCRT, so only the CPU utilization of the task set using AES-192-CBC under different global cycles is shown. The CPU utilization is verified by query 2 in Section5.4. When the cycle counter Cycle is 1 to 10; that is, during the first hyperperiod, the CPU utilization fluctuates. When the cycle counter Cycle is 10, the CPU utilization stabilizes to 90.861% for the first time, and the fluctuation of the CPU utilization gradually decreases. When the cycle counter Cycle is a multiple of 10, that is, when the time window taken is an integer number of hyperperiod, the CPU utilization is stable at 90.861%.


### 6.1. STM32 Experimental Analysis

We port FreeRTOS10.0.0.1 on the STM32F103VE platform and implement the case. We record the experimental results to judge the accuracy of our method and the correctness of task automata verification. The results are shown in Figures10–13.Figure 10
Original CPU utilization.Figure 11
AES-192-CBC CPU utilization.Figure 12
AES-256-CBC CPU utilization.Figure 13
Task set WCRT comparative analysis.Through Tracealyzer’s tracking results, we can see that in the original task set and the task set of adding AES-192-CBC and AES-256-CBC, the overall CPU usage is stable at 89.6%, 90%, and 90.6%, respectively. These are similar to automata estimation and are all lower than the required values because in this case, the CPU usage is not the key factor affecting feasibility. In Figure13, we can see that, compared to task 3, to which the AES algorithm is directly added, the WCRT of Tasks 1 and 2 has no major changes before and after the application of the AES algorithm. There are only small fluctuations, and they are all within their deadline. It can prove the schedulability of these two tasks. For Task 3, in the original task set and after the application of AES-192-CBC, its WCRT is within the deadline and can be scheduled; but after the AES-256-CBC is added, its WCRT exceeds the deadline range, and Task 3 cannot be scheduled. This is also consistent with our analysis and formal verification results.


## 6.1. STM32 Experimental Analysis

We port FreeRTOS10.0.0.1 on the STM32F103VE platform and implement the case. We record the experimental results to judge the accuracy of our method and the correctness of task automata verification. The results are shown in Figures10–13.Figure 10
Original CPU utilization.Figure 11
AES-192-CBC CPU utilization.Figure 12
AES-256-CBC CPU utilization.Figure 13
Task set WCRT comparative analysis.Through Tracealyzer’s tracking results, we can see that in the original task set and the task set of adding AES-192-CBC and AES-256-CBC, the overall CPU usage is stable at 89.6%, 90%, and 90.6%, respectively. These are similar to automata estimation and are all lower than the required values because in this case, the CPU usage is not the key factor affecting feasibility. In Figure13, we can see that, compared to task 3, to which the AES algorithm is directly added, the WCRT of Tasks 1 and 2 has no major changes before and after the application of the AES algorithm. There are only small fluctuations, and they are all within their deadline. It can prove the schedulability of these two tasks. For Task 3, in the original task set and after the application of AES-192-CBC, its WCRT is within the deadline and can be scheduled; but after the AES-256-CBC is added, its WCRT exceeds the deadline range, and Task 3 cannot be scheduled. This is also consistent with our analysis and formal verification results.


## 7. Related Work

### 7.1. Cipher Overhead Evaluation

Liu et al. [4] proposed a mathematical model based on the basic operation cost frequently used in cryptographic algorithms to predict the cost of these algorithms. Since these basic operations cannot be ignored in implementation, the prediction result can be seen as the lower bound of the overhead. Bauer and Freiling [38] gave an overview of cycle-accurate simulation problems and showed a method for cycle-accurate ARM Thumb-2 simulators. The classification of the Thumb-2 instruction set was used for reference. Granelli and Boato [5] proposed a method to evaluate the complexity and computational cost of different block ciphers that are independent of the platform on which they are implemented. As a representative of resource-constrained devices, the cost evaluation and measurement of cryptographic algorithms on wireless sensor networks [2, 6, 39–41] have been widely studied.


### 7.2. Schedulability Analysis

Yalcinkaya et al. [42] determined the sensitivity of task execution time. The paper measured the influence of parameters on schedulability and proved its correctness and optimality. Punnekkat et al. [43] provided a general method for sensitivity analysis of the task set. This method can help developers integrate changes to the system while ensuring that schedulability remains unchanged. Bini and Buttazzo [26] proposed a novel method to analyze the schedulability of periodic tasks under RM priority allocation [25]. This method can accurately describe the feasible region in the task calculation time space (C space). Afterwards, they [44] summarized a theoretical method for the sensitivity analysis of a real-time system containing a set of periodic tasks. The proposed method allows designers not only to verify the feasibility of the application but also to determine the specific operations to be performed on the design variables to ensure the schedulability of the task set or improve resource utilization.


### 7.3. Formal Verification

Fersman et al. [15] provided a model, task automaton, for real-time systems with nonuniform repetitive computing tasks. It is an extended version of the timed automaton, which can be used to specify resource constraints and strict timing restrictions in computation. The paper proves that the schedulability check problem related to preemptive scheduling is decidable for task automaton. Mikučionis et al. [45] proposed a modeling framework that uses Uppaal real-time model checker to perform schedulability analysis. Contributions included the modeling framework, its application in industrial case studies, and the comparison of the results with classical response time analysis.The related work is elaborated in three parts: the overhead estimation analysis and modeling of cryptographic algorithms on embedded platforms, task schedulability and sensitivity analysis in RTOS, and the establishment of RTOS models based on timed task automaton. The related research results in the three fields are introduced, respectively. However, as far as we know, there is no method to analyze the application feasibility of cryptographic algorithm in the RTOS task set, which stimulates the thinking and research in this paper.


## 7.1. Cipher Overhead Evaluation

Liu et al. [4] proposed a mathematical model based on the basic operation cost frequently used in cryptographic algorithms to predict the cost of these algorithms. Since these basic operations cannot be ignored in implementation, the prediction result can be seen as the lower bound of the overhead. Bauer and Freiling [38] gave an overview of cycle-accurate simulation problems and showed a method for cycle-accurate ARM Thumb-2 simulators. The classification of the Thumb-2 instruction set was used for reference. Granelli and Boato [5] proposed a method to evaluate the complexity and computational cost of different block ciphers that are independent of the platform on which they are implemented. As a representative of resource-constrained devices, the cost evaluation and measurement of cryptographic algorithms on wireless sensor networks [2, 6, 39–41] have been widely studied.


## 7.2. Schedulability Analysis

Yalcinkaya et al. [42] determined the sensitivity of task execution time. The paper measured the influence of parameters on schedulability and proved its correctness and optimality. Punnekkat et al. [43] provided a general method for sensitivity analysis of the task set. This method can help developers integrate changes to the system while ensuring that schedulability remains unchanged. Bini and Buttazzo [26] proposed a novel method to analyze the schedulability of periodic tasks under RM priority allocation [25]. This method can accurately describe the feasible region in the task calculation time space (C space). Afterwards, they [44] summarized a theoretical method for the sensitivity analysis of a real-time system containing a set of periodic tasks. The proposed method allows designers not only to verify the feasibility of the application but also to determine the specific operations to be performed on the design variables to ensure the schedulability of the task set or improve resource utilization.


## 7.3. Formal Verification

Fersman et al. [15] provided a model, task automaton, for real-time systems with nonuniform repetitive computing tasks. It is an extended version of the timed automaton, which can be used to specify resource constraints and strict timing restrictions in computation. The paper proves that the schedulability check problem related to preemptive scheduling is decidable for task automaton. Mikučionis et al. [45] proposed a modeling framework that uses Uppaal real-time model checker to perform schedulability analysis. Contributions included the modeling framework, its application in industrial case studies, and the comparison of the results with classical response time analysis.The related work is elaborated in three parts: the overhead estimation analysis and modeling of cryptographic algorithms on embedded platforms, task schedulability and sensitivity analysis in RTOS, and the establishment of RTOS models based on timed task automaton. The related research results in the three fields are introduced, respectively. However, as far as we know, there is no method to analyze the application feasibility of cryptographic algorithm in the RTOS task set, which stimulates the thinking and research in this paper.


## 8. Conclusions and Future Work

In this paper, we analyze the instruction-level overhead of commonly used symmetric cryptographic algorithms on a chip, establish an automaton model based on the task set in RTOS, and introduce the parameter-based sensitivity analysis. In the experimental part, for a concrete case, we conducted a feasibility analysis of AES in different modes, and then, we construct a model for RTOS on a single-core CPU with a fixed priority preemptive scheduling strategy using Uppaal and verify its schedulability before and after adding a cryptographic algorithm for tasks. Comparing the results with the running data on a real embedded RTOS tracked by the tracealyzer tool, it shows that the estimation results of our method are substantially consistent with the actual data. It is proved that this method can effectively estimate the impact of a cryptographic algorithm on RTOS system task scheduling and provide a quantitative index for the application of cryptographic algorithms on embedded platforms.In future work, we intend to establish a more accurate estimation model for the overhead of cryptographic algorithms and incorporate more cryptographic algorithms into our evaluation model. We also plan to conduct a sensitivity analysis of other factors affecting RTOS scheduling and study the impact of different scheduling strategies, processor frequency, jitter, and deadlines on models and analysis methods, to build a model that can describe the running process of tasks more accurately.



---

*Source: 4118994-2022-01-12.xml*