A hardware device based on multiple symmetric algorithms and multiple masters for encryption and decryption
By designing multiple interfaces and resource scheduling modules of symmetrical algorithm cores in the hardware device, independent encryption and decryption work between multiple Masters is realized, which solves the problems of interface compatibility and low efficiency in the existing technology and improves the compatibility of security chips. performance and operational efficiency.
Patent Information
- Application Number
- CN202210349023.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-04-01
AI Technical Summary
Existing technology is difficult to implement independent encryption and decryption work between multiple masters in multiple interface environments, resulting in non-interference and compatibility issues between high-speed and low-speed interfaces of security chips, resulting in low efficiency.
Design a hardware device that uses PCIE, USB, SPI, IIC, UART and other interfaces as the master of the data source, sets up multiple symmetrical algorithm cores and resource scheduling modules, and achieves independence between multiple masters through ID numbering and FIFO space management. Encryption and decryption work, and use the reuse and resource scheduling of symmetric algorithm cores to improve concurrent execution capabilities.
It improves the compatibility and efficiency of the algorithm, supports multiple Masters to perform concurrent operations of different algorithms or the same algorithm at the same time, solves the problem of low efficiency caused by the sequential execution of a single Master, and realizes the independent existence and non-interference between multiple Masters.
Smart Images

