ECDH key agreement device and method suitable for security chip

By designing an ECDH key agreement device on a security chip and using the AMBA bus and modular architecture for key agreement, the problem of low efficiency caused by the need for CPU cooperation in the existing ECDH algorithm is solved, and efficient key agreement is achieved.

CN119728103BActive Publication Date: 2025-09-16GUANGZHOU XINYUNYUAN MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411853656.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-09-16
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

The existing ECDH algorithm requires CPU cooperation in security chips, resulting in low key negotiation efficiency.

Method used

An ECDH key agreement device suitable for security chips is used, including a key agreement top-level module, a random number generator, a register configuration module, a private key and public key generation module, an ECDH control module and a point multiplication top-level module. Communication and calculation are carried out through the AMBA bus, avoiding CPU assistance and performing key agreement directly on the security chip.

Benefits of technology

It greatly improves the efficiency of ECDH key negotiation, implements pure RTL hardening design, and avoids CPU usage bottlenecks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728103B_ABST
    Figure CN119728103B_ABST
Patent Text Reader

Abstract

The present invention relates to information security, and in particular to an ECDH key negotiation device and method applicable to a security chip, comprising a random number generator, externally connected to an AMBA bus, capable of generating random numbers according to a specific configuration and storing the generated random numbers in an embedded FIFO; a register configuration module, externally connected to the AMBA bus, completing register configuration and enabling / disabling of interrupt registers via the AMBA bus; a private key and public key generation module, which, after ECDH key negotiation is started, reads a random number from the random number generator, performs a private key detection on the read random number, and uses the random number that passes the private key detection as a local private key; and, after the local private key is generated, performs a point multiplication operation on a finite field on the local private key and a shared base point by calling a point multiplication top-level module, so as to generate a local public key. The technical solution provided by the present invention can overcome the defects of the prior art, such as the need for CPU cooperation and the low efficiency of ECDH key negotiation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to information security, and in particular to an ECDH key negotiation device and method applicable to a security chip. Background Art

[0002] The ECDH (Elliptic Curve Diffie-Hellman) algorithm uses the difficulty of solving the discrete logarithm problem on elliptic curves in a finite field to construct a key exchange, thereby making the generated shared key difficult to crack. Due to the complexity of the ECDH algorithm, traditional ECDH algorithms are often built based on CPU cores. Its advantage is flexibility and convenience, but its disadvantages are:

[0003] 1) Limited by the CPU processing speed, the efficiency of completing a key negotiation using the ECDH algorithm is low (often requiring millions of clock cycles);

[0004] 2) Using the ECDH algorithm to build key exchange requires CPU-based cooperation. Summary of the Invention

[0005] (1) Technical problems solved

[0006] In response to the above-mentioned shortcomings of the prior art, the present invention provides an ECDH key agreement device and method suitable for security chips, which can effectively overcome the defects of the prior art in requiring CPU cooperation and the low efficiency of ECDH key agreement.

[0007] (2) Technical solution

[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0009] An ECDH key agreement device suitable for a security chip, comprising a key agreement top-level module, the key agreement top-level module comprising an ECDH top-level module and a random number generator, the ECDH top-level module comprising a register configuration module, a private key and public key generation module, an ECDH control module, and a point multiplication top-level module;

[0010] Random number generator, connected to the AMBA bus, can generate random numbers according to specific configurations and store the generated random numbers in the embedded FIFO;

[0011] Register configuration module, externally connected to the AMBA bus, completes register configuration and interrupt register enable / disable through the AMBA bus;

[0012] The private and public key generation module, after ECDH key negotiation is initiated, reads a random number from the random number generator, performs a private key check on the random number read, and uses the random number that passes the private key check as the party's private key. After the party's private key is generated, the party calls the point multiplication top-level module to perform a point multiplication operation on the finite field of the party's private key and the shared base point to generate the party's public key.

[0013] After receiving the other party's public key through the AMBA bus, the ECDH control module performs an assurance test on the other party's public key. After the assurance test is successful, it calls the point multiplication top-level module to perform a point multiplication operation on the other party's public key and its own private key over a finite field to generate a shared key. After the shared key is generated, the key negotiation result is generated based on the shared key.

[0014] Preferably, after the ECDH key negotiation is started, the private key and public key generation module reads a random number from a random number generator, performs a private key detection on the read random number, and uses the random number that passes the private key detection as the private key of the party, including:

