RISC-V Instruction Set Extension Method and System for Information Security Applications

By extending the RISC-V instruction set with instructions such as load, store, modular addition, modular subtraction, and Montgomery modular multiplication, the problem of low computational efficiency in information security applications is solved, achieving efficient encryption and decryption operations and resource conservation.

CN116700797BActive Publication Date: 2026-11-17HANGZHOU DIANZI UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310612995.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2026-11-17
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

In the field of information security applications, existing technologies suffer from low efficiency in the basic instruction set of processors, which cannot efficiently execute 256-bit modular addition, subtraction and multiplication operations. Furthermore, dedicated encryption and decryption chips consume a lot of resources and are not flexible enough.

Method used

The design incorporates RISC-V instruction set extension methods for information security applications, including extended instructions such as load, store, modular addition, modular subtraction, and Montgomery modular multiplication. These extensions enable efficient 256-bit computations through a dedicated bus, extended registers, and dedicated computing units.

Benefits of technology

It improves the computational efficiency and cost-effectiveness of RISC-V processors when executing encryption and decryption algorithms, while reducing instruction space and clock cycles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116700797B_ABST
    Figure CN116700797B_ABST
Patent Text Reader

Abstract

This invention discloses a RISC-V instruction set extension method and system for information security applications. The method includes the following steps: 1) identifying the most frequently used operations in encryption and decryption algorithms and determining the function of the extended instructions; 2) determining the data path and bit width of the extended instructions; 3) determining the format and binary encoding of the extended instructions based on the instruction format and instruction set encoding space of the RISC-V instruction set. This invention effectively improves the computational efficiency of RISC-V processors when executing encryption and decryption algorithms and enhances the cost-effectiveness of the products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer architecture design, specifically relating to a RISC-V instruction set extension method and system for information security applications. Background Technology

[0002] The processor instruction architecture (or instruction set) of a computer serves as a bridge between software programs and the underlying hardware. The processor decodes and executes instructions to perform various calculations and control operations. Currently, when designing a processor instruction architecture, the primary consideration is instruction design for general-purpose computing. This involves designing the most frequently used functions in software code for various general applications as instructions; the set of these instructions is called the basic instruction set. However, designing processor instructions solely in this way can significantly reduce processor efficiency in certain specialized application areas. For example, in information security applications, 256-bit modular addition, subtraction, and multiplication operations are involved, and implementing these operations using only the processor's basic instruction set is extremely inefficient. To enhance processor performance for specialized applications, in addition to designing the basic instruction set, sometimes extended instruction sets for specific domains are also designed in the computer processor instruction architecture design. Examples include various extended instruction sets for media applications, such as Intel's MMX instruction set and AMD's 3D Now instruction set.

[0003] In the field of information security applications, the core of various protocols and application software lies in encryption and decryption algorithms. Implementing these using only the processor's basic instruction set results in a large number of basic instructions, leading to excessive instruction space consumption, low computational efficiency, and long processing times. While using dedicated encryption / decryption chips as coprocessors offers high computational efficiency, it consumes significant physical resources and requires a large footprint. Furthermore, this approach lacks flexibility. Therefore, designing extended instructions specifically for information security applications is a highly valuable endeavor. On one hand, implementing various encryption and decryption algorithms in software ensures the flexibility and reconfigurability of the final product; on the other hand, extending instructions for security applications guarantees the cost-effectiveness of the final product.

[0004] Among the many computer processor instruction set architectures, the RISC-V instruction set is a novel embedded processor instruction set architecture introduced by UC Berkeley. It is completely open-source, standard, and supports a wide range of applications. While defining the necessary basic instruction set, it also reserves a large amount of instruction coding space for user-defined instruction extensions, facilitating the design of extended instruction sets for specialized applications. Based on this, this invention discloses a RISC-V instruction set extension method for information security applications. Summary of the Invention

[0005] Based on the above situation, the present invention provides a RISC-V instruction set extension method and system for information security applications.

[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0007] A method for extending the RISC-V instruction set for information security applications, used to construct a RISC-V instruction set for information security applications, includes the following:

[0008] 1) Identify the most frequent operations of the encryption / decryption algorithm to determine the function of the extended instructions.