Figure CN114696996B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of symmetric algorithm data processing, and in particular to a hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters. Background Art
[0002] With the development of big data, artificial intelligence, cloud computing and other fields, the requirements for security features have become more urgent. The transmission of data sources has evolved from a single interface to multiple interfaces, especially in the security industry of artificial intelligence in the construction of new infrastructure, 5G network Internet of Vehicles application fields and industrial Internet fields. These fields are all based on data calculations under the premise of security and require rich interfaces, including high-speed PCIE and USB channels, as well as slow SPI, IIC and UART channels. Therefore, it is necessary to find a hardware solution that can enable a single security chip to meet the needs of multiple Master data sources to work independently without interfering with each other. Summary of the invention
[0003] The purpose of the present invention is to provide a hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters, thereby solving the above-mentioned problems existing in the prior art.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0005] A hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters, including a master using a PCIE output high-speed interface as a data source, a master using a USB output high-speed interface as a data source, and a master using an SPI and / or IIC and / or UART low-speed interface as a data source, wherein the multiple masters work independently and do not affect each other; the hardware device is internally provided with multiple symmetric algorithms, the multiple symmetric algorithms form a symmetric algorithm core, and each independent symmetric algorithm core can call any one of the multiple symmetric algorithms for encryption and decryption; the hardware device is provided with a resource scheduling module.
[0006] Preferably, the multiple symmetric algorithms include SM1 algorithm, SM4 algorithm, DES algorithm, and AES algorithm.
[0007] Preferably, the encryption and decryption process is as follows:
[0008] S11, allocating independent FIFO space for the Master using the PCIE high-speed output interface as the data source, the Master using the USB high-speed output interface as the data source, and the Master using the SPI and / or IIC and / or UART low-speed interface as the data source; and allocating FIFO space of different sizes according to the two types of high-speed and low-speed Masters;
[0009] S12. Assign ID numbers to multiple Masters. The bit width of the ID number is equal to the number of Masters, that is, N Masters use N-bit coded IDs, and each Master occupies one valid information bit. If the valid information bit is high, it means that the service channel of the Master is valid.
[0010] S13. When the hardware device detects that the service channel of the Master is valid, the Master ID, service type, and length information of the data to be processed are stored in the FIFO space under the ID index of the Master, and the resource scheduling module is notified to perform scheduling control and start storing the data flow of the Master;
[0011] S14. Allocate independent RAM data storage space for each Master's data stream, index data in and out based on the Master's ID, and record the starting address of each data segment for each Master;
[0012] S15. After the data flow operation of each Master is completed, the data is overwritten according to the starting address where each Master records each segment of data, that is, the recorded data starting address is used as the data source address and also as the result data address.
[0013] Preferably, the data to be processed comes from multiple Masters. Since each Master has an independent FIFO space to store service request related information, it is necessary to allocate an independent RAM data storage space for each Master's data stream. The specific process is as follows:
[0014] S21, the hardware device queries the FIFO space under the ID index of the Master. If there is service request related information in the FIFO space, it starts to query the RAM data storage space status of the data stream of the Master. If the RAM data storage space is not full, it starts to allocate space addresses for the data stream of the Master, and records the starting address of the data. It also clears the service request related information in the FIFO space and pops out the FIFO space as a whole.
[0015] S22, if it is found that the RAM data storage space is full or the remaining space is less than the length of the service request related information in the FIFO space, data will not be allocated to the service in the FIFO space, and the FIFO space state will be maintained;
[0016] S23, the resource scheduling module generates a fixed-format tag based on the number of the idle state and the initial address and length information of the data in the RAM data storage space according to the busy and idle state of the symmetric algorithm core, and sends the data to be processed to the symmetric algorithm core in the idle state;
[0017] S24, the symmetric algorithm core starts working, and each time a minimum unit of data is processed, the data is overwritten from the initial address of the data in the RAM data storage space until the data is completely calculated. At this time, the content stored in the initial address of the data in the RAM data storage space is the result data, and waits for the external Master to take it out.
[0018] Preferably, step S23 specifically includes the following contents:
[0019] S231, the resource scheduling device queries the idle state of the symmetric algorithm core;
[0020] S232, allocating a data source to the algorithm core and generating corresponding Tag information, wherein the Tag information includes a free number, an initial address and length information of data in the RAM data storage space;
[0021] S233. If the symmetric algorithm core is in an idle state, the corresponding symmetric algorithm is called to independently perform encryption and decryption work based on the data to be processed in the symmetric algorithm core and business requirements, and the resource scheduling module is notified after the work is completed; if the symmetric algorithm core is in a busy state, busy information is generated and the busy information is updated to the Tag information.
[0022] Preferably, the symmetric algorithm core is divided into independent data processing units and key processing units;
[0023] The data processing unit solves the encryption and decryption process operations; according to the different characteristics of each symmetric algorithm, the internal data processing functions that occupy large resources and have a long processing cycle are divided into independent data processing units. The data processing unit is set to a pipeline mode to facilitate multi-data pipeline processing and multi-core data management; based on the premise that the symmetric algorithm core can only operate one symmetric algorithm at a time, the internal resources are reused to achieve the purpose of minimizing resources. The reused resources are divided into three categories;
[0024] The first category is logic related to the original input data: this type of logic is shared within the algorithm core and is uniformly processed as original data;
[0025] The second category is process combination logic: reuse process combination logic with the same operation type;
[0026] The third category is logic related to result output, which is reused by the symmetric algorithm in the algorithm core;
[0027] The key processing unit solves the problem of key generation; according to the different characteristics of each symmetric algorithm in the symmetric algorithm core, the key processing unit is processed by a unified interface, and contains key vector controllers of multiple symmetric algorithms to facilitate timing control of hardware devices.
[0028] Preferably, multiple Masters each have their own FIFO space for storing the Master's request information; each Master can be allocated its own data source RAM data storage space when the RAM data storage space is free and can be allocated, so that the symmetric algorithm core can work independently for different Masters based on different data sources.
[0029] The beneficial effects of the present invention are as follows: 1. In the hardware device of the present invention, each independent Master can access different types of algorithms in the symmetric algorithm core, which is not limited to the problem of a single Master accessing a single type of algorithm, thereby improving the compatibility of the algorithm. 2. In the hardware device of the present invention, multiple Masters can support multiple symmetric algorithm cores to perform operations of different types of algorithms at the same time, which is not limited to the problem of a single Master accessing different types of symmetric algorithms and requiring sequential execution. It can also support multiple Masters to perform encryption and decryption operations of different data of the same algorithm at the same time. Compared with the problem that a single Master needs to wait for the current Master to be idle when performing encryption and decryption of different data of the same algorithm, it has a great improvement in efficiency and convenience. 3. In the hardware device of the present invention, different masters are used to concurrently execute different processes of an algorithm, which can fundamentally and greatly solve the problem of a single Master sequentially executing the process of key generation and data encryption and decryption, resulting in low efficiency. 4. In the hardware device of the present invention, each Master is set to exist independently, and there is no problem of mutual restriction or constraint, and one or more Masters can be used for simultaneous operation. The compatibility problem of Master is further solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a schematic diagram of the structure of a hardware device in an embodiment of the present invention;
[0031] Figure 2 Schematic diagram of the structure of the symmetric algorithm core in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.
[0033] like Figure 1As shown, in this embodiment, a hardware device for performing encryption and decryption based on multiple Masters using multiple symmetric algorithms is provided, including a Master that uses a PCIE output high-speed interface as a data source, a Master that uses a USB output high-speed interface as a data source, and a Master that uses an SPI and / or IIC and / or UART low-speed interface as a data source. The multiple Masters work independently and do not affect each other. The hardware device is internally provided with multiple symmetric algorithms, and the multiple symmetric algorithms form a symmetric algorithm core. Each independent symmetric algorithm core can call any one of the multiple symmetric algorithms for encryption and decryption. The hardware device is provided with a resource scheduling module.
[0034] In this embodiment, the multiple symmetric algorithms include SM1 algorithm, SM4 algorithm, DES algorithm, and AES algorithm.
[0035] In this embodiment, the encryption and decryption process is specifically as follows:
[0036] S11, allocating independent FIFO space for the Master using the PCIE high-speed output interface as the data source, the Master using the USB high-speed output interface as the data source, and the Master using the SPI and / or IIC and / or UART low-speed interface as the data source; and allocating FIFO space of different sizes according to the two types of high-speed and low-speed Masters;
[0037] S12. Assign ID numbers to multiple Masters. The bit width of the ID number is equal to the number of Masters, that is, N Masters use N-bit coded IDs, and each Master occupies one valid information bit. If the valid information bit is high, it means that the service channel of the Master is valid.
[0038] S13. When the hardware device detects that the service channel of the Master is valid, the Master ID, service type, and length information of the data to be processed are stored in the FIFO space under the ID index of the Master, and the resource scheduling module is notified to perform scheduling control and start storing the data flow of the Master;
[0039] S14. Allocate independent RAM data storage space for each Master's data stream, index data in and out based on the Master's ID, and record the starting address of each data segment for each Master;
[0040] S15. After the data flow operation of each Master is completed, the data is overwritten according to the starting address where each Master records each segment of data, that is, the recorded data starting address is used as the data source address and also as the result data address.
[0041] In this embodiment, the data to be processed comes from multiple Masters. Since each Master has an independent FIFO space to store service request related information, it is necessary to allocate an independent RAM data storage space for each Master's data stream. The specific process is as follows:
[0042] S21, the hardware device queries the FIFO space under the ID index of the Master. If there is service request related information in the FIFO space, it starts to query the RAM data storage space status of the data stream of the Master. If the RAM data storage space is not full, it starts to allocate space addresses for the data stream of the Master, and records the starting address of the data. It also clears the service request related information in the FIFO space and pops out the FIFO space as a whole.
[0043] S22, if it is found that the RAM data storage space is full or the remaining space is less than the length of the service request related information in the FIFO space, data will not be allocated to the service in the FIFO space, and the FIFO space state will be maintained;
[0044] S23, the resource scheduling module generates a fixed-format tag based on the number of the idle state and the initial address and length information of the data in the RAM data storage space according to the busy and idle state of the symmetric algorithm core, and sends the data to be processed to the symmetric algorithm core in the idle state;
[0045] S24, the symmetric algorithm core starts working, and each time a minimum unit of data is processed, the data is overwritten from the initial address of the data in the RAM data storage space until the data is completely calculated. At this time, the content stored in the initial address of the data in the RAM data storage space is the result data, and waits for the external Master to take it out.
[0046] In this embodiment, the independent symmetric algorithm core can call any one of the four algorithms to perform encryption and decryption, generate idle and busy flag information according to the working state of the symmetric algorithm core, and upload the working state to the resource scheduling module. Then step S23 specifically includes the following contents:
[0047] S231, the resource scheduling device queries the idle state of the symmetric algorithm core;
[0048] S232, allocating a data source to the symmetric algorithm core and generating corresponding Tag information, wherein the Tag information includes relevant information such as a free number, an initial address and length information of data in a RAM data storage space;
[0049] S233. If the symmetric algorithm core is in an idle state, the corresponding symmetric algorithm is called to independently perform encryption and decryption work based on the data to be processed in the symmetric algorithm core and business requirements, and the resource scheduling module is notified after the work is completed; if the symmetric algorithm core is in a busy state, busy information is generated and the busy information is updated to the Tag information.
[0050] like Figure 2 As shown, in this embodiment, on the basis of traditional symmetric algorithms, according to the characteristics of algorithms such as SM1, SM4, DES, AES, etc., multiple symmetric algorithms are encapsulated into a minimum processing unit (symmetric algorithm core), and the symmetric algorithm core is designed as two independent structures, thereby meeting the requirements of resource sharing, minimum resource occupation, and performance priority.
[0051] Divide the symmetric algorithm core into independent data processing units and key processing units;
[0052] The data processing unit solves the encryption and decryption process operations; according to the different characteristics of each symmetric algorithm, the internal data processing functions that occupy large resources and have a long processing cycle are divided into independent data processing units. The data processing unit is set to a pipeline mode to facilitate multi-data pipeline processing and multi-core data management; based on the premise that the symmetric algorithm core can only operate one symmetric algorithm at a time, the internal resources are reused to achieve the purpose of minimizing resources. The reused resources are divided into three categories;
[0053] The first category is logic related to the original input data: this type of logic is shared within the algorithm core and is uniformly processed as original data;
[0054] The second category is process combination logic: reuse process combination logic with the same operation type;
[0055] The third category is logic related to result output, which is reused by the symmetric algorithm in the algorithm core;
[0056] The key processing unit solves the problem of key generation; according to the different characteristics of each symmetric algorithm in the symmetric algorithm core, the key processing unit is processed by a unified interface, and contains key vector controllers of multiple symmetric algorithms to facilitate timing control of hardware devices.
[0057] In this embodiment, multiple Masters each have their own FIFO space for storing the Master's request information; each Master can be allocated its own data source RAM data storage space when the RAM data storage space is free and can be allocated, so that the symmetric algorithm core can work independently for different Masters based on different data sources.
[0058] By adopting the above technical solution disclosed in the present invention, the following beneficial effects are obtained:
[0059] The present invention provides a hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters. In the hardware device of the present invention, each independent Master can access different types of algorithms in a symmetric algorithm core, which is not limited to the problem that a single Master accesses a single type of algorithm, thereby improving the compatibility of the algorithm. In the hardware device of the present invention, multiple Masters can support multiple symmetric algorithm cores to perform operations of different types of algorithms at the same time, without limiting the problem that a single Master needs to perform sequential execution of different types of symmetric algorithms. It can also support multiple Masters to perform encryption and decryption operations of different data of the same algorithm at the same time. Compared with the problem that a single Master needs to wait for the current Master to be idle when performing encryption and decryption of different data of the same algorithm, it has a great improvement in efficiency and convenience. In the hardware device of the present invention, different masters are used to concurrently execute different processes of an algorithm, which can fundamentally and greatly solve the problem that a single Master sequentially executes the process of key generation and data encryption and decryption, resulting in low efficiency. In the hardware device of the present invention, each Master is set to exist independently, and there is no problem of mutual restriction or constraint, and one or more Masters can be used for simultaneous operation. The compatibility problem of Master is further solved.
[0060] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.
Claims
1. A hardware device that performs encryption and decryption based on multiple symmetric algorithms and multiple masters. Features: Including a Master using a PCIE output high-speed interface as a data source, a Master using a USB output high-speed interface as a data source, and a Master using an SPI and / or IIC and / or UART low-speed interface as a data source, wherein the multiple Masters work independently and do not affect each other; a plurality of symmetric algorithms are arranged inside the hardware device, and the plurality of symmetric algorithms form a symmetric algorithm core, and each independent symmetric algorithm core can call any one of the plurality of symmetric algorithms for encryption and decryption; a resource scheduling module is arranged in the hardware device; The specific process of encryption and decryption is as follows: S11, allocating independent FIFO space for the Master using the PCIE high-speed output interface as the data source, the Master using the USB high-speed output interface as the data source, and the Master using the SPI and / or IIC and / or UART low-speed interface as the data source; and allocating FIFO space of different sizes according to the two types of high-speed and low-speed Masters; S12. Assign ID numbers to multiple Masters. The bit width of the ID number is equal to the number of Masters, that is, N Masters use N-bit coded IDs, and each Master occupies one valid information bit. If the valid information bit is high, it means that the service channel of the Master is valid. S13. When the hardware device detects that the service channel of the Master is valid, the Master ID, service type, and length information of the data to be processed are stored in the FIFO space under the ID index of the Master, and the resource scheduling module is notified to perform scheduling control and start storing the data flow of the Master; S14. Allocate independent RAM data storage space for each Master's data stream, index data in and out based on the Master's ID, and record the starting address of each data segment for each Master; S15. After the data flow operation of each Master is completed, the data is overwritten according to the starting address where each Master records each segment of data, that is, the recorded data starting address is used as the data source address and also as the result data address.
2. The hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters according to claim 1, Features: Various symmetric algorithms include SM1 algorithm, SM4 algorithm, DES algorithm, and AES algorithm.
3. The hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters according to claim 1, Features: The data to be processed comes from multiple Masters. Since each Master has an independent FIFO space to store business request related information, it is necessary to allocate independent RAM data storage space for each Master's data stream. The specific process is as follows: S21, the hardware device queries the FIFO space under the ID index of the Master. If there is service request related information in the FIFO space, it starts to query the RAM data storage space status of the data stream of the Master. If the RAM data storage space is not full, it starts to allocate space addresses for the data stream of the Master, and records the starting address of the data. It also clears the service request related information in the FIFO space and pops out the FIFO space as a whole. S22, if it is found that the RAM data storage space is full or the remaining space is less than the length of the service request related information in the FIFO space, data will not be allocated to the service in the FIFO space, and the FIFO space state will be maintained; S23, the resource scheduling module generates a fixed-format tag based on the number of the idle state and the initial address and length information of the data in the RAM data storage space according to the busy and idle state of the symmetric algorithm core, and sends the data to be processed to the symmetric algorithm core in the idle state; S24, the symmetric algorithm core starts working, and each time a minimum unit of data is processed, the data is overwritten from the initial address of the data in the RAM data storage space until the data is completely calculated. At this time, the content stored in the initial address of the data in the RAM data storage space is the result data, and waits for the external Master to take it out.
4. The hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters according to claim 3, Features: Step S23 specifically includes the following contents: S231, the resource scheduling device queries the idle state of the symmetric algorithm core; S232, allocating a data source to the algorithm core and generating corresponding Tag information, wherein the Tag information includes a free number, an initial address and length information of data in the RAM data storage space; S233. If the symmetric algorithm core is in an idle state, the corresponding symmetric algorithm is called to independently perform encryption and decryption work based on the data to be processed in the symmetric algorithm core and business requirements, and the resource scheduling module is notified after the work is completed; if the symmetric algorithm core is in a busy state, busy information is generated and the busy information is updated to the Tag information.
5. The hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters according to claim 4, Features: The symmetric algorithm core is divided into independent data processing units and key processing units; The data processing unit solves the encryption and decryption process operations; according to the different characteristics of each symmetric algorithm, the internal data processing functions that occupy large resources and have a long processing cycle are divided into independent data processing units. The data processing unit is set to a pipeline mode to facilitate multi-data pipeline processing and multi-core data management; based on the premise that the symmetric algorithm core can only operate one symmetric algorithm at a time, the internal resources are reused to achieve the purpose of minimizing resources. The reused resources are divided into three categories; The first category is logic related to the original input data: this type of logic is shared within the algorithm core and is uniformly processed as original data; The second category is process combination logic: reuse process combination logic with the same operation type; The third category is logic related to result output, which is reused by the symmetric algorithm in the algorithm core; The key processing unit solves the problem of key generation; according to the different characteristics of each symmetric algorithm in the symmetric algorithm core, the key processing unit is processed by a unified interface, and contains key vector controllers of multiple symmetric algorithms to facilitate timing control of hardware devices.
6. The hardware device for performing encryption and decryption based on multiple symmetric algorithms and multiple masters according to claim 5, Features: Multiple Masters each have their own FIFO space for storing the Master's request information; each Master can be allocated its own data source RAM data storage space when the RAM data storage space is free and can be allocated, so that the symmetric algorithm core can work independently for different Masters based on different data sources.