[0015] If the private key detection fails, continue to read random numbers from the random number generator and perform private key detection on the read random numbers until the private key detection succeeds.

[0016] Preferably, the ECDH control module includes a counterpart public key detection module and a KDF key derivation module;

[0017] The other party's public key detection module performs an assurance check on the other party's public key after receiving it through the AMBA bus. If the assurance check succeeds, the other party's public key and the local private key are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key. If the assurance check fails, the interrupt register INTERRUPT_REG[2] is configured to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2] = 1, it notifies the other party to send the public key again.

[0018] After generating the shared key, the KDF key derivation module uses the key derivation function KDF to generate a key negotiation result based on the shared key, and stores the key negotiation result in the register ECDH_RESULT_REG[511:0].

[0019] Preferably, the specific working process of the ECDH key agreement device includes:

[0020] S0, power on, clock signal works;

[0021] S1, reset signal completes asynchronous reset and synchronous release;

[0022] S2. Start the random number generator via the AMBA bus to generate random numbers for subsequent use;

[0023] S3. Configure register KDF_OTHERINFO_REG[191:0] through the register configuration module, wherein register KDF_OTHERINFO_REG[191:0] stores communication node information of both parties requiring ECDH key negotiation;

[0024] S4. Configure the register CONFIGED_REG[1] to 1 through the register configuration module to start the ECDH top-level module;

[0025] S5. The private key and public key generation module generates the party's private key and the party's public key. After the party's public key is generated, the interrupt register INTERRUPT_REG[1] is automatically set to 1'1b, and the party's public key is stored in the register Q_SELF_X_REG[255:0] and the register Q_SELF_Y_REG[255:0]. When the CPU polls the interrupt register INTERRUPT_REG[1] = 1'1b, it reads the party's public key and sends it to the other party;

[0026] S6. After receiving the other party's public key through the AMBA bus, the register configuration module stores the other party's public key in registers Q_OTHRER_X_REG[255:0] and Q_OTHER_Y_REG[255:0], and configures register CONFIGED_REG[0] to 1, indicating that the other party's public key has been received and written;

[0027] S7. Perform an assurance test on the other party's public key. If the assurance test succeeds, enter S8. If the assurance test fails, configure the interrupt register INTERRUPT_REG[2] to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2]=1, it notifies the other party to send the public key again. Before notifying the other party to send the public key again, configure the register CONFIGED_REG[0] to 1'b0 through the register configuration module and clear the interrupt register INTERRUPT_REG[2].

[0028] S8. The other party's public key detection module generates a shared key, and the KDF key derivation module generates a key negotiation result;

[0029] S9. When the CPU polls the interrupt register INTERRUPT_REG[0]=1'b1, it indicates that the ECDH key negotiation is completed. The key negotiation result generated by the KDF key derivation module is stored in the register ECDH_RESULT_REG[511:0]. The key negotiation result can be flexibly truncated by the user as a symmetric key or initialization vector IV and sent to the symmetric algorithm;

[0030] S10. Before the next ECDH key negotiation, clear all interrupt registers in the above steps by configuring the clear interrupt register CLR_INTERRUPT_REG through the register configuration module, and configure the register CONFIGED_REG[2:0] to 3'b0 to complete the reset process.

[0031] An ECDH key agreement method applicable to a security chip includes the following steps:

[0032] S1. The two parties in ECDH key negotiation share P-256 elliptic curve parameters, where the P-256 elliptic curve parameters include the shared base point G.

[0033] S2. Both parties in the ECDH key negotiation read a random number from the random number generator, perform a private key check on the random number, and use the random number that passes the private key check as their own private key.

[0034] S3. ECDH key negotiation parties call the point multiplication top-level module to perform a point multiplication operation on their own private key and the shared base point G over a finite field to generate their own public key.

[0035] S4. ECDH key negotiation: Both parties send their public keys to each other.

[0036] S5. After receiving the other party's public key, both parties in ECDH key negotiation perform an assurance test on the other party's public key. If the assurance test succeeds, they call the point multiplication top-level module to perform a point multiplication operation on the other party's public key and their own private key over a finite field to generate a shared key, and generate a key agreement result based on the shared key. If the assurance test fails, the process returns to S2, and the party that failed the assurance test regenerates its own public key and sends it to the other party.

[0037] Preferably, the two parties in the ECDH key negotiation in S1 share the P-256 elliptic curve parameters, including:

[0038] The U end and the V end share P-256 elliptic curve parameters, where the P-256 elliptic curve parameters include a shared base point G.

[0039] Preferably, in S2, both parties in the ECDH key negotiation read a random number from a random number generator, perform a private key check on the random number read, and use the random number that passes the private key check as their own private key, including:

[0040] The U side reads a random number from the random number generator, performs a private key check on the random number, and uses the random number that passes the private key check as the U side's private key u;

[0041] At the same time, the V side reads a random number from the random number generator, performs a private key check on the read random number, and uses the random number that passes the private key check as the V side's private key v.

[0042] Preferably, in S3, both parties in the ECDH key negotiation perform a point multiplication operation on their own private key and the shared base point G over a finite field by calling the point multiplication top-level module to generate their own public key, including:

[0043] The U side calls the point multiplication top-level module to perform a point multiplication operation on the U party's private key u and the shared base point G on a finite field to generate the U party's public key uG;

[0044] At the same time, the V side calls the point multiplication top-level module to perform a point multiplication operation on the V party private key v and the shared base point G over a finite field to generate the V party public key vG.

[0045] Preferably, in S4, both parties in the ECDH key negotiation send their public keys to each other, including:

[0046] The U side sends the U party public key uG to the V side;

[0047] At the same time, the V side sends the V party public key vG to the U side.

[0048] Preferably, after receiving the other party's public key, both parties in the ECDH key negotiation in S5 perform an assurance test on the other party's public key. If the assurance test succeeds, they perform a point multiplication operation on the other party's public key and their own private key over a finite field by calling the point multiplication top-level module to generate a shared key, and generate a key agreement result based on the shared key. If the assurance test fails, the process returns to S2, and the party that fails the assurance test regenerates its own public key and sends it to the other party, including:

[0049] After receiving the public key vG of Party V sent by Party V, the U-side performs an assurance check on the public key vG of Party V. If the assurance check succeeds, the U-side performs a point multiplication operation on the public key vG of Party V and the private key u of Party U over a finite field by calling the point multiplication top-level module to generate the shared key uvG. The key derivation function KDF is used to generate the key agreement result ecdh_out_u based on the shared key uvG. If the assurance check fails, the process returns to S2, and the V-side regenerates the public key vG of Party V and sends it to the U-side.

[0050] At the same time, after receiving the U public key uG sent by the U end, the V end performs an assurance test on the U public key uG. If the assurance test is successful, the U public key uG and the V private key v are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key vuG, and the key derivation function KDF is used to generate the key negotiation result ecdh_out_v based on the shared key vuG; if the assurance test fails, it returns to S2, and the U end regenerates the U public key uG and sends it to the V end.

[0051] (3) Beneficial effects

[0052] Compared with the existing technology, the ECDH key agreement device and method suitable for security chips provided by the present invention adopt a pure RTL hardening design scheme and do not rely on CPU operation assistance, thereby avoiding the use of CPU and greatly improving the efficiency of ECDH key agreement. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] 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 only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.

[0054] Figure 1 Schematic diagram of the ECDH key agreement system in the present invention;

[0055] Figure 2 Schematic diagram of the ECDH key agreement process in the present invention;

[0056] Figure 3 Schematic diagram of the working process of the ECDH key agreement device in the present invention. DETAILED DESCRIPTION

[0057] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0058] An ECDH key agreement device suitable for a security chip, such as Figure 1 As shown, it includes a key agreement top-level module, which includes an ECDH top-level module and a random number generator. The ECDH top-level module includes a register configuration module, a private key and public key generation module, an ECDH control module, and a point multiplication top-level module.

[0059] Random number generator, connected to the AMBA bus, can generate random numbers according to specific configurations and store the generated random numbers in the embedded FIFO;

[0060] Register configuration module, externally connected to the AMBA bus, completes register configuration and interrupt register enable / disable through the AMBA bus;

[0061] The private and public key generation module, after ECDH key negotiation is initiated, reads a random number from the random number generator, performs a private key check on the random number read, and uses the random number that passes the private key check as the party's private key. After the party's private key is generated, the party calls the point multiplication top-level module to perform a point multiplication operation on the finite field of the party's private key and the shared base point to generate the party's public key.

[0062] After receiving the other party's public key through the AMBA bus, the ECDH control module performs an assurance test on the other party's public key. After the assurance test is successful, it calls the point multiplication top-level module to perform a point multiplication operation on the other party's public key and its own private key over a finite field to generate a shared key. After the shared key is generated, the key negotiation result is generated based on the shared key.

[0063] ① The register configuration module is connected to the AMBA bus, and the register configuration and interrupt register enable / disable are completed through the AMBA bus. According to the AMBA bus interface (32-bit width), the registers involved in the technical solution of this application are as follows:

[0064] Table 1 Register Q_SELF_X_REG Function Description

[0065]

[0066] Table 2 Register Q_SELF_Y_REG Function Description

[0067]

[0068]

[0069] Table 3 Register Q_OTHER_X_REG Function Description

[0070]

[0071] Table 4 Register Q_OTHER_Y_REG Function Description

[0072]

[0073] Table 5 Register KDF_OTHERINFO_REG Function Description

[0074]

[0075] Table 6 Register ECDH_RESULT_REG Function Description

[0076]

[0077]

[0078] Table 7 Interrupt register INTERRUPT_REG function description

[0079]

[0080] Table 8 Clear interrupt register CLR_INTERRUPT_REG function description

[0081]

[0082] Table 9 Register CONFIGED_REG Function Description

[0083]

[0084]

[0085] ② After ECDH key negotiation is started, the private key and public key generation module reads a random number from the random number generator, performs a private key check on the random number read, and uses the random number that passes the private key check as the private key of the party, including:

[0086] If the private key detection fails, continue to read random numbers from the random number generator and perform private key detection on the read random numbers until the private key detection succeeds.

[0087] ③ECDH control module includes the other party's public key detection module and KDF key derivation module;

[0088] The other party's public key detection module performs an assurance check on the other party's public key after receiving it through the AMBA bus. If the assurance check succeeds, the other party's public key and the local private key are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key. If the assurance check fails (a transmission error may have occurred, or a public key transmission error may have occurred due to an attack), the interrupt register INTERRUPT_REG[2] is configured to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2]=1, it notifies the other party to send the public key again.

[0089] After generating the shared key, the KDF key derivation module uses the key derivation function KDF to generate a key negotiation result based on the shared key, and stores the key negotiation result in the register ECDH_RESULT_REG[511:0].

[0090] In the technical solution of this application, the specific working process of the ECDH key agreement device is as follows: Figure 3 As shown, specifically including:

[0091] S0, power on, clock signal works;

[0092] S1, reset signal completes asynchronous reset and synchronous release;

[0093] S2. Start the random number generator via the AMBA bus to generate random numbers for subsequent use;

[0094] S3. Configure register KDF_OTHERINFO_REG[191:0] through the register configuration module, wherein register KDF_OTHERINFO_REG[191:0] stores communication node information of both parties requiring ECDH key negotiation;

[0095] S4. Configure the register CONFIGED_REG[1] to 1 through the register configuration module to start the ECDH top-level module;

[0096] S5. The private key and public key generation module generates the party's private key and the party's public key. After the party's public key is generated, the interrupt register INTERRUPT_REG[1] is automatically set to 1'1b, and the party's public key is stored in the register Q_SELF_X_REG[255:0] and the register Q_SELF_Y_REG[255:0]. When the CPU polls the interrupt register INTERRUPT_REG[1] = 1'1b, it reads the party's public key and sends it to the other party;

[0097] S6. After receiving the other party's public key through the AMBA bus, the register configuration module stores the other party's public key in registers Q_OTHRER_X_REG[255:0] and Q_OTHER_Y_REG[255:0], and configures register CONFIGED_REG[0] to 1, indicating that the other party's public key has been received and written;

[0098] S7. Perform an assurance test on the other party's public key. If the assurance test succeeds, enter S8. If the assurance test fails, configure the interrupt register INTERRUPT_REG[2] to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2]=1, it notifies the other party to send the public key again. Before notifying the other party to send the public key again, configure the register CONFIGED_REG[0] to 1'b0 through the register configuration module and clear the interrupt register INTERRUPT_REG[2].

[0099] S8. The other party's public key detection module generates a shared key, and the KDF key derivation module generates a key negotiation result;

[0100] S9. When the CPU polls the interrupt register INTERRUPT_REG[0]=1'b1, it indicates that the ECDH key negotiation is completed. The key negotiation result generated by the KDF key derivation module is stored in the register ECDH_RESULT_REG[511:0]. The key negotiation result can be flexibly truncated by the user as a symmetric key or initialization vector IV and sent to the symmetric algorithm;

[0101] S10. Before the next ECDH key negotiation, clear all interrupt registers in the above steps by configuring the clear interrupt register CLR_INTERRUPT_REG through the register configuration module, and configure the register CONFIGED_REG[2:0] to 3'b0 to complete the reset process.

[0102] In the technical solution of this application, based on the above-mentioned ECDH key agreement device applicable to the security chip, an ECDH key agreement method applicable to the security chip is also disclosed. This method meets the key agreement NIST standard stipulated by the International Cryptography Association, such as Figure 2 As shown, the following steps are included:

[0103] S1. Both parties in ECDH key negotiation share P-256 elliptic curve parameters (P-256 elliptic curve recommended by the International Cryptologic Association). The P-256 elliptic curve parameters include the shared base point G.

[0104] S2. Both parties in the ECDH key negotiation read a random number from the random number generator, perform a private key check on the random number, and use the random number that passes the private key check as their own private key.

[0105] S3. ECDH key negotiation parties call the point multiplication top-level module to perform a point multiplication operation on their own private key and the shared base point G over a finite field to generate their own public key.

[0106] S4. ECDH key negotiation: Both parties send their public keys to each other.

[0107] S5. After receiving the other party's public key, both parties in ECDH key negotiation perform an assurance test on the other party's public key. If the assurance test succeeds, they call the point multiplication top-level module to perform a point multiplication operation on the other party's public key and their own private key over a finite field to generate a shared key, and generate a key agreement result based on the shared key. If the assurance test fails, the process returns to S2, and the party that failed the assurance test regenerates its own public key and sends it to the other party.

[0108] In S1, both parties in ECDH key negotiation share the P-256 elliptic curve parameters, including:

[0109] The U end and the V end share P-256 elliptic curve parameters, where the P-256 elliptic curve parameters include a shared base point G.

[0110] In S2, both parties in the ECDH key negotiation read a random number from the random number generator, perform a private key check on the random number, and use the random number that passes the private key check as their own private key, including:

[0111] The U side reads a random number from the random number generator, performs a private key check on the random number, and uses the random number that passes the private key check as the U side's private key u;

[0112] At the same time, the V side reads a random number from the random number generator, performs a private key check on the read random number, and uses the random number that passes the private key check as the V side's private key v.

[0113] In S3, both parties in ECDH key negotiation perform a point multiplication operation on their private key and the shared base point G over a finite field by calling the point multiplication top-level module to generate their public key, including:

[0114] The U side calls the point multiplication top-level module to perform a point multiplication operation on the U party's private key u and the shared base point G on a finite field to generate the U party's public key uG;

[0115] At the same time, the V side calls the point multiplication top-level module to perform a point multiplication operation on the V party private key v and the shared base point G over a finite field to generate the V party public key vG.

[0116] In S4, both parties in the ECDH key negotiation send their public keys to each other, including:

[0117] The U side sends the U party public key uG to the V side;

[0118] At the same time, the V side sends the V party public key vG to the U side.

[0119] In S5, after receiving the other party's public key, both parties in the ECDH key negotiation perform an assurance test on the other party's public key. If the assurance test succeeds, they call the point multiplication top-level module to perform a point multiplication operation on the other party's public key and their own private key over a finite field to generate a shared key, and then generate a key agreement result based on the shared key. If the assurance test fails, the process returns to S2, and the party that failed the assurance test regenerates its own public key and sends it to the other party, including:

[0120] After receiving the public key vG of Party V sent by Party V, the U-side performs an assurance check on the public key vG of Party V. If the assurance check succeeds, the U-side performs a point multiplication operation on the public key vG of Party V and the private key u of Party U over a finite field by calling the point multiplication top-level module to generate the shared key uvG. The key derivation function KDF is used to generate the key agreement result ecdh_out_u based on the shared key uvG. If the assurance check fails, the process returns to S2, and the V-side regenerates the public key vG of Party V and sends it to the U-side.

[0121] At the same time, after receiving the U public key uG sent by the U end, the V end performs an assurance test on the U public key uG. If the assurance test is successful, the U public key uG and the V private key v are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key vuG, and the key derivation function KDF is used to generate the key negotiation result ecdh_out_v based on the shared key vuG; if the assurance test fails, it returns to S2, and the U end regenerates the U public key uG and sends it to the V end.

[0122] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. An ECDH key agreement device suitable for a security chip, characterized by: It includes a key agreement top-level module, the key agreement top-level module includes an ECDH top-level module and a random number generator, the ECDH top-level module includes a register configuration module, a private key and public key generation module, an ECDH control module and a point multiplication top-level module; Random number generator, connected to the AMBA bus, can generate random numbers according to specific configurations and store the generated random numbers in the embedded FIFO; Register configuration module, externally connected to the AMBA bus, completes register configuration and interrupt register enable / disable through the AMBA bus; The private and public key generation module, after ECDH key negotiation is initiated, reads a random number from the random number generator, performs a private key check on the random number read, and uses the random number that passes the private key check as the party's private key. After the party's private key is generated, the party calls the point multiplication top-level module to perform a point multiplication operation on the finite field of the party's private key and the shared base point to generate the party's public key. After receiving the other party's public key through the AMBA bus, the ECDH control module performs an assurance test on the other party's public key. After the assurance test is successful, it calls the point multiplication top-level module to perform a point multiplication operation on the other party's public key and its own private key over a finite field to generate a shared key. After the shared key is generated, the key negotiation result is generated based on the shared key.

2. The ECDH key agreement device for a security chip according to claim 1, wherein: After the ECDH key negotiation is started, the private key and public key generation module reads a random number from the random number generator, performs a private key test on the read random number, and uses the random number that passes the private key test as the private key of the party, including: If the private key detection fails, continue to read random numbers from the random number generator and perform private key detection on the read random numbers until the private key detection succeeds.

3. The ECDH key agreement device for a security chip according to claim 1, wherein: The ECDH control module includes a peer public key detection module and a KDF key derivation module; The other party's public key detection module performs an assurance check on the other party's public key after receiving it through the AMBA bus. If the assurance check succeeds, the other party's public key and the local private key are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key. If the assurance check fails, the interrupt register INTERRUPT_REG[2] is configured to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2] = 1, it notifies the other party to send the public key again. After generating the shared key, the KDF key derivation module uses the key derivation function KDF to generate a key negotiation result based on the shared key, and stores the key negotiation result in the register ECDH_RESULT_REG[511:0].

4. The ECDH key agreement device for a security chip according to claim 1, wherein: The specific working process of the ECDH key agreement device includes: S0, power on, clock signal works; S1, reset signal completes asynchronous reset and synchronous release; S2. Start the random number generator via the AMBA bus to generate random numbers for subsequent use; S3. Configure register KDF_OTHERINFO_REG[191:0] through the register configuration module, wherein register KDF_OTHERINFO_REG[191:0] stores communication node information of both parties requiring ECDH key negotiation; S4. Configure the register CONFIGED_REG[1] to 1 through the register configuration module to start the ECDH top-level module; S5. The private key and public key generation module generates the party's private key and the party's public key. After the party's public key is generated, the interrupt register INTERRUPT_REG[1] is automatically set to 1'1b, and the party's public key is stored in the register Q_SELF_X_REG[255:0] and the register Q_SELF_Y_REG[255:0]. When the CPU polls the interrupt register INTERRUPT_REG[1] = 1'1b, it reads the party's public key and sends it to the other party; S6. After receiving the other party's public key through the AMBA bus, the register configuration module stores the other party's public key in registers Q_OTHRER_X_REG[255:0] and Q_OTHER_Y_REG[255:0], and configures register CONFIGED_REG[0] to 1, indicating that the other party's public key has been received and written; S7. Perform an assurance test on the other party's public key. If the assurance test succeeds, enter S8. If the assurance test fails, configure the interrupt register INTERRUPT_REG[2] to 1 through the register configuration module. When the CPU polls the interrupt register INTERRUPT_REG[2]=1, it notifies the other party to send the public key again. Before notifying the other party to send the public key again, configure the register CONFIGED_REG[0] to 1'b0 through the register configuration module and clear the interrupt register INTERRUPT_REG[2]. S8. The other party's public key detection module generates a shared key, and the KDF key derivation module generates a key negotiation result; S9. When the CPU polls the interrupt register INTERRUPT_REG[0]=1'b1, it indicates that the ECDH key negotiation is completed. The key negotiation result generated by the KDF key derivation module is stored in the register ECDH_RESULT_REG[511:0]. The key negotiation result can be flexibly truncated by the user as a symmetric key or initialization vector IV and sent to the symmetric algorithm; S10. Before the next ECDH key negotiation, clear all interrupt registers in the above steps by configuring the clear interrupt register CLR_INTERRUPT_REG through the register configuration module, and configure the register CONFIGED_REG[2:0] to 3'b0 to complete the reset process.

5. An ECDH key agreement method applicable to a security chip, applied to the ECDH key agreement device applicable to a security chip according to claim 1, characterized in that: The following steps are involved: S1. The two parties in ECDH key negotiation share P-256 elliptic curve parameters, where the P-256 elliptic curve parameters include the shared base point G. S2. Both parties in the ECDH key negotiation read a random number from the random number generator, perform a private key check on the random number, and use the random number that passes the private key check as their own private key. S3. ECDH key negotiation parties call the point multiplication top-level module to perform a point multiplication operation on their own private key and the shared base point G over a finite field to generate their own public key. S4. ECDH key negotiation: Both parties send their public keys to each other. S5. After receiving the other party's public key, both parties in ECDH key negotiation perform an assurance test on the other party's public key. If the assurance test succeeds, they call the point multiplication top-level module to perform a point multiplication operation on the other party's public key and their own private key over a finite field to generate a shared key, and generate a key agreement result based on the shared key. If the assurance test fails, the process returns to S2, and the party that failed the assurance test regenerates its own public key and sends it to the other party.

6. The ECDH key agreement method applicable to a security chip according to claim 5, characterized in that: In S1, both parties in ECDH key negotiation share the P-256 elliptic curve parameters, including: The U end and the V end share P-256 elliptic curve parameters, where the P-256 elliptic curve parameters include a shared base point G.

7. The ECDH key agreement method applicable to a security chip according to claim 6, characterized in that: In S2, both parties in the ECDH key negotiation read a random number from the random number generator, perform a private key check on the random number, and use the random number that passes the private key check as their own private key, including: The U side reads a random number from the random number generator, performs a private key check on the random number, and uses the random number that passes the private key check as the U side's private key u; At the same time, the V side reads a random number from the random number generator, performs a private key check on the read random number, and uses the random number that passes the private key check as the V side's private key v.

8. The ECDH key agreement method applicable to a security chip according to claim 7, characterized in that: In S3, both parties in ECDH key negotiation perform a point multiplication operation on their private key and the shared base point G over a finite field by calling the point multiplication top-level module to generate their public key, including: The U side calls the point multiplication top-level module to perform a point multiplication operation on the U party's private key u and the shared base point G on a finite field to generate the U party's public key uG; At the same time, the V side calls the point multiplication top-level module to perform a point multiplication operation on the V party private key v and the shared base point G over a finite field to generate the V party public key vG.

9. The ECDH key agreement method applicable to a security chip according to claim 8, characterized in that: In S4, both parties in the ECDH key negotiation send their public keys to each other, including: The U side sends the U party public key uG to the V side; At the same time, the V side sends the V party public key vG to the U side.

10. The ECDH key agreement method applicable to a security chip according to claim 9, characterized in that: In S5, after receiving the other party's public key, both parties in the ECDH key negotiation perform an assurance test on the other party's public key. If the assurance test succeeds, they call the point multiplication top-level module to perform a point multiplication operation on the other party's public key and their own private key over a finite field to generate a shared key, and then generate a key negotiation result based on the shared key. If the assurance test fails, the process returns to S2, and the party that failed the assurance test regenerates its public key and sends it to the other party, including: After receiving the public key vG of Party V sent by Party V, the U-side performs an assurance check on the public key vG of Party V. If the assurance check succeeds, the U-side performs a point multiplication operation on the public key vG of Party V and the private key u of Party U over a finite field by calling the point multiplication top-level module to generate the shared key uvG. The key derivation function KDF is used to generate the key agreement result ecdh_out_u based on the shared key uvG. If the assurance check fails, the process returns to S2, and the V-side regenerates the public key vG of Party V and sends it to the U-side. At the same time, after receiving the U public key uG sent by the U end, the V end performs an assurance test on the U public key uG. If the assurance test is successful, the U public key uG and the V private key v are multiplied over a finite field by calling the point multiplication top-level module to generate a shared key vuG, and the key derivation function KDF is used to generate the key negotiation result ecdh_out_v based on the shared key vuG; if the assurance test fails, it returns to S2, and the U end regenerates the U public key uG and sends it to the V end.

Citation Information

Patent Citations

  • Two-party collaborative key exchange method, device and system and medium

    CN116192374A

  • Method and system for secure shared key exchange

    KR1020190049133A