[0009] 2) Determine the data path and bit width of the extended instructions.

[0010] 3) Determine the specific format and binary encoding of the extended instructions based on the instruction format and instruction set encoding space of the RISC-V basic instruction set.

[0011] Furthermore, in step 1), the extended instructions function as load instruction l256, store instruction s256, modulo addition instruction modadd, modulo subtraction instruction modsub, and Montgomery modulo multiplication instruction modmul.

[0012] Furthermore, in step 2), the data path for the extended instructions includes a dedicated bus, an extended register, a dedicated memory, and a dedicated computing unit, with a bit width of 256 bits.

[0013] The dedicated bus is used for data reading or storage between the extended register and the dedicated memory, and between the extended register and the dedicated computing unit; the extended register includes four 256-bit registers; the dedicated computing unit is used to perform modular addition, modular subtraction and modular multiplication operations.

[0014] Furthermore, in step 3), the specific format of the extended instruction is as follows:

[0015] l256 spr,offset(rs)

[0016] s256 spr,offset(rs)

[0017] modadd spr_d,spr_1,spr_2,spr_3

[0018] modsub spr_d,spr_1,spr_2,spr_3

[0019] modmul spr_d,spr_1,spr_2,spr_3

[0020] In the above instructions, spr / spr_x represents the extended extended register, and rs represents the existing general-purpose registers of RISC-V.

[0021] The extended load instruction l256 spr,offset(rs) reads 256 bits of data from the address (rs) + offset and loads it into the spr register. This is used by the RISC-V processor to read 256 bits of data from a specified memory address and store it in the extended register.

[0022] The extended memory instruction s256 spr,offset(rs) stores 256 bits of data from the spr register into the memory address (rs) + offset, which is used by the RISC-V processor to store the extended register data at the specified memory address.

[0023] The extended modulo addition instructions modadd spr_d, spr_1, spr_2, and spr_3 are used to implement spr_d = (spr_1 + spr_2) mod spr_3. That is, the source data is retrieved from the extended registers spr_1 and spr_2, the modulus is retrieved from spr_3, the addition and modulo calculation are performed, and the result is written back to spr_d.

[0024] The extended modulo subtraction instructions modsub spr_d, spr_1, spr_2, and spr_3 are used to implement spr_d = (spr_1 - spr_2) mod spr_3. That is, the source data is retrieved from the extended registers spr_1 and spr_2, the modulus is retrieved from spr_3, the subtraction and modulo are performed, and the result is written back to spr_d.

[0025] The extended Montgomery modular multiplication instructions modmul spr_d, spr_1, spr_2, spr_3 are used to implement spr_d = (spr_1 * spr_2 * 2) -256 The function mod spr_3 retrieves the source data from the extended registers spr_1 and spr_2, retrieves the modulus from spr_3, performs the multiplication and modulo operation, and then writes the result back into spr_d.

[0026] Furthermore, in step 3), the specific encoding of the extended instruction is as follows:

[0027] The L256 uses the Type I instruction format of the RISC-V instruction set, specifically encoded as follows:

[0028]

[0029] Here, imm, rs, and spr are used to encode offset, general-purpose registers, and extended registers, respectively.

[0030] The S256 uses the S-type instruction format in the RISC-V instruction set, specifically encoded as follows:

[0031]

[0032] Here, imm, rs, and spr are used to encode offset, general-purpose registers, and extended registers, respectively.

[0033] modadd, modsub, and modmul use a custom instruction set format, specifically encoded as follows:

[0034]

[0035] Here, spr_x is used to expand the register.

[0036] Based on the principle of accelerating recurring events, this invention extends five instructions to 256 bits: load, store, modular addition, modular subtraction, and Montgomery modular multiplication. Taking the implementation of Montgomery modular multiplication in a single-cycle processor as an example, using the technical solution of this invention, the number of instructions executed is reduced from 854 to 7, and the instruction space occupied is reduced by 99%. The number of execution clock cycles is reduced from 854 to 39, and the number of execution cycles is reduced by 95%. Therefore, this invention effectively improves the computational efficiency of RISC-V processors when executing asymmetric encryption and decryption algorithms such as Elliptic Curve Cryptography (ECC) and SM2 national cryptographic encryption and decryption algorithms, as well as the cost-effectiveness of the product.

