Method and device for automatically verifying SOC sha unit

By automatically generating and comparing the summary of SOC sha units with openssl encryption toolkit and linux scripts, the problem of automaticity and inefficiency of existing verification methods is solved, and automated verification is realized, reducing artificial processes.

CN119740527APending Publication Date: 2025-04-01JI RUI ZHI YUAN (XIAMEN) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411695922.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The validity verification of existing SOC sha units is poorly automated and inefficient, requiring manual or third-party tools to compare summary, which is time-consuming and labor-intensive.

Method used

By using the OpenSSL encryption toolkit to generate a standard summary of the test file, and automatically generate an embedded program using pre-written linux scripts. Call the sha unit in the SOC to calculate the target summary, and automatically compare whether the target summary and the standard summary are consistent in the simulation software.

Benefits of technology

Improves automation and efficiency, reduces artificial processes, and automatically compares the summary directly in the simulation software without outputting it to the log file for comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740527A_ABST
    Figure CN119740527A_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for automatically verifying the SOC sha unit, belonging to the field of validity verification of functional units of system chips. The method comprises: based on the function algorithm of the sha unit to be verified, using the openssl encryption toolkit to generate the standard summary of the test file; using the pre-written linux script to automatically generate an embedded program containing the test file and the standard summary declaration for use by the SOC in the simulation software; in the simulation software, calling the sha unit to be verified in the SOC, calculating the target summary of the test file, and automatically comparing the target summary with the standard summary to see if they are consistent. This scheme can perform automated verification, reduce manual processes, and improve verification efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of validity verification of functional units of a system chip, and in particular to a method and device for automatically verifying a SOC sha unit. Background Art

[0002] The sha unit in the SOC system-level chip is used to generate a summary of the message data in security verification such as digital signatures. The sha unit is usually a one-way encryption algorithm based on HASH. Since the one-way encryption algorithm is irreversible, the validity verification of the sha unit in the SOC cannot be verified by reverse decryption.

[0003] In the existing sha unit validity verification, a message file is usually specified, and a standard summary of the message file is generated using the same encryption algorithm as the sha unit. Then, in the simulation software, the specified message file is declared in the SOC embedded program, and the sha unit of the SOC is called to calculate the summary of the specified message file and output it to the log file. Finally, the correctness and validity of the sha unit are verified by comparing whether the summary calculated by the sha unit is consistent with the standard summary manually or through third-party tools.

[0004] Since the specified message file is declared in the embedded program, it is necessary to manually input the content of the message file. When the specified message file is large, the declaration is time-consuming and laborious. Moreover, it is necessary to manually or call a third-party program to compare whether the summary calculated by the sha unit is consistent with the standard summary. Therefore, the existing verification method has poor automation and low verification efficiency, and a new method for automatically verifying the SOC sha unit is urgently needed. Summary of the invention

[0005] The present invention provides a method and device for automatically verifying SOC sha units, which can solve the problems of poor automation and low verification efficiency of existing verification methods. The technical solution is as follows:

[0006] In one aspect, a method for automatically verifying a SOC sha unit is provided, the method comprising:

[0007] Based on the function algorithm of the sha unit to be verified, the standard summary of the test file is generated using the openssl encryption toolkit;

[0008] Using a pre-written Linux script, automatically generate an embedded program containing the test file and the standard summary statement for use by the SOC in the simulation software;

[0009] In the simulation software, the sha unit to be verified in the SOC is called to calculate the target digest of the test file, and the target digest is automatically compared with the standard digest to see whether they are consistent.

[0010] On the other hand, a device for automatically verifying a SOC sha unit is provided, which is used to implement the steps of any method embodiment in the above specification, and the device includes:

[0011] The encryption unit is used to generate a standard summary of the test file using the OpenSSL encryption toolkit based on the function algorithm of the sha unit to be verified;

[0012] A declaration unit, for automatically generating an embedded program containing the test file and the standard summary declaration using a pre-written Linux script, for use by the SOC in the simulation software;

[0013] The verification unit is used to call the sha unit to be verified in the SOC in the simulation software, calculate the target summary of the test file, and automatically compare whether the target summary is consistent with the standard summary.

[0014] On the other hand, a computer device is provided, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of the above-mentioned method.

[0015] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned method are implemented.

[0016] On the other hand, a computer program product is provided, comprising a computer program, wherein the computer program implements the steps of the above method when executed by a processor.

[0017] The technical solution provided by the present invention can at least bring the following beneficial effects:

[0018] By using pre-written Linux scripts, embedded programs containing test files and standard summary declarations are automatically generated. Compared with the traditional verification method that requires manual declaration, the automation and efficiency can be improved; in addition, by declaring the standard summary in the SOC of the simulation software, the target summary and the standard summary can be directly and automatically compared in the simulation software for consistency, without the need to output the target summary to the computer log file and then compare it manually or through third-party tools. Therefore, compared with the traditional verification method, this solution can perform automated verification, reduce manual processes, and improve verification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 It is a flow chart of a method for automatically verifying a SOC sha unit provided by an embodiment of the present invention;

[0021] Figure 2 It is an automated Linux script provided by an embodiment of the present invention;

[0022] Figure 3 is a randomly generated test file provided by an embodiment of the present invention;

[0023] Figure 4 is a standard summary of a test file provided by an embodiment of the present invention;

[0024] Figure 5 It is a statement of a test file and standard summary provided by an embodiment of the present invention;

[0025] Figure 6 It is a structural diagram of a device for automatically verifying a SOC sha unit provided by an embodiment of the present invention;

[0026] Figure 7 It is a hardware architecture diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0028] The specific implementation of the above concept is described below.

[0029] Please refer to Figure 1 , an embodiment of the present invention provides a method for automatically verifying a SOC sha unit, the method comprising:

[0030] Step 100, based on the function algorithm of the sha unit to be verified, use the openssl encryption toolkit to generate a standard digest of the test file;

[0031] Step 102, using a pre-written Linux script, automatically generating an embedded program containing a test file and a standard summary statement for use by the SOC in the simulation software;

[0032] Step 104, in the simulation software, call the sha unit to be verified in the SOC, calculate the target digest of the test file, and automatically compare whether the target digest is consistent with the standard digest.

[0033] In the embodiment of the present invention, by using a pre-written Linux script, an embedded program containing a test file and a standard summary statement is automatically generated, which can improve automation and efficiency compared to the traditional verification method that requires manual declaration; in addition, by declaring the standard summary in the SOC of the simulation software, the target summary and the standard summary can be directly and automatically compared in the simulation software to see if they are consistent, without having to output the target summary to a computer log file and then compare it manually or through third-party tools. Therefore, compared to the traditional verification method, this solution can perform automated verification, reduce manual processes, and improve verification efficiency.

[0034] Described below Figure 1 How the various steps are performed.

[0035] For step 100:

[0036] In this embodiment, the function algorithm of the sha unit to be verified includes at least MD5, SHA1, SHA2, SHA3 and SHA256. It can be understood that the function algorithm for calculating the summary is different for different versions of the sha unit. In this embodiment, it is necessary to select a corresponding function algorithm from the openssl encryption toolkit to calculate the standard summary of the test file according to the function algorithm of the sha unit to be verified.

[0037] In the traditional verification method, the test file needs to be manually specified, which lacks randomness. Therefore, in this embodiment, the test file can be automatically and randomly generated, which not only has randomness, but also can improve the degree of automation.

[0038] In some implementations, step 100 may include:

[0039] Use openssl rand command parameters to randomly generate test files;

[0040] The digest of the test file is calculated using the same function algorithm as the sha unit to be verified in the openssl encryption toolkit to generate a standard digest in standard text form.

[0041] In this embodiment, since the openssl encryption toolkit needs to be used to calculate the standard digest, the openssl rand command parameter can be directly used to randomly generate a test file, which is simpler and faster.

[0042] You can refer to Figure 2 The first line of code uses the openssl rand command parameter to randomly generate a test file, and the second line of code calculates the standard digest. The randomly generated test file is as follows Figure 3 As shown, the standard summary of the test file is calculated as follows Figure 4 shown.

[0043] Regarding step 102:

[0044] In some implementations, step 102 may include:

[0045] Use pre-written Linux scripts to generate test file declarations and standard summary declarations in turn;

[0046] Generate the embedded program main.c based on the declaration of the test file and the declaration of the standard summary;

[0047] Copies the test files and standard summaries to memory accessible to the SOC sha unit.

[0048] In this embodiment, the automated Linux script can refer to Figure 2 The third to tenth lines of code are the declaration generation process of the test file, the eleventh to sixteenth lines of code are the declaration process of the standard summary, and the seventeenth to twentieth lines of code are the generation process of the embedded program main.c. It can be seen that there is no need to manually declare the test file and the standard summary, which saves time and effort.

[0049] In some implementations, the step of “generating a test file declaration and a standard summary declaration in sequence using a pre-written Linux script” may include:

[0050] Copy each line of the test file in sequence and add a line break between each line to automatically generate the declaration of the test file;

[0051] Copy the content of the standard summary and add 0x before every two characters in the content of the standard summary to automatically generate a statement of the standard summary.

[0052] In this embodiment, since the test file is usually large, the use of hexadecimal declaration will result in a long automatic declaration time and a large declaration file. Therefore, the test file does not use hexadecimal declaration. The standard summary has less content, so a hexadecimal declaration can be used. The declaration of the test file and the declaration of the standard summary are as follows: Figure 5 shown.

[0053] Regarding step 104:

[0054] In some implementations, step 104 may include:

[0055] Call the sha unit to be verified in SOC, calculate the target digest of the test file, and put the target digest into the memory of SOC;

[0056] Obtain the target summary and the standard summary, and automatically compare whether the target summary and the standard summary are consistent;

[0057] If they are consistent, the output verification is successful;

[0058] If they are inconsistent, it indicates that the validity verification of the sha unit to be verified has failed.

[0059] In the traditional sha unit verification method, the standard summary is not declared in the SOC. Therefore, the target summary calculated by calling the sha unit to be verified needs to be output to the computer's log file, and then the summary calculated by the sha unit is compared with the standard summary manually or through third-party tools to verify the correctness and validity of the sha unit. In this embodiment, since the standard summary is automatically declared in the SOC, the target summary and the standard summary can be directly and automatically compared in the simulation software to see if they are consistent, which saves time and effort and improves the efficiency of automated verification.

[0060] Please refer to Figure 6 The embodiment of the present invention provides an automatic verification device for SOC sha unit, which is used to implement the steps of any method embodiment in the specification, and the device includes:

[0061] The encryption unit 601 is used to generate a standard digest of the test file using the openssl encryption toolkit based on the function algorithm of the sha unit to be verified;

[0062] A declaration unit 602 is used to automatically generate an embedded program containing a test file and a standard summary declaration using a pre-written Linux script for use by the SOC in the simulation software;

[0063] The verification unit 603 is used to call the sha unit to be verified in the SOC in the simulation software, calculate the target digest of the test file, and automatically compare whether the target digest is consistent with the standard digest.

[0064] In one embodiment of the present invention, the encryption unit 601 is used to perform:

[0065] Use openssl rand command parameters to randomly generate test files;

[0066] The digest of the test file is calculated using the same function algorithm as the sha unit to be verified in the openssl encryption toolkit to generate a standard digest in standard text form.

[0067] In one embodiment of the present invention, the declaration unit 602 is used to execute:

[0068] Use pre-written Linux scripts to generate test file declarations and standard summary declarations in turn;

[0069] Generate the embedded program main.c based on the declaration of the test file and the declaration of the standard summary;

[0070] Copies the test files and standard summaries to memory accessible to the SOC sha unit.

[0071] In one embodiment of the present invention, when the declaration unit 602 generates the declaration of the test file and the declaration of the standard summary in sequence by using the pre-written Linux script, it is used to:

[0072] Copy each line of the test file in sequence and add a line break between each line to automatically generate the declaration of the test file;

[0073] Copy the content of the standard summary and add 0x before every two characters in the content of the standard summary to automatically generate a statement of the standard summary.

[0074] In one embodiment of the present invention, the verification unit 603 is used to perform:

[0075] Call the sha unit to be verified in SOC, calculate the target digest of the test file, and put the target digest into the memory of SOC;

[0076] Obtain the target summary and the standard summary, and automatically compare whether the target summary and the standard summary are consistent;

[0077] If they are consistent, the output verification is successful;

[0078] If they are inconsistent, it indicates that the validity verification of the sha unit to be verified has failed.

[0079] In one embodiment of the present invention, the function algorithm of the sha unit to be verified in the encryption unit 601 includes at least MD5, SHA1, SHA2, SHA3 and SHA256.

[0080] It should be noted that the device for automatically verifying the SOC sha unit provided in the above embodiment is only illustrated by the division of the above functional units. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. In addition, the above device embodiment and the method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0081] The embodiment of the present application also provides a computer device, please refer to Figure 7 The computer device includes a processor and a memory, in which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the method of automatically verifying the SOC sha unit provided by the above-mentioned method embodiments.

[0082] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method of automatically verifying the SOC sha unit provided in the above-mentioned method embodiments.

[0083] An embodiment of the present application also provides a computer program product, which includes a computer program. A processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method of automatically verifying the SOC sha unit described in any of the above embodiments.

[0084] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0085] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0086] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0087] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for automatically verifying a SOC sha unit, characterized in that: include: Based on the function algorithm of the sha unit to be verified, the standard summary of the test file is generated using the openssl encryption toolkit; Using a pre-written Linux script, automatically generate an embedded program containing the test file and the standard summary statement for use by the SOC in the simulation software; In the simulation software, the sha unit to be verified in the SOC is called to calculate the target digest of the test file, and the target digest is automatically compared with the standard digest to see whether they are consistent.

2. The method according to claim 1, characterized in that The function algorithm based on the sha unit to be verified uses the openssl encryption toolkit to generate a standard digest of the test file, including: Use opensslrand command parameters to randomly generate test files; The digest of the test file is calculated using the same function algorithm as the sha unit to be verified in the openssl encryption toolkit to generate a standard digest in standard text form.

3. The method according to claim 1, characterized in that The method of automatically generating an embedded program containing the test file and the standard summary statement by using a pre-written Linux script includes: Generate the test file declaration and the standard summary declaration in sequence by using a pre-written Linux script; Generate an embedded program main.c based on the declaration of the test file and the declaration of the standard summary; The test file and the standard summary are copied to a memory accessible to the SOC sha unit.

4. The method according to claim 3, characterized in that The method of sequentially generating the test file declaration and the standard summary declaration by using a pre-written Linux script includes: Copy each line of the test file in sequence and add a line break between each line of the test file to automatically generate a declaration of the test file; The content of the standard summary is copied, and 0x is added before every two characters in the content of the standard summary to automatically generate a declaration of the standard summary.

5. The method according to claim 1, characterized in that In the simulation software, the sha unit to be verified in the SOC is called to calculate the target summary of the test file, and the target summary is automatically compared with the standard summary to see whether they are consistent, including: Calling the sha unit to be verified in the SOC, calculating the target digest of the test file, and putting the target digest into the memory of the SOC; Obtaining the target summary and the standard summary, and automatically comparing whether the target summary and the standard summary are consistent; If they are consistent, the output verification is successful; If they are inconsistent, it indicates that the validity verification of the sha unit to be verified has failed.

6. The method according to any one of claims 1 to 5, characterized in that The function algorithms of the sha unit to be verified include at least MD5, SHA1, SHA2, SHA3 and SHA256.

7. A device for automatically verifying a SOC sha unit, used to implement the steps of any of the methods described in claims 1-6, characterized in that: include: The encryption unit is used to generate a standard summary of the test file using the OpenSSL encryption toolkit based on the function algorithm of the sha unit to be verified; A declaration unit, for automatically generating an embedded program containing the test file and the standard summary declaration using a pre-written Linux script, for use by the SOC in the simulation software; The verification unit is used to call the sha unit to be verified in the SOC in the simulation software, calculate the target summary of the test file, and automatically compare whether the target summary is consistent with the standard summary.

8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of any one of the methods described in claims 1-6.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.