Key configuration method and device, instruction processing method and device and related equipment

By setting up a working key area in the processor and loading the application key by the security processor, the problem of key leakage in cryptographic instruction set operations is solved, and higher data security and key protection are achieved.

CN120675704APending Publication Date: 2025-09-19HYGON YUNXIN INTEGRATED CIRCUIT DESIGN (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510735011.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In the prior art, when cryptographic instruction sets are used to perform cryptographic operations, there is a risk of application key leakage, resulting in insufficient data security.

Method used

By setting a working key area as a private space in the processor to store application keys, and having the application keys loaded by the security processor, the cryptographic instruction set only obtains the application keys through key address information for calculation, avoiding the input of plaintext keys.

Benefits of technology

It improves the security of application keys, reduces the risk of key leakage, and enhances data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675704A_ABST
    Figure CN120675704A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a key configuration method, an instruction processing method, an instruction processing device and related equipment, input of a password instruction set comprises data to be operated and key address information, the key address information is used for indicating the position of an application key in a working key area, and the working key area is used for operating the application key. The working key area is a private space which is provided by a processor and is used for storing a plurality of application keys, the application keys are loaded to the working key area based on a security processor, and the instruction processing method of the password instruction set comprises the following steps: obtaining the application keys corresponding to the key address information in the working key area; and based on the application key, performing cryptographic operation on the to-be-operated data to obtain a cryptographic operation result corresponding to the to-be-operated data. According to the scheme provided by the embodiment of the invention, the risk that the application key is leaked is reduced, and the security of the key is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of data security, and specifically to a key configuration method, an instruction processing method, an apparatus, and related equipment. Background Art

[0002] The cryptographic instruction set is an instruction group inside the CPU used to perform cryptographic operations. It is essentially a stateless function that takes the application key and the data address information of the data to be operated as instruction input, calculates the operation result corresponding to the data to be operated (such as the encryption result of an encryption operation or the decryption result of a decryption operation), and outputs the operation result.

[0003] However, there is a risk of key leakage when using cryptographic instruction sets to perform cryptographic operations. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a key configuration method, an instruction processing method, an apparatus, and related devices, for reducing the risk of application key leakage and improving key security.

[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention provides a key configuration method, applied to a security processor, comprising:

[0007] Obtain a key loading request, where the key loading request is used to request loading an application key into a working key area;

[0008] Loading the application key into the working key area, where the working key area is a private space provided by the processor for storing multiple application keys;

[0009] Return the key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs cryptographic operations on the data to be operated input to the cryptographic instruction set to obtain cryptographic operation results corresponding to the data to be operated.

[0010] Optionally, after loading the application key into the working key area and before returning the key address information of the application key, the method further includes: loading authorization information corresponding to the application key;

[0011] The returning the key address information of the application key specifically includes returning the key address information of the application key and the authorization information.

[0012] Optionally, after returning the key address information of the application key, the method further includes:

[0013] Obtain a key uninstallation request, where the key uninstallation request is used to request uninstallation of an application key in a working key area;

[0014] Uninstalling the application key for the working key area;

[0015] Return the uninstallation result information to the password application.

[0016] Optionally, the key uninstallation request carries identification information or key address information of the application key, and uninstalling the application key from the working key area includes:

[0017] When the key address information is carried in the key uninstallation request, the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared;

[0018] When the key uninstallation request carries identification information, key address information corresponding to the application key is determined based on the identification information; the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared.

[0019] Optionally, authorization information is stored in the key slot corresponding to the application key, and uninstalling the application key from the working key area specifically includes: clearing the application key and the authorization information in the key slot.

[0020] In a second aspect, an embodiment of the present invention further provides a key configuration method, applied to an application processor, comprising:

[0021] Sending a key loading request, the key loading request being used to request loading an application key into a working key area, the working key area being a private space provided by the processor for storing multiple application keys; causing the security processor to load the application key into the working key area and return key address information of the application key;

[0022] Obtain key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs cryptographic operations on the data to be operated input into the cryptographic instruction set to obtain cryptographic operation results corresponding to the data to be operated.

[0023] Optionally, in the step of returning the key address information of the application key, the security processor also returns the authorization information of the application key;

[0024] In the step of obtaining the key address information of the application key returned by the security processor, the authorization information is obtained at the same time.

[0025] Optionally, after obtaining the key address information of the application key, the method further includes:

[0026] Sending a key uninstallation request, wherein the key uninstallation request is used to request uninstallation of an application key in the working key area; so that the security processor uninstalls the application key for the working key area and returns the uninstallation result information to the cryptographic application;

[0027] Obtain the uninstallation result information.

[0028] In a third aspect, an embodiment of the present invention further provides an instruction processing method for a cryptographic instruction set, wherein the input of the cryptographic instruction set includes data to be operated and key address information, wherein the key address information is used to indicate the location of an application key in a working key area, the working key area being a private space provided by a processor for storing multiple application keys, and the application key is loaded into the working key area based on a security processor, and the instruction processing method of the cryptographic instruction set includes:

[0029] Acquire an application key corresponding to the key address information in the working key area;

[0030] Based on the application key, a cryptographic operation is performed on the data to be operated to obtain a cryptographic operation result corresponding to the data to be operated.

[0031] Optionally, the acquiring the application key corresponding to the key address information in the working key area specifically includes acquiring the application key and authorization information corresponding to the key address information in the working key area;

[0032] After acquiring the application key corresponding to the key address information in the working key area and before performing the cryptographic operation on the data to be operated based on the application key, the method further includes:

[0033] Determining whether the cryptographic instruction set is authorized based on the obtained authorization information;

[0034] If so, execute the step of performing a cryptographic operation on the data to be operated based on the application key.

[0035] In a fourth aspect, an embodiment of the present invention further provides a key configuration device, applied to a security processor, the device comprising:

[0036] A request obtaining unit, configured to request a key loading request, wherein the key loading request is used to request loading an application key into a working key area;

[0037] a loading unit, configured to load the application key into the working key area, wherein the working key area is a private space provided by the processor for storing multiple application keys;

[0038] An information return unit is used to return the key address information of the application key; the key address information is used to indicate the location of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input to the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

[0039] In a fifth aspect, an embodiment of the present invention further provides a key configuration device, applied to an application processor, the device comprising:

[0040] a request sending unit, configured to send a key loading request, the key loading request being used to request loading an application key into a working key area, the working key area being a private space provided by the processor for storing multiple application keys, so that the security processor loads the application key into the working key area and returns key address information of the application key;

[0041] An information acquisition unit is used to obtain key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input into the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

[0042] In a sixth aspect, an embodiment of the present invention further provides a processor, comprising: a security processor, an application processor, and a working key area;

[0043] The security processor is configured to store at least one application key and perform key management on the application key; the key management performed by the security processor on the application key includes the key configuration method described in the first aspect, and executes loading of the application key;

[0044] The application processor is configured to execute a cryptographic instruction set called by a cryptographic application; the cryptographic instruction set called by the cryptographic application is configured to execute the instruction processing method for the cryptographic instruction set described in the third aspect; wherein the application processor performs loading of the application key based on the key configuration method described in the second aspect;

[0045] The working key area is used to load the application key.

[0046] Optionally, the security processor includes a secure storage space and a key management module; the secure storage space is used to store application keys; the password management module is used to perform key management on application keys; and the key management module is configured with a command interface for key loading requests.

[0047] Optionally, the working key area includes a plurality of key slots, and the key slots are used to load application keys, wherein one key slot corresponds to one key address information;

[0048] The key slot is configured with an authorization information area for storing authorization information corresponding to the application key stored in the key slot.

[0049] In a seventh aspect, an embodiment of the present invention further provides a chip comprising the processor as described in the sixth aspect.

[0050] In an eighth aspect, an embodiment of the present invention further provides an electronic device comprising the chip as described in the seventh aspect.

[0051] An embodiment of the present invention provides a key configuration method, an instruction processing method, an apparatus and related equipment, wherein the input of the cryptographic instruction set includes data to be operated and key address information, wherein the key address information is used to indicate the position of an application key in a working key area, the working key area is a private space provided by a processor for storing multiple application keys, and the application key is loaded into the working key area based on a security processor, and the instruction processing method of the cryptographic instruction set includes: obtaining an application key corresponding to the key address information in the working key area; based on the application key, performing a cryptographic operation on the data to be operated, and obtaining a cryptographic operation result corresponding to the data to be operated.

[0052] It can be understood that the application key in the embodiment of the present invention is stored in the working key area of ​​the private space provided by the processor, and the application key of the working key area is loaded based on the security processor, thereby ensuring the configuration security of the application key; and the cryptographic instruction set obtains the corresponding application key in the working key area based on the input key address information, so that the input of the cryptographic instruction set does not need to include the plaintext of the application key, reducing the risk of the application key being leaked and improving the security of the key. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0054] Figure 1An example diagram for implementing cryptographic operations within a processor;

[0055] Figure 2 A schematic diagram of an optional architecture of a computing device provided in an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of an optional structure of a working key area provided in an embodiment of the present invention;

[0057] Figure 4 An example diagram of the format of a cryptographic instruction set provided in an embodiment of the present invention;

[0058] Figure 5 A schematic diagram of an optional flow chart of a key configuration method provided in an embodiment of the present invention;

[0059] Figure 6 A schematic diagram of another optional flow chart of the key configuration method provided in an embodiment of the present invention;

[0060] Figure 7 A schematic diagram of another optional flow chart of the key configuration method provided in an embodiment of the present invention;

[0061] Figure 8 A schematic diagram of an optional flow chart of an instruction processing method for a cryptographic instruction set provided in an embodiment of the present invention;

[0062] Figure 9 A schematic diagram of another optional flow chart of the instruction processing method of the cryptographic instruction set provided in an embodiment of the present invention;

[0063] Figure 10 An optional example diagram of an instruction processing method for a cryptographic instruction set provided by an embodiment of the present invention;

[0064] Figure 11 An optional block diagram of a key configuration device provided by an embodiment of the present invention;

[0065] Figure 12 Another optional block diagram of the key configuration device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0066] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0067] As described in the background art, using cryptographic instruction sets to perform cryptographic operations poses security risks.

[0068] Specifically, cryptographic operations can be performed based on a cryptographic application. A cryptographic application can be an application run by a processor that requires cryptographic operations. In other words, the application's data requires cryptographic operations for encryption and decryption. The key used to perform cryptographic operations on the application's data is called an application key. The application key can have a one-to-one correspondence with the cryptographic application or with an account registered with the cryptographic application.

[0069] The inventor believes that when the cryptographic instruction set performs cryptographic operations based on the application key and the data to be operated, the plain text of the application key needs to be used as input, which makes the application key at risk of being leaked, so that the data encrypted using the application key may be illegally cracked, resulting in data leakage. Therefore, it is necessary to provide a key protection scheme to protect the security of the key.

[0070] In some optional examples, the application key can be encrypted and used as key ciphertext to encrypt the data to be calculated, so that the corresponding calculation process does not contact the plaintext of the application key, thereby avoiding corresponding security risks.

[0071] refer to Figure 1 An example diagram illustrating implementation of cryptographic operations within a processor is shown. A processor, such as a CPU (Central Processing Unit) or a GPU (Graphics Processing Unit), serves as a computational execution device within a computer system, primarily used to interpret and execute computer program instructions. The processor may include one or more processor cores 10, which are execution units within the processor capable of independently executing computational tasks. Examples of processor cores include CPU cores and GPU cores. When multiple processor cores are configured, they can simultaneously execute multiple processes or threads, thereby enhancing the processor's computing power through multitasking.

[0072] In this example, the processor runs a cryptographic application, and the processor core in the processor can encrypt and protect the application key, and use the encrypted application key to perform cryptographic operations on data of the cryptographic application.

[0073] An IWKey (Instruction Writable Key) register 11 is provided inside the processor core 10. The IWKey register is used to store a security root for encrypting an application key, and the permission of the IWKey register is configured to allow writing but prohibit reading.

[0074] During the cryptographic operation process, the user can set the security root to the IWKey register through an instruction and use this security root to encrypt the application key, thereby generating a key ciphertext (for example, a handle). During the processing of the cryptographic instruction set, the key ciphertext and the data to be operated on are required as input. The security root stored in the IWKey register is used to decrypt the key ciphertext to obtain the application key, and the cryptographic operation to be performed on the data to be operated on is further performed based on the application key.

[0075] However, before running this cryptographic instruction set, the user needs to configure the IWKey register and further encrypt the application key based on the security root to generate the key ciphertext. However, this configuration and generation process may also lead to the risk of application key leakage.

[0076] In view of this, an embodiment of the present invention provides a key configuration method, an instruction processing method, an apparatus and related equipment, wherein the input of the cryptographic instruction set includes data to be operated and key address information, wherein the key address information is used to indicate the position of the application key in the working key area, the working key area is a private space provided by the processor for storing multiple application keys, and the application key is loaded into the working key area based on the security processor, and the instruction processing method of the cryptographic instruction set includes: obtaining the application key corresponding to the key address information in the working key area; based on the application key, performing cryptographic operations on the data to be operated, and obtaining cryptographic operations results corresponding to the data to be operated.

[0077] It can be understood that the application key in the embodiment of the present invention is stored in the working key area of ​​the private space provided by the processor, and the application key of the working key area is loaded based on the security processor, thereby ensuring the configuration security of the application key; and the cryptographic instruction set obtains the corresponding application key in the working key area based on the input key address information, so that the input of the cryptographic instruction set does not need to include the plaintext of the application key, reducing the risk of the application key being leaked and improving the security of the key.

[0078] The key configuration scheme and instruction processing scheme provided by the embodiments of the present invention are described in detail below.

[0079] refer to Figure 2 1 is a schematic diagram of an optional architecture of a computing device, wherein the computing device includes a processor, wherein the processor is configured with a working key area WKA (Working Key Area) 210, a security processor SP (Secure Processor) 220 and an application processor AP (Application Processor) 230.

[0080] The working key area 210 is a private space provided by the processor for storing multiple application keys. The working key area can be located in a private space within the processor chip. This private space is visible only within the chip and not from outside. In other words, this private space is accessible only to the application processor and the security processor. Programs running on the application processor (including cryptographic applications) are prohibited from accessing it, ensuring the security of the application keys stored in the working key area.

[0081] In a specific implementation, the working key area can be a key register group, so that the key is stored based on the key register group. In an optional example, refer to Figure 3 The following is a schematic diagram of an optional structure of a working key area. The working key area may include multiple key slots KS (N as an example in the figure), which are used to load application keys. The number of key slots may be a preset number N, which may be multiple (i.e., greater than or equal to 2). Accordingly, the capacity of the working key area is equal to the preset number N.

[0082] In an optional example, the key slot is also configured with an authorization information area, which can be used to store authorization information corresponding to the application key stored in the key slot, for example, an authorization code (AuthCode), so that before the cryptographic instruction set obtains the application key in the key slot, it first verifies the authorization information based on the authorization information to be verified input by the cryptographic instruction set to determine whether the cryptographic instruction set is authorized to use the application key in the key slot. When the verification is passed, the cryptographic instruction set is allowed to obtain the application key.

[0083] It should be noted that the key slot has an idle state and a non-idle state. A key slot in an idle state indicates that no application key is stored in the key slot and that the application key is allowed to be loaded. A key slot in a non-idle state indicates that an application key is stored in the key slot and that the application key is prohibited from being loaded. In an optional example, the state of the key slot can be confirmed based on an inspection or based on a state identifier. For example, by checking the data in the key slot, it is determined whether it is in an idle state (the idle state, for example, the data in the key slot can be all "0" or all "1"), or a state identifier bit (not shown in the figure) is further configured for the key slot, and based on the state identifier in the state identifier bit, it is indicated that the key slot is in an idle state or a non-idle state. Then, when loading the application key, the application key can be loaded into the idle key slot based on the corresponding state identifier.

[0084] The key slot in the working key area is configured with key address information. This key address information is used to indicate the location of the key slot in the working key area. Accordingly, when an application key is stored in the key slot, the key address information is used to indicate the location of the application key in the working key area. It is understood that there is a one-to-one correspondence between the key slot and the key address information. In a specific example, the key address information can be, for example, the index of the application key in the working key area, or the label of the application key in the working key area, such as the ID of the application key in the working key area, or the slot information where the application key is located.

[0085] Continue to refer Figure 2 The security processor 220 is a trusted device specifically designed to handle security-related operations. It has a complete closed operating environment, which prohibits the hardware resources within it from being accessed by the host system or the virtual system running on the host system. Corresponding data interaction can be implemented based on the interface configured in the processor to communicate with the security processor. Specifically, the security processor can store at least one application key and perform key management (Key Management) on the application key, such as key import, export, generation, loading, unloading, and destruction. When corresponding processing needs to be performed, the security processor 220 can provide a corresponding command interface, so that the processor can implement the corresponding function based on the call of the corresponding command interface.

[0086] Specifically, key import is used to import the key into the security processor, where the key can be plain text or encrypted ciphertext; key export is used to export the key in the security processor after encryption; key generation is used to generate the key randomly or using specific parameters / specific algorithms; key destruction is used to destroy the specified key; key loading is used to load the specified application key into the working key area; key unloading is used to clear the specified application key in the working key area.

[0087] In an optional implementation, combined with Figure 2 As shown, the security processor 220 may be provided with a key management module 221 and a secure storage space 222. The key management module 221 may be a module component within the security processor that implements key management functions, such as a logic circuit component within the security processor that implements key management functions. The secure storage space 222 may be a storage space within the security processor for storing application keys. For example, the secure storage space may be embedded within the security processor and provide physical and logical protection measures to prevent unauthorized access to application keys stored within the secure storage space.

[0088] The application processor 230 is the processor's computing core, responsible for executing user programs and performing various data operations. Corresponding to the cryptographic application program used to perform cryptographic operations, the application processor is equipped with a cryptographic instruction set (CIS) to perform encryption and decryption operations on the data being processed. Accordingly, the cryptographic application program can call the cryptographic instruction set, allowing the application processor to use it to perform the corresponding encryption and decryption tasks.

[0089] In an optional implementation, the cryptographic instruction set may include cryptographic operation instructions of one or more cryptographic algorithms, such as encryption operation instructions of the SM4 algorithm, decryption operation instructions of the SM4 algorithm, etc. It should be noted that a cryptographic algorithm is an algorithm that implements cryptographic operations (i.e., an algorithm that implements data encryption and decryption). The type of cryptographic algorithm can be determined according to actual settings and is not limited to the SM4 algorithm. For example, embodiments of the present invention support any cryptographic algorithm that can implement cryptographic operations, such as symmetric encryption algorithms, asymmetric encryption algorithms, and homomorphic encryption algorithms. Taking symmetric encryption algorithms as an example, embodiments of the present invention can adopt cryptographic algorithms such as AES (Advanced Encryption Standard), 3DES (Triple Data Encryption Standard), and SM4. Taking asymmetric encryption algorithms as an example, embodiments of the present invention can adopt cryptographic algorithms such as RSA (Rivest Shamir Adleman) and ECC (Elliptic Curve Cryptography).

[0090] In an optional implementation, the application processor can execute the cryptographic operation process corresponding to the cryptographic operation instruction based on the input data of the cryptographic operation instruction and use the application key for performing cryptographic operations on the input data, thereby realizing the cryptographic operation; wherein the cryptographic operation can be an encryption operation or a decryption operation, depending on the current requirements of the cryptographic operation.

[0091] In an embodiment of the present invention, the input of the cryptographic instruction set may include data to be operated and key address information, so that the corresponding cryptographic operation can be performed based on the application key indicated by the key address information. In a specific example, the cryptographic application program may call the cryptographic instruction set and provide the cryptographic instruction set with corresponding input information as the input of the cryptographic instruction set.

[0092] In an optional implementation, the input of the cryptographic instruction set may further include authorization information to be verified. When authorization information is configured in the corresponding working key area, the cryptographic instruction set may confirm the authorization information based on the input authorization information to be verified before obtaining the application key. If the input authorization information to be verified indicates that the cryptographic instruction set is authorized to execute the instruction, the corresponding cryptographic operation may be performed based on the application key.

[0093] In a specific example, taking the cryptographic instruction set for the SM4 cryptographic algorithm as an example, Figure 4 The following is an example diagram showing the format of the cryptographic instruction set provided by the embodiment of the present invention, as shown in FIG. Figure 4 As shown, the format of the cryptographic instruction set may include an instruction name, a first operand, a second operand, a third operand, and a fourth operand.

[0094] The instruction name indicates the instruction name of the cryptographic operation instruction used to perform the cryptographic operation, such as the instruction name of the SM4 encryption operation instruction (SM4 ENC), the SM4 decryption operation instruction, and the like.

[0095] The first operand may be a destination operand (Destination Operand, DST). The destination operand corresponds to a cryptographic operation result after the cryptographic instruction set performs a cryptographic operation, such as an encryption result after encryption or a decryption result after decryption. Optionally, the destination operand may indicate result address information of the cryptographic operation result, which may be, for example, an index address; for example, the cryptographic operation result may be stored in a storage space of a computer system, and thus the destination operand may indicate an index address of the storage space storing the cryptographic operation result, such as a memory address of a memory storing the cryptographic operation result or a register index of a register storing the cryptographic operation result.

[0096] The second operand is a source operand (SRC) in the cryptographic instruction set, corresponding to the data to be operated on. Optionally, the second operand can indicate data address information of the data to be operated on, such as an index address. For example, the data to be operated on can be stored in a computer system's memory space, and the second operand can indicate the index address of the memory space storing the data to be operated on, such as the memory address of a memory storing the data to be operated on, or the register index of a register storing the data to be operated on. Thus, the application processor can obtain the data to be operated on based on the second operand.

[0097] The third operand is another source operand in the cryptographic instruction set, which can correspond to the key address information or be the key address information directly. For example, the key address information is returned based on loading by the security processor and can be stored in the storage space within the computer system or returned by the processor to the cryptographic application. When the key address information is stored in the storage space within the computer system, the third operand can be an index address indicating the key address information, wherein the index address of the key address information is used to index the storage space saved after obtaining the key address information. That is, the third operand can indicate the index address of the storage space storing the key address information, such as the memory address of the memory storing the key address information, or the register index of the register storing the key address information. When the key address information is returned by the processor to the cryptographic application, the third operand can be directly input as the key address information based on the call of the cryptographic application. Accordingly, the application processor can obtain the key address information based on the third operand.

[0098] The fourth operand is another source operand in the cryptographic instruction set, corresponding to the authorization information to be verified. The authorization information to be verified is the authorization information fed back after the self-security processor loads the application key and authorization information; for example, the authorization information to be verified can be stored in the storage space inside the computer system, so that the fourth operand can indicate the index address of the authorization information to be verified, wherein the index address of the authorization information to be verified is used to index the storage space saved after obtaining the authorization information to be verified. That is, the fourth operand can indicate the index address of the storage space where the authorization information to be verified is stored, such as the memory address of the memory where the authorization information to be verified is stored, or the register index of the register where the authorization information to be verified is stored. Thus, the application processor can obtain the authorization information to be verified based on the fourth operand.

[0099] In combination with the foregoing, it can be understood that in the embodiments of the present invention, using authorization information as input can further enhance the security of the instruction processing flow.

[0100] It should be further explained that, in the embodiment of the present invention, the security of the instruction processing flow can also be improved based on the key address information as input. Specifically, based on the working key area being used to store multiple application keys, the corresponding key address information is multiple, so that the key address information corresponds to the application key one-to-one. Accordingly, in the process of executing instructions in the cryptographic instruction set, under the premise that the key address information is multiple, the key address information can also have a certain degree of unpredictability, so that it can be used as part of the confidential information in the instruction processing flow and participate in the implementation of the data confidentiality function. Among them, based on the principle that the greater the amount of confidential information, the stronger the confidentiality, the key address information with a certain degree of unpredictability in the working key area as part of the confidential information can improve the security of the instruction processing flow.

[0101] In a further example, the key address information and the authorization information (corresponding to the cryptographic application side, that is, the authorization information to be verified) can be configured with different management policies. For example, for the same user, multiple application keys can be included, which correspond to multiple key address information, but the same authorization information can be configured, that is, multiple application keys share authorization information.

[0102] At the same time, on the cryptographic application side, the key address information and the authorization information to be verified can be obtained based on different acquisition strategies, thereby further improving the security of relevant information. For example, in a specific example, the key address information can be obtained from the information returned from the security processor after loading based on the key loading request issued by the cryptographic application; and the authorization information can be stored outside the computing device. For example, after the security processor configures the corresponding authorization information, it is returned to the cryptographic application, and the user using the cryptographic application forwards or records the authorization information to an external device.

[0103] Based on the optional architecture of the above computing device, the embodiment of the present invention further provides a key configuration method, which can be applied to the computing device of the above architecture, and can also be applied to other computing devices of other architectures that can implement the method. Figure 5 The following is an optional flow chart of a key configuration method provided by an embodiment of the present invention, wherein the method comprises the following steps:

[0104] Step S100: The cryptographic application sends a key loading request to the security processor; wherein the key loading request is used to request loading an application key into the working key area.

[0105] In an optional implementation, based on a command interface provided by the security processor, a cryptographic application running on the processor may, when a need arises to load an application key, send a key loading request to the security processor via a command interface (e.g., a loading interface) provided by the security processor for loading application keys, thereby requesting the security processor to load the application key. Accordingly, the security processor may receive the key loading request.

[0106] In an optional implementation, based on the situation where the security processor stores multiple application keys, the cryptographic application can specify the application key to be loaded when requesting the security processor to load the application key, thereby requiring the cryptographic application to identify the application key to be loaded. In this embodiment of the present invention, the key loading request can carry identification information of the application key to instruct the security processor to load the application key corresponding to the identification information into the working key area.

[0107] The identification information of the application key is used to indicate the unique identification of the application key, and the identification information corresponds to the application key in a one-to-one manner. In an optional example, the identification information may be, for example, address information of the application key in the security processor.

[0108] It should be noted that in other possible implementations, the cryptographic application may not specify the application key to be exported. For example, the security processor may randomly select the application key to be exported, or select the application key to be exported according to the order of multiple stored application keys.

[0109] In an optional implementation, the cryptographic application may be specifically run on an application processor within the processor, so that step S100 may be performed by the application processor running the cryptographic application.

[0110] It should be noted that at least one application key is configured in the security processor. In an optional example, the security processor can pre-import or generate a corresponding application key to provide a basis for loading the application key.

[0111] Step S110: The security processor loads the application key into the working key area;

[0112] It is understandable that the working key area is a private space provided by the processor for storing multiple application keys. By loading the application key into the working key area, the cryptographic instruction set obtains the application key from the working key area.

[0113] The working key area may include multiple key slots, and in this step, the application key may be loaded into a key slot. If the key slot is configured with a status flag, the application key may be loaded into a key slot whose status flag indicates an idle state based on the status flag of the key slot.

[0114] In an optional example, verification can also be performed based on authorization information to improve the security of the cryptographic instruction set processing flow. Figure 6 Another optional flow diagram of the key configuration method provided by an embodiment of the present invention is shown. After step S110, the following steps may be further included:

[0115] Step S112: The security processor loads the corresponding authorization information for the application key;

[0116] The authorization information is used to confirm whether the key instruction set is authorized. In a specific example, the key slot is also configured with an authorization information area. After executing step S100, this step can further load the authorization information into the authorization information area corresponding to the key slot. That is, the authorization information is loaded into the authorization information area corresponding to the key slot where the application key is located.

[0117] Continue to refer Figure 5 , executing step S120: the security processor returns the key address information of the application key to the cryptographic application;

[0118] Among them, the key address information is used to indicate the location of the application key in the working key area; so that the cryptographic instruction set can execute the instruction processing method based on the input data to be operated and the key address information, that is, obtain the application key corresponding to the key address information in the working key area, and perform cryptographic operations on the data to be operated based on the application key of the data to be operated.

[0119] In an optional implementation, the cryptographic application may be specifically run on an application processor within the processor, so that in step S120 , the application processor may obtain the key address information of the application key.

[0120] It should be noted that the reference Figure 6 If authorization information exists, this step also returns the authorization information. Accordingly, the cryptographic application can be specifically run on an application processor within the processor, so that in step S120, the application processor can obtain the key address information of the application key and the authorization information.

[0121] The return mentioned in this step refers to returning corresponding information to the cryptographic application. Since the cryptographic application runs on the application processor, the return can also be understood as returning to the application processor.

[0122] In a further optional implementation, the embodiment of the present invention can further uninstall the application key when the application key is no longer needed (for example, when the password application is closed, or when the account corresponding to the application key is logged out or logged out). Figure 7 Another optional flow chart of the key configuration method provided by an embodiment of the present invention is shown, wherein the method further includes the following steps:

[0123] Step S130: The cryptographic application sends a key uninstallation request to the security processor; wherein the key uninstallation request is used to request uninstallation of the application key in the working key area.

[0124] In an optional implementation, based on a command interface provided by the security processor, a cryptographic application running on the processor may, when it has a need to uninstall an application key, send a key uninstall request to the security processor via a command interface for uninstalling the application key (e.g., an uninstall interface) provided by the security processor, requesting the security processor to uninstall the application key. Accordingly, the security processor may receive the key uninstall request.

[0125] In an optional implementation, based on the situation where the security processor stores multiple application keys, the cryptographic application can specify the application key to be uninstalled when requesting the security processor to uninstall the application key, thereby requiring the cryptographic application to identify the application key to be uninstalled. In this embodiment of the present invention, the key uninstall request can carry identification information or key address information of the application key (i.e., the location of the application key in the working key area) to instruct the security processor to uninstall the application key corresponding to the identification information or key address information from the working key area.

[0126] In an optional implementation, the cryptographic application may be specifically run on an application processor within the processor, so that step S130 may be performed by the application processor running the cryptographic application.

[0127] Step S140: The security processor unloads the application key from the working key area;

[0128] When the key uninstallation request carries key address information, the position of the application key in the working key area can be determined based on the key address information, thereby clearing the application key from the key slot corresponding to the position. Furthermore, when the key uninstallation request carries identification information, the key address information corresponding to the application key can be determined based on the identification information, and the position of the application key in the working key area can be further determined based on the key address information, thereby clearing the application key from the key slot corresponding to the position.

[0129] In an optional example, when authorization information is still stored in the key slot corresponding to the application key, this step simultaneously clears the authorization information.

[0130] Wherein, when the key slot is configured with a state flag, the state flag of the key slot may be indicated as an idle state after the application key is cleared.

[0131] Step S150: The security processor returns the uninstallation result information to the cryptographic application;

[0132] It is understandable that the uninstallation result information is returned to notify the key application of the corresponding uninstallation result.

[0133] Accordingly, the cryptographic application program may be specifically run on an application processor within the processor, so that the application processor may obtain the uninstallation result information in step S150.

[0134] Based on the optional architecture of the above-mentioned computing device, an embodiment of the present invention further provides an instruction processing method for a cryptographic instruction set, which can be applied to a computing device of the above-mentioned architecture, specifically, to an application processor of the computing device. The cryptographic application program can call the cryptographic instruction set of the application processor and provide input information corresponding to the cryptographic instruction set when calling the cryptographic instruction set. In the embodiment of the present invention, the input of the cryptographic instruction set includes data to be operated and key address information. Figure 8 An optional flow chart of a method for processing instructions of a cryptographic instruction set provided by an embodiment of the present invention is shown, wherein the method comprises the following steps:

[0135] Step S200: Acquire the application key corresponding to the key address information in the working key area;

[0136] When the key address information is included in the input of the cryptographic instruction set, the application key can be obtained from the working key area to perform subsequent data encryption operations based on the application key.

[0137] Step S210: performing cryptographic operations on the data to be operated based on the application key;

[0138] It is understood that after obtaining the application key, the application key can be used to perform a cryptographic operation on the data to be operated to obtain a cryptographic operation result. In an optional implementation, the cryptographic operation result serves as the destination operand of the cryptographic operation instruction and can be stored in the storage space corresponding to the index address of the destination operand (such as memory or register, etc.).

[0139] In an optional implementation, the cryptographic operation can be an encryption operation, whereby the application key can be used to perform an encryption operation on the data to be operated (plaintext data) to obtain an encrypted result. Furthermore, if a decryption operation is subsequently required on the encrypted result, the application key used in the decryption operation should be consistent with the application key used in the encryption operation, so that the application keys used in the corresponding encryption and decryption operations are consistent, thereby ensuring the correctness of encryption and decryption.

[0140] In an optional implementation, the cryptographic operation can be a decryption operation, so that the application key can be used to perform a decryption operation on the data to be operated (ciphertext data) to obtain a decryption result (plaintext data corresponding to the data to be operated); at this time, the application key used for the decryption operation is consistent with the application key used for the encryption operation to encrypt the data to be operated (ciphertext data).

[0141] In an optional implementation, when authorization information is also stored in the key slot of the working key area, refer to Figure 9 Another optional flow chart of the instruction processing method of the cryptographic instruction set provided by an embodiment of the present invention is shown, in which step S200 further obtains authorization information corresponding to the key address information, that is, obtains the application key and authorization information corresponding to the key address information in the working key area.

[0142] Accordingly, after step S200 and before step S210, the following steps are further included:

[0143] Step S205: Based on the obtained authorization information, determine whether the cryptographic instruction set is authorized;

[0144] The input of the cryptographic instruction set also includes authorization information to be verified. After obtaining the authorization information, it can be further compared with the authorization information to be verified input by the cryptographic instruction set to determine whether the cryptographic instruction set is authorized. If the obtained authorization information is consistent with the authorization information to be verified, the cryptographic instruction set is authorized, that is, the cryptographic instruction set allows step S210 to be executed based on the obtained application key; if the obtained authorization information is inconsistent with the authorization information to be verified, the cryptographic instruction set is not authorized, that is, the cryptographic instruction set prohibits step S210 from being executed based on the obtained application key, and the instruction processing flow can be terminated.

[0145] In a specific example, refer to Figure 10 This diagram illustrates an optional example of an instruction processing method for a cryptographic instruction set provided by an embodiment of the present invention. The cryptographic instruction set includes operands: DST (destination operand), SRC (indicating data to be operated), AUTH (indicating authorization information to be verified), and KID (key address information). When executing cryptographic operations in the cryptographic instruction set, the application processor can retrieve the application key and authorization information from the working key area based on the key address information. The application processor then determines whether the cryptographic instruction set is authorized based on the authorization information to be verified and the authorization information. If verification is successful, the application key can be used to perform a cryptographic operation on the data to be operated. The result of the cryptographic operation is used as the destination operand and stored in the storage space corresponding to the destination operand.

[0146] In a further optional implementation, an embodiment of the present invention further provides a key configuration device for use in a security processor. In this optional implementation, the key configuration device can be considered a functional module unit optionally provided by a key management module within the security processor to implement the key configuration method provided in an embodiment of the present invention. The module unit described below can be referenced in conjunction with the method described above.

[0147] As an optional implementation, Figure 11An optional block diagram of a key configuration device provided by an embodiment of the present invention is shown as an example. Figure 11 As shown, the key configuration device may include:

[0148] The request obtaining unit 300 is used to obtain a key loading request, wherein the key loading request is used to request to load an application key into the working key area;

[0149] A loading unit 310 is configured to load the application key into the working key area, where the working key area is a private space provided by the processor for storing multiple application keys;

[0150] The information return unit 320 is used to return the key address information of the application key; the key address information is used to indicate the location of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input to the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

[0151] Optionally, the loading unit 310 is further used to:

[0152] Loading the application key with corresponding authorization information;

[0153] The returning the key address information of the application key specifically includes returning the key address information of the application key and the authorization information.

[0154] Optionally, the request obtaining unit 300 is further configured to: obtain a key uninstallation request, wherein the key uninstallation request is used to request uninstallation of an application key in the working key area;

[0155] The loading unit 310 is further configured to unload the application key from the working key area;

[0156] The information returning unit 320 is further configured to return the uninstallation result information to the password application.

[0157] Optionally, the key uninstallation request carries identification information or key address information of the application key. The loading unit 310 is configured to uninstall the application key from the working key area, including:

[0158] When the key address information is carried in the key uninstallation request, the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared;

[0159] When the key uninstallation request carries identification information, key address information corresponding to the application key is determined based on the identification information; the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared.

[0160] Optionally, authorization information is stored in the key slot corresponding to the application key, and the loading unit 310 is used to unload the application key from the working key area, specifically by clearing the application key and the authorization information in the key slot.

[0161] In a further optional implementation, an embodiment of the present invention further provides a key configuration device for use in an application processor. In this optional implementation, the key configuration device can be considered a functional module unit that the application processor optionally configures to implement the key configuration method provided in an embodiment of the present invention. The module unit contents described below can be referenced in conjunction with the method contents described above.

[0162] As an optional implementation, Figure 12 Another optional block diagram of the key configuration device provided by an embodiment of the present invention is shown as an example. Figure 12 As shown, the key configuration device may include:

[0163] A request sending unit 400 is configured to send a key loading request, wherein the key loading request is configured to request loading an application key into a working key area, where the working key area is a private space provided by the processor for storing multiple application keys, so that the security processor loads the application key into the working key area and returns key address information of the application key.

[0164] The information acquisition unit 410 is used to obtain key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input to the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

[0165] Optionally, in the step of returning the key address information of the application key, the security processor also returns the authorization information of the application key;

[0166] The information acquisition unit 410 is configured to simultaneously acquire the authorization information during the step of acquiring the key address information of the application key returned by the security processor.

[0167] Optionally, the request sending unit 400 is further configured to send a key uninstallation request, wherein the key uninstallation request is configured to request uninstallation of an application key in the working key area; so that the security processor uninstalls the application key for the working key area and returns the uninstallation result information to the cryptographic application;

[0168] The information acquiring unit 410 is further configured to acquire the uninstallation result information.

[0169] In a further optional implementation, an embodiment of the present invention further provides a processor. Optionally, the functions of the security processor, application processor, and working key area provided in the processor can refer to the description of the corresponding parts above.

[0170] In a further optional implementation, an embodiment of the present invention further provides a chip, including the processor provided by an embodiment of the present invention.

[0171] In a further optional implementation, an embodiment of the present invention further provides an electronic device (eg, a computer device such as a terminal device or a server device), comprising the chip provided by an embodiment of the present invention.

[0172] The above describes multiple embodiment schemes provided by the embodiments of the present invention. The various optional methods introduced in each embodiment scheme can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible embodiment schemes, which can all be considered as embodiment schemes disclosed and open in the embodiments of the present invention.

[0173] Although the embodiments of the present invention are disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention should be based on the scope defined by the claims.

Claims

1. A key configuration method, characterized in that: Applications in security processors, including: Obtain a key loading request, where the key loading request is used to request loading an application key into a working key area; Loading the application key into the working key area, where the working key area is a private space provided by the processor for storing multiple application keys; Return the key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs cryptographic operations on the data to be operated input to the cryptographic instruction set to obtain cryptographic operation results corresponding to the data to be operated.

2. The key configuration method according to claim 1, characterized in that: After the application key is loaded into the working key area and before the key address information of the application key is returned, the method further includes: loading authorization information corresponding to the application key; The returning the key address information of the application key specifically includes returning the key address information of the application key and the authorization information.

3. The key configuration method according to claim 1, wherein: After returning the key address information of the application key, the method further includes: Obtain a key uninstallation request, where the key uninstallation request is used to request uninstallation of an application key in a working key area; Uninstalling the application key for the working key area; Returns the uninstallation result information to the password application.

4. The key configuration method according to claim 3, characterized in that: The key uninstallation request carries identification information or key address information of the application key, and uninstalling the application key from the working key area includes: When the key address information is carried in the key uninstallation request, the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared; When the key uninstallation request carries identification information, key address information corresponding to the application key is determined based on the identification information; the position of the application key in the working key area is determined based on the key address information; and the application key in the key slot corresponding to the position is cleared.

5. The key configuration method according to claim 4, characterized in that: The key slot corresponding to the application key stores authorization information. Uninstalling the application key from the working key area specifically includes clearing the application key and the authorization information in the key slot.

6. A key configuration method, characterized in that: For application processors, including: Sending a key loading request, the key loading request being used to request loading an application key into a working key area, the working key area being a private space provided by the processor for storing multiple application keys; causing the security processor to load the application key into the working key area and return key address information of the application key; Obtain key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs cryptographic operations on the data to be operated input into the cryptographic instruction set to obtain cryptographic operation results corresponding to the data to be operated.

7. The key configuration method according to claim 6, characterized in that: In the step of returning the key address information of the application key, the security processor also returns the authorization information of the application key; In the step of obtaining the key address information of the application key returned by the security processor, the authorization information is obtained at the same time.

8. The key configuration method according to claim 6, characterized in that: After obtaining the key address information of the application key, the method further includes: Sending a key uninstallation request, wherein the key uninstallation request is used to request uninstallation of an application key in the working key area; so that the security processor uninstalls the application key for the working key area and returns uninstallation result information to the cryptographic application; Obtain the uninstallation result information.

9. A method for processing instructions of a cryptographic instruction set, characterized in that: The input of the cryptographic instruction set includes data to be operated and key address information, wherein the key address information is used to indicate the location of the application key in the working key area. The working key area is a private space provided by the processor for storing multiple application keys, and the application key is loaded into the working key area based on the security processor. The instruction processing method of the cryptographic instruction set includes: Acquire an application key corresponding to the key address information in the working key area; Based on the application key, a cryptographic operation is performed on the data to be operated to obtain a cryptographic operation result corresponding to the data to be operated.

10. The instruction processing method of the cryptographic instruction set according to claim 9, characterized in that: Acquiring the application key corresponding to the key address information in the working key area specifically involves acquiring the application key and authorization information corresponding to the key address information in the working key area; After acquiring the application key corresponding to the key address information in the working key area and before performing the cryptographic operation on the data to be operated based on the application key, the method further includes: Determining whether the cryptographic instruction set is authorized based on the obtained authorization information; If so, execute the step of performing a cryptographic operation on the data to be operated based on the application key.

11. A key configuration device, characterized in that: Applied to a security processor, the device comprises: a request obtaining unit, configured to obtain a key loading request, wherein the key loading request is used to request loading an application key into the working key area; a loading unit, configured to load the application key into the working key area, wherein the working key area is a private space provided by the processor for storing multiple application keys; An information return unit is used to return the key address information of the application key; the key address information is used to indicate the location of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input to the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

12. A key configuration device, characterized in that: Applied to an application processor, the device includes: a request sending unit, configured to send a key loading request, the key loading request being used to request loading an application key into a working key area, the working key area being a private space provided by the processor for storing multiple application keys, so that the security processor loads the application key into the working key area and returns key address information of the application key; An information acquisition unit is used to obtain key address information of the application key; the key address information is used to indicate the position of the application key in the working key area; so that the cryptographic instruction set obtains the application key corresponding to the data to be operated in the working key area based on the input key address information, and based on the application key, performs a cryptographic operation on the data to be operated input into the cryptographic instruction set to obtain a cryptographic operation result corresponding to the data to be operated.

13. A processor, characterized in that: include: Security processor, application processor, and working key area; The security processor is configured to store at least one application key and perform key management on the application key; the key management performed by the security processor on the application key includes the key configuration method according to any one of claims 1 to 5, and executes loading of the application key; The application processor is configured to execute a cryptographic instruction set called by a cryptographic application; the cryptographic instruction set called by the cryptographic application is configured to execute the instruction processing method of the cryptographic instruction set according to claim 9 or 10; wherein the application processor performs loading of the application key based on the key configuration method according to any one of claims 6 to 8; The working key area is used to load the application key.

14. The processor according to claim 13, wherein: The security processor includes a secure storage space and a key management module; the secure storage space is used to store application keys; the password management module is used to manage application keys; the key management module is configured with a command interface for key loading requests.

15. The processor according to claim 13, wherein: The working key area includes a plurality of key slots, each of which is used to load an application key, wherein one key slot corresponds to one key address information; The key slot is configured with an authorization information area for storing authorization information corresponding to the application key stored in the key slot.

16. A chip, characterized in that: Comprising a processor as claimed in any one of claims 13 to 15.

17. An electronic device, characterized in that: Comprising the chip as claimed in claim 16.