[0037] This invention also discloses a system based on the above-mentioned RISC-V instruction set extension method for information security applications, which includes the following modules:

[0038] Extended instruction function determination module: Identifies the most frequent operations of the encryption / decryption algorithm and determines the function of the extended instructions;

[0039] Data path and bit width determination module: determines the data path and bit width of extended instructions;

[0040] Format and binary encoding determination module: Determines the format and binary encoding of extended instructions based on the instruction format and instruction set encoding space of the RISC-V instruction set.

[0041] In summary, this invention effectively improves the computational efficiency of RISC-V processors when executing encryption and decryption algorithms, as well as the cost-effectiveness of the products. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the prior art and the embodiments of the present invention, the accompanying drawings used in the description of the prior art and the embodiments of the present invention will be briefly introduced below.

[0043] Figure 1 This is a flowchart of a RISC-V instruction set extension method for information security applications, as disclosed in a preferred embodiment of the present invention.

[0044] Figure 2 This is a schematic diagram of the relationship between extended components of a RISC-V instruction set extension for information security applications, as disclosed in a preferred embodiment of the present invention.

[0045] Figure 3 This is a schematic diagram of an instruction set format for RISC-V instruction set extensions for information security applications, as disclosed in a preferred embodiment of the present invention.

[0046] Figure 4 This is a block diagram of a RISC-V instruction set extension system for information security applications, as disclosed in a preferred embodiment of the present invention. Detailed Implementation

[0047] The present invention will be further described below with reference to the accompanying drawings and by detailing preferred embodiments.

[0048] See Figure 1 The preferred embodiment provides a flowchart of a RISC-V instruction set extension method for information security applications, which specifically includes the following steps:

[0049] 1) Based on the principle of recurrence in instruction design and the Load / Store architecture characteristics of the RISC-V instruction set, the most frequent operations of the encryption and decryption algorithms are identified, thereby determining the functions of the extended instructions.

[0050] 2) Determine the data path and bit width of the extended instructions.

[0051] 3) Determine the specific format and binary encoding of the extended instructions based on the instruction format and instruction set encoding space of the RISC-V basic instruction set.

[0052] The following is a detailed description of each step in the RISC-V instruction set extension method for information security applications provided in this embodiment.

[0053] Step 1): Based on the recurrence principle of instruction design and the Load / Store architecture characteristics of the RISC-V instruction set, identify the most frequent operations of the encryption / decryption algorithm, thereby determining the functions of the extended instructions. The recurrence principle means accelerating frequently occurring events. Load / Store architecture characteristics: The load / store instructions specified by the RISC-V instruction set read data from memory into registers for use in other instruction operations, or the results of other instruction operations need to be written to registers before being stored in memory using the store instruction.

[0054] This embodiment uses the elliptic ECC encryption algorithm and the SM2 national cryptographic algorithm as examples. It can be seen that the encryption and decryption operations of these algorithms mainly involve dot product calculations. Dot product operations primarily consist of addition and doubling operations of points on the elliptic curve group. These addition and doubling operations are composed of modular addition, modular subtraction, modular multiplication, and modular inverse operations over a finite field. Modular inverse operations can be converted from standard projective coordinates or Jacobian weighted projective coordinates to modular multiplication operations. Therefore, this embodiment identifies modular addition, modular subtraction, and modular multiplication as the most frequently used operations for this type of encryption and decryption algorithm.

[0055] This embodiment, based on the SM2 national cryptographic document issued by the State Cryptography Administration, determines that this type of encryption algorithm can achieve good security with a data width of 256 bits. Furthermore, considering the Load / Store architecture characteristics of the RISC-V instruction set (i.e., register-oriented computation, with only Load / Store instructions able to access memory), reading and storing data in 256-bit increments is determined to be the most frequently used function.

[0056] This embodiment ultimately expands to include 5 instructions: load instruction l256, store instruction s256, mod add instruction modadd, mod subtract instruction modsub, and Montgomery mod multiplication instruction modmul.

[0057] Step 2) Determine the data path and bit width of the extended instruction.

[0058] This embodiment further determines the data path of the extended instructions after step 1), such as Figure 2 As shown, the data path consists of extended registers, a dedicated computing unit, a dedicated bus, and dedicated memory. Furthermore, the widths of the dedicated memory interface, extended registers, dedicated bus, and dedicated computing unit are all 256 bits. The dedicated memory stores data for encryption and decryption, the dedicated bus transmits data, the extended registers temporarily store the input and output data required by the dedicated computing unit, and the dedicated computing unit performs modular addition, subtraction, and multiplication calculations.

[0059] The specific data path is as follows: A 256-bit wide data block is read from dedicated memory using the L256 load instruction, and then temporarily stored in an extended register via a dedicated bus. This process is repeated three times. Then, using any modulo operation instruction, the dedicated computing unit retrieves the source data from the extended register, performs the calculation, and temporarily stores the 256-bit result back into the extended register. Finally, the S256 store instruction stores the data in the extended register in dedicated memory via the dedicated bus.

[0060] Step 3) Determine the specific format and binary encoding of the extended instructions based on the instruction format and instruction set encoding space of the RISC-V basic instruction set.

[0061] From the initial design of the RISC-V instruction set architecture, encoding space for user-defined extended instructions was reserved. In this embodiment, based on this encoding space, the opcode for the modulo arithmetic instruction set is determined to be 0001011 to distinguish whether it is a modulo arithmetic instruction. Simultaneously, the function code for the modulo addition instruction is determined to be 00001, the function code for the modulo subtraction instruction is 00010, and the function code for the modulo multiplication instruction is 00100, thereby distinguishing different instructions within the modulo arithmetic instruction set.

[0062] See Figure 3 This embodiment provides a schematic diagram of an instruction set format for RISC-V instruction set extensions for information security applications. This instruction set format is register-to-register type, meaning that both the operation fetch location and the write-back location are in registers. Specifically, bits 0-6 of the instruction format encoding are the opcode, used to distinguish the instruction type; bits 7-11 are the destination register number, used to determine the destination register used; bits 12-14 are a 3-bit function code, used to distinguish the specific function of the instruction; bits 15-19 are the source register 1 number, used to determine the source register 1 used; bits 20-24 are the source register 2 number, used to determine the source register 2 used; bits 25-29 are the source register 3 number, used to determine the source register 3 used; and bits 30-31 are a 2-bit function code, used to distinguish the specific function of the instruction. This embodiment designs three instructions for 256-bit modular arithmetic based on this instruction set format. Simultaneously, it extends the RISC-V instruction set's I and S instruction formats with two 256-bit load-memory instructions to assist in modular arithmetic implementation. The implementation of these instruction codes allows the RISC-V processor core to perform modular arithmetic by simply reading and executing these five instructions. This reduces the number of assembly instructions for modular arithmetic from hundreds to seven (modular addition, modulo subtraction, and Montgomery modular multiplication are executed separately). This significantly reduces the assembly instruction space, lowering resource consumption and improving processing efficiency.

[0063] The specific format of the five instructions is as follows:

[0064] The L256 uses the Type I instruction format of the RISC-V instruction set, specifically encoded as follows:

[0065]

[0066] Here, imm, rs, and spr are used to encode the offset, general-purpose register, and extended register, respectively.

[0067] The S256 uses the S-type instruction format in the RISC-V instruction set, specifically encoded as follows:

[0068]

[0069] Here, imm, rs, and spr are used to encode the offset, general-purpose register, and extended register, respectively.

[0070] modadd, modsub, and modmul use a custom instruction set format, specifically encoded as follows:

[0071]

[0072] Here, spr_x is used to expand the register.

[0073] The specific assembly code can be found in Table 1. Table 1 shows the assembly code corresponding to modular addition, modular subtraction, and Montgomery modular multiplication calculations in a normal RISC-V processor core and in this embodiment (due to the excessive amount of assembly code in normal processing, only the modular addition instruction is shown, and the others are omitted).

[0074] Table 1

[0075]

[0076]

[0077] like Figure 4 As shown, a system for a RISC-V instruction set extension method for information security applications, based on the above-described method embodiment, includes the following modules:

[0078] Extended instruction function determination module: Identifies the most frequent operations of the encryption / decryption algorithm and determines the function of the extended instructions;

[0079] Data path and bit width determination module: determines the data path and bit width of extended instructions;

[0080] Format and binary encoding determination module: Determines the format and binary encoding of extended instructions based on the instruction format and instruction set encoding space of the RISC-V instruction set.

[0081] Other aspects of this embodiment can be found in the embodiments described above.

[0082] The above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A RISC-V instruction set extension method for information security application, characterized in that Includes the following steps: 1) Identify the most frequent operations of the encryption / decryption algorithm and determine the function of the extended instructions; 2) Determine the data path and bit width of the extended instructions; 3) Determine the format and binary encoding of extended instructions based on the instruction format and instruction set encoding space of the RISC-V instruction set; In step 1), the extended instructions are: load instruction l256, store instruction s256, modulo addition instruction modadd, modulo subtraction instruction modsub, and Montgomery modular multiplication instruction modmul; In step 2), the data path for the extended instructions includes a dedicated bus, extended registers, dedicated memory, and dedicated computing unit, with a bit width of 256 bits; The dedicated bus is used for data reading or storage between the extended register and the dedicated memory, and between the extended register and the dedicated computing unit; The extended registers include four 256-bit registers; The dedicated computing component is used to perform modular addition, modular subtraction, and modular multiplication operations; In step 3), the specific format of the extended instruction is as follows: l256 spr, offset(rs) s256 spr, offset(rs) modadd spr_d, spr_1, spr_2, spr_3 modsub spr_d, spr_1, spr_2, spr_3 modmul spr_d, spr_1, spr_2, spr_3 In the above instructions, spr and spr_x represent extended registers, and rs represent existing general-purpose registers in RISC-V. The extended load instruction l256 spr, offset(rs) reads 256 bits of data from the address (rs) + offset and loads it into the spr register. This is used by RISC-V processors to read 256 bits of data from a specified memory address and store it in an extended register. The extended memory instruction s256 spr, offset(rs) stores 256 bits of data from the spr register into the memory address (rs) + offset. This is used by RISC-V processors to store extended register data at a specified memory address. The extended modulo addition instructions modadd spr_d, spr_1, spr_2, spr_3 are used to implement spr_d = ( spr_1 + spr_2) mod spr_3. That is, the source data is taken from the extended registers spr_1 and spr_2, the modulus is taken from spr_3, the addition and modulo are performed, and the result is written back to spr_d. The extended modulo subtraction instructions modsub spr_d, spr_1, spr_2, spr_3 are used to implement spr_d = ( spr_1 - spr_2) mod spr_3. That is, the source data is taken from the extended registers spr_1 and spr_2, the modulus is taken from spr_3, the subtraction and modulo are performed, and the result is written back to spr_d. The extended Montgomery modular multiplication instruction modmul spr_d, spr_1, spr_2, spr_3 has the effect of realizing spr_d = (spr_1 * spr_2 * 2 -256 ) mod spr_3, that is, source data is taken out from the extended registers spr_1 and spr_2, modulus is taken out from spr_3, multiplication and modulus operation are performed, and the result is written back into spr_d. In step 3), the specific encoding of the extended instruction is as follows: The l256 uses the Type I instruction format of the RISC-V instruction set, specifically encoded as follows: Among them, imm, rs, and spr are used to encode offset, general-purpose registers, and extended registers, respectively; The s256 uses the S-type instruction format in the RISC-V instruction set, specifically encoded as follows: Among them, imm, rs, and spr are used to encode offset, general-purpose registers, and extended registers, respectively; modadd, modsub, and modmul use a custom instruction set format, specifically encoded as follows: Among them, spr_x is used to expand the register.

2. A system based on the RISC-V instruction set extension method for information security application oriented according to claim 1, characterized in that, Includes the following modules: Extended instruction function determination module: Identifies the most frequent operations of the encryption / decryption algorithm and determines the function of the extended instructions; Data path and bit width determination module: determines the data path and bit width of extended instructions; Format and binary encoding determination module: Determines the format and binary encoding of extended instructions based on the instruction format and instruction set encoding space of the RISC-V instruction set.

Citation Information

Patent Citations

  • RISC-V instruction set extension method for accelerating digital signal processing

    CN112256330A