Rpmb test method, device, computer device and storage medium
Patent Information
- Application Number
- CN202310450158.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-24
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-04-24
AI Technical Summary
目前主流的SSD测试工具DriverMaster,nvme-cli等只提供对特定的应用场景进行串行测试,测试人员很难对SSD测试工具进行扩展,导致一些功能的边界点和交叉点无法进行测试,同时针对RPMB区域内的数据,需要人为再次进行判断是否被篡改,导致测试效率非常低下,不利于大规模的批量测试
[0039]The beneficial effects of this invention compared with the prior art are as follows: This invention determines whether the SSD under test has RPMB functionality. After ensuring that the SSD under test has RPMB functionality, a key is generated and the corresponding RPMB data area is initialized. The test is performed on the SSD under test once for each set of test stimulus parameters selected from the test case pool. The test case pool can be expanded with multiple test cases, thereby improving the coverage of functional tests, reducing test costs, and shortening test time.
Smart Images

Figure CN116524987B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to solid-state drives, and more specifically to RPMB testing methods, apparatus, computer equipment, and storage media. Background Technology
[0002] The RPMB (Replay Protected Memory Block) is a secure storage area in an SSD (Solid State Drive). Access to this area requires authentication and provides protection against replay attacks. Currently, mainstream SSD testing tools such as DriverMaster and nvme-cli only provide serial testing for specific application scenarios. Testers find it difficult to extend these tools, resulting in some functional boundary points and intersections being untestable. Furthermore, data within the RPMB area requires manual verification to determine if it has been tampered with, leading to very low testing efficiency and hindering large-scale batch testing.
[0003] Therefore, it is necessary to design a new method to improve functional test coverage, reduce testing costs, and shorten testing time. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide an RPMB testing method, apparatus, computer equipment, and storage medium.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: an RPMB testing method, comprising:
[0006] Obtain relevant information about the SSD under test;
[0007] Determine whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test;
[0008] If the SSD under test has RPMB functionality, a key is generated based on the relevant information of the SSD under test, and the key is sent to the SSD under test so that the key is burned into the SSD under test.
[0009] Initialize the RPMB data area of the SSD under test;
[0010] Generate test stimulus parameters and store them in the test case pool.
[0011] The SSD under test is tested using the test stimulus parameters in the test case pool.
[0012] The further technical solution is as follows: determining whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test includes:
[0013] The RPMBS field of the controllerdatastructure in the SSD under test is obtained by using the identify command specified in the NVMe protocol.
[0014] Determine whether the number of RPMB units in the RPBBS field is equal to zero;
[0015] If the number of RPMB units in the RPBBS field is not equal to zero, then the SSD under test is determined to have RPMB functionality.
[0016] If the number of RPMB units in the RPBBS field is equal to zero, then the SSD under test is determined to lack RPMB functionality.
[0017] The further technical solution is as follows: generating a key based on the relevant information of the SSD under test, and sending the key to the SSD under test so that the SSD under test can burn the key, includes:
[0018] Using the SUBNQN information related to the SSD under test, a key is generated using the SHA256 digest algorithm provided by the hashlib standard library in Python. This key is then sent to the SSD under test so that the key is burned into the SSD.
[0019] The further technical solution is as follows: the initialization of the RPMB data area of the SSD under test includes:
[0020] The RPMB data area of the SSD under test is initialized with 512 bytes as the smallest unit for reading and writing RPMB data area, and the first 8 bytes of each smallest unit are used as the CRC check value of the starting address, and the last 8 bytes of each smallest unit are used as the CRC check value of the first 504 bytes.
[0021] The further technical solution is as follows: after testing the SSD under test using the test stimulus parameters in the test case pool, it further includes:
[0022] Record the test process in a log.
[0023] The further technical solution is as follows: after generating a key based on the relevant information of the SSD under test and sending the key to the SSD under test so that the SSD under test can burn the key, it also includes:
[0024] Record the key generation log.
[0025] The present invention also provides an RPMB testing apparatus, comprising:
[0026] The information acquisition unit is used to acquire information related to the SSD under test.
[0027] The detection unit is used to determine whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test.
[0028] A key generation unit is used to generate a key based on the relevant information of the SSD under test if the SSD under test has RPMB function, and send the key to the SSD under test so that the key is burned into the SSD under test.
[0029] The initialization unit is used to initialize the RPMB data area of the SSD under test.
[0030] A storage unit is used to generate test stimulus parameters and store them in the test case pool.
[0031] The testing unit is used to test the SSD under test using the test stimulus parameters in the test case pool.
[0032] The further technical solution is as follows: the detection unit includes:
[0033] The field retrieval subunit is used to retrieve the RPMBS field of the controller data structure in the SSD under test information through the identify command specified by the NVMe protocol;
[0034] The judgment sub-unit is used to determine whether the number of RPMB units in the RPBBS field is equal to zero;
[0035] The first determining subunit is used to determine that the SSD under test has RPMB functionality if the number of RPMB units in the RPBBS field is not equal to zero.
[0036] The second determining subunit is used to determine that the SSD under test does not have RPMB functionality if the number of RPMB units in the RPBBS field is equal to zero.
[0037] The present invention also provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the above-described method.
[0038] The present invention also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0039] The beneficial effects of this invention compared with the prior art are as follows: This invention determines whether the SSD under test has RPMB functionality. After ensuring that the SSD under test has RPMB functionality, a key is generated and the corresponding RPMB data area is initialized. The test is performed on the SSD under test once for each set of test stimulus parameters selected from the test case pool. The test case pool can be expanded with multiple test cases, thereby improving the coverage of functional tests, reducing test costs, and shortening test time.
[0040] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0041] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a schematic diagram illustrating an application scenario of the RPMB testing method provided in this embodiment of the invention.
[0043] Figure 2 This is a flowchart illustrating the RPMB testing method provided in an embodiment of the present invention;
[0044] Figure 3 A schematic diagram of the sub-processes of the RPMB testing method provided in an embodiment of the present invention;
[0045] Figure 4 A schematic block diagram of the RPMB testing apparatus provided in an embodiment of the present invention;
[0046] Figure 5 A schematic block diagram of the detection unit of the RPMB testing device provided in an embodiment of the present invention;
[0047] Figure 6 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0050] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0051] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0052] Please see Figure 1 and Figure 2 , Figure 1 This is a schematic diagram illustrating an application scenario of the RPMB testing method provided in this embodiment of the invention. Figure 2 This is a schematic flowchart illustrating the RPMB testing method provided in an embodiment of the present invention. This RPMB testing method is applied to a server. The server interacts with the SSD, and based on the NVMe (Non-Volatile Memory Host Controller Interface Specification, NVMExpress) protocol, uses Python to automatically generate test stimuli and verify data results for RPMB, improving functional test coverage. In large-scale batch testing, it can reduce testing costs and shorten testing time. The server, also the test host, has >= 8GB of memory; supports M.2 interface; operating system: Ubuntu 20.04.1; programming language: Python 2.7.18.
[0053] like Figure 1 As shown, the test system runs on a test host running Ubuntu 20.04.1. The M.2 interface on the test host is connected to the SSD under test via the M.2 interface, which is used for control signals and data communication between the test system and the SSD under test. The entire test system is programmed using Python 2, which calls the NVMe driver provided by Ubuntu to initiate control requests to the SSD under test and obtain corresponding results. The data flow or control flow path is: test system, Linux PC, PC's onboard M.2 interface, SSD's M.2 interface, SSD, RPMB.
[0054] Figure 2 This is a flowchart illustrating the RPMB testing method provided in an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110 to S180.
[0055] S110: Obtain relevant information about the SSD under test.
[0056] In this embodiment, the SSD under test is related to controller data structure information, SUBNQN information, etc.
[0057] S120. Determine whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test.
[0058] Determine whether the SSD under test has RPMB functionality to define the test boundaries.
[0059] In one embodiment, please refer to Figure 3 The above-mentioned step S120 may include steps S121 to S124.
[0060] S121. Obtain the RPMBS field of the controller data structure in the relevant information of the SSD under test through the identify command specified by the NVMe protocol;
[0061] S122. Determine whether the number of RPMB units in the RPBBS field is equal to zero;
[0062] S123. If the number of RPMB units in the RPBBS field is not equal to zero, then the SSD under test is determined to have RPMB functionality.
[0063] S124. If the number of RPMB units in the RPBBS field is equal to zero, then it is determined that the SSD under test does not have RPMB functionality.
[0064] Specifically, the `identify` command specified in the NVMe protocol is used to obtain the `RPMBS` field of the controller data structure. If the number of RPMB units in the `RPMBS` field is not equal to 0, it indicates that the SSD supports RPMB. The capabilities of the SSD under test are then obtained, including key information such as the total size of RPMB, access size, and authentication method. This information is used throughout the test system to generate reasonable boundary cases and mixed examples with different parameters during subsequent testing. Once the test execution unit runs on the Linux PC, this module is initialized and runs, continuously checking if the SSD under test is connected to the test system. Once a successful connection is detected, a report is generated.
[0065] S130. If the SSD under test has RPMB function, a key is generated according to the relevant information of the SSD under test, and the key is sent to the SSD under test so that the key is burned into the SSD under test.
[0066] In this embodiment, a key is generated using the SHA256 digest algorithm provided by the hashlib standard library of Python through the SUBNQN related to the SSD under test, and the key is sent to the SSD under test so that the key is burned into the SSD under test.
[0067] Specifically, during test execution, the system generates corresponding keys based on different SSDs. It uses the SUBNQN (a unique value stored for each SSD) of the SSD as the basis for generating the Authentication Key, and employs the SHA256 hash algorithm provided by Python's hashlib standard library to generate a key for each SSD under test. This key is then burned into the SSD under test. This ensures that in large-scale testing environments, it's unnecessary to maintain track of which key is burned into which SSD for testing. During regression testing, the same algorithm steps are used to obtain the already existing key for a randomly selected SSD under test. This allows for testing with a different key for each SSD under test without requiring external storage of the key, significantly reducing the management of a large number of different keys.
[0068] S140, Record the key generation log.
[0069] S150. Initialize the RPMB data area of the SSD under test.
[0070] In this embodiment, 512 bytes are used as the smallest unit for reading and writing the RPMB data area, and the first 8 bytes of each smallest unit are used as the CRC check value of the starting address, and the last 8 bytes of each smallest unit are used as the CRC check value of the first 504 bytes to initialize the RPMB data area of the SSD under test.
[0071] S160. Generate test stimulus parameters and store them in the test case pool.
[0072] In this embodiment, reasonable random test stimuli are generated based on the determined test boundaries, covering both normal and abnormal tests, thereby realizing the input simulation of real-world application scenarios of SSD RPMB.
[0073] In this embodiment, the test case pool stores the generated test stimuli for the test execution process. A stimulus that meets the execution conditions is randomly selected for testing. It also acts synchronously between the test stimulus generation module and the test execution unit. The format of each test stimulus is as follows:
[0074]
[0075] S170. Test the SSD under test using the test stimulus parameters in the test case pool.
[0076] In this embodiment, a process is started to access the RPMB and check the corresponding results for each set of test stimulus parameters taken from the test case pool. This can generate high-frequency access to the RPMB and verify the functional reliability of the RPMB.
[0077] To ensure effective test execution, when verification data read and write requests exist simultaneously in the system, it is guaranteed that no two accesses to the same address of the RPMB will occur at the same time; read writer counter access types will not be executed in parallel with write access requests to the verification data area; and only one write access to the verification device control block will occur at the same time.
[0078] The test execution unit module performs different actions for different types of requests: Read writer counter: Read the counter from the RPMB and compare it with the expected value maintained in the test system; Verify device control block write: Configure protection permissions for the boot partition and namesapce, and record the configured permissions in the test system after receiving a correct response from the RPMB; Verify device control block read: Read data from the RPMB and compare it with the expected value maintained in the test system; Verify data write: Construct data according to the requirements of the test stimulus, initiate a data write request to the RPMB, and determine whether the RPMB response meets expectations; Verify data read: After successfully reading data, perform CRC check on every 512 bytes of data.
[0079] During testing, reasonable test scenarios are generated for the entire test system. When the entire data area of the RPMB is successfully initialized during test execution, the test stimulus generation module is initialized and started to execute. The test stops when all of the following conditions are met: RPMB access type covers read writercounter, verify device control block read, verify device control block write, verify data area write, and verify data area read; Address covers each valid address in the RPMB data area and one invalid address that does not exist; Sector counter covers the address with a minimum length unit of 512 bytes to the end of the entire available RPMB area; Algotithm covers HMAC-SHA256 and SHA256 (authentications not supported by RPMB).
[0080] The testing process initializes other sub-modules, maintains system status, and runs tests to automate the verification of RPMB functionality.
[0081] S180, Record the test process log.
[0082] During the logging process, the system's operation record and the execution sequence of test stimuli are generally recorded. If the test execution process encounters a failure, the entire test system will be stopped immediately, and the log recording process will be refreshed. The test system will log the entire test process in chronological order according to the execution order of each set of test stimulus parameters. When the test result prints a failure, the order of the logs can be analyzed to help testers quickly locate the problem.
[0083] In this embodiment, the details of the testing process are recorded, which shortens the time it takes for testers to locate problems.
[0084] If the SSD under test has RPMB functionality, proceed to the end step.
[0085] The RPMB testing method described above determines whether the SSD under test has RPMB functionality. After ensuring that the SSD under test has RPMB functionality, a key is generated and the corresponding RPMB data area is initialized. The test is then executed once for each set of test stimulus parameters selected from the test case pool. The test case pool can be expanded to include various test cases, thereby improving the coverage of functional tests, reducing testing costs, and shortening testing time.
[0086] Figure 4 This is a schematic block diagram of an RPMB testing device 300 provided in an embodiment of the present invention. Figure 4 As shown, corresponding to the above RPMB testing method, the present invention also provides an RPMB testing apparatus 300. This RPMB testing apparatus 300 includes a unit for performing the above RPMB testing method, and the apparatus can be configured in a server. Specifically, please refer to... Figure 4 The RPMB testing device 300 includes an information acquisition unit 301, a detection unit 302, a key generation unit 303, a first recording unit 304, an initialization unit 305, a storage unit 306, a second recording unit 307, and a testing unit 308.
[0087] Information acquisition unit 301 is used to acquire relevant information about the SSD under test; detection unit 302 is used to determine whether the SSD under test has RPMB functionality based on the relevant information; key generation unit 303 is used to generate a key based on the relevant information of the SSD under test if the SSD under test has RPMB functionality, and send the key to the SSD under test so that the key is burned into the SSD under test; first recording unit 304 is used to record the key generation log; initialization unit 305 is used to initialize the RPMB data area of the SSD under test; storage unit 306 is used to generate test stimulus parameters and store them in the test case pool; second recording unit 307 is used to record the test process log; test unit 308 is used to test the SSD under test using the test stimulus parameters in the test case pool.
[0088] In one embodiment, such as Figure 5 As shown, the detection unit 302 includes a field acquisition subunit 3021, a judgment subunit 3022, a first determination subunit 3023, and a second determination subunit 3024.
[0089] The field acquisition subunit 3021 is used to obtain the RPBBS field of the controller data structure in the information of the SSD under test through the identify command specified by the NVMe protocol; the judgment subunit 3022 is used to determine whether the number of RPMB units in the RPBBS field is equal to zero; the first determination subunit 3023 is used to determine that the SSD under test has RPMB functionality if the number of RPMB units in the RPBBS field is not equal to zero; the second determination subunit 3024 is used to determine that the SSD under test does not have RPMB functionality if the number of RPMB units in the RPBBS field is equal to zero.
[0090] In one embodiment, the key generation unit 303 is used to generate a key using the sha256 digest algorithm provided by the hashlib standard library of Python through the SUBNQN of the SSD under test information, and send the key to the SSD under test so that the SSD under test can burn the key.
[0091] In one embodiment, the initialization unit 305 is used to initialize the RPMB data area of the SSD under test with 512 bytes as the smallest unit for reading and writing the RPMB data area, and with the first 8 bytes of each smallest unit as the CRC check value of the starting address and the last 8 bytes of each smallest unit as the CRC check value of the first 504 bytes.
[0092] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned RPMB testing device 300 and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0093] The aforementioned RPMB testing device 300 can be implemented as a computer program, which can perform tests such as... Figure 6 It runs on the computer device shown.
[0094] Please see Figure 6 , Figure 6 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a server, wherein the server can be a standalone server or a server cluster composed of multiple servers.
[0095] See Figure 6 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.
[0096] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform an RPMB test method.
[0097] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.
[0098] The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an RPMB test method.
[0099] This network interface 505 is used for network communication with other devices. Those skilled in the art will understand that... Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] The processor 502 is used to run a computer program 5032 stored in the memory to perform the following steps:
[0101] Obtain relevant information about the SSD under test; determine whether the SSD under test has RPMB functionality based on the relevant information; if the SSD under test has RPMB functionality, generate a key based on the relevant information and send the key to the SSD under test so that the key is burned into the SSD under test; initialize the RPMB data area of the SSD under test; generate test stimulus parameters and store them in the test case pool. Test the SSD under test using the test stimulus parameters in the test case pool.
[0102] In one embodiment, when the processor 502 implements the step of determining whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test, the following steps are specifically implemented:
[0103] The RPMBS field of the controller datastructure in the SSD under test is obtained through the identify command specified in the NVMe protocol; it is then determined whether the number of RPMB units in the RPMBS field is equal to zero; if the number of RPMB units in the RPMBS field is not equal to zero, it is determined that the SSD under test has RPMB functionality; if the number of RPMB units in the RPMBS field is equal to zero, it is determined that the SSD under test does not have RPMB functionality.
[0104] In one embodiment, when the processor 502 generates a key based on the information of the SSD under test and sends the key to the SSD under test so that the key is burned into the SSD under test, the specific steps are as follows:
[0105] Using the SUBNQN information related to the SSD under test, a key is generated using the SHA256 digest algorithm provided by the hashlib standard library in Python. This key is then sent to the SSD under test so that the key is burned into the SSD.
[0106] In one embodiment, when the processor 502 implements the step of initializing the RPMB data area of the SSD under test, the following steps are specifically implemented:
[0107] The RPMB data area of the SSD under test is initialized with 512 bytes as the smallest unit for reading and writing RPMB data area, and the first 8 bytes of each smallest unit are used as the CRC check value of the starting address, and the last 8 bytes of each smallest unit are used as the CRC check value of the first 504 bytes.
[0108] In one embodiment, after implementing the step of testing the SSD under test using the test stimulus parameters in the test case pool, the processor 502 further implements the following steps:
[0109] Record the test process in a log.
[0110] In one embodiment, after the processor 502 generates a key based on the information of the SSD under test and sends the key to the SSD under test so that the SSD under test can burn the key, it further performs the following steps:
[0111] Record the key generation log.
[0112] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0113] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0114] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein when executed by a processor, the computer program causes the processor to perform the following steps:
[0115] Obtain relevant information about the SSD under test; determine whether the SSD under test has RPMB functionality based on the relevant information; if the SSD under test has RPMB functionality, generate a key based on the relevant information and send the key to the SSD under test so that the key is burned into the SSD under test; initialize the RPMB data area of the SSD under test; generate test stimulus parameters and store them in the test case pool. Test the SSD under test using the test stimulus parameters in the test case pool.
[0116] In one embodiment, when the processor executes the computer program to implement the step of determining whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test, the specific implementation steps are as follows:
[0117] The RPMBS field of the controller datastructure in the SSD under test is obtained through the identify command specified in the NVMe protocol; it is then determined whether the number of RPMB units in the RPMBS field is equal to zero; if the number of RPMB units in the RPMBS field is not equal to zero, it is determined that the SSD under test has RPMB functionality; if the number of RPMB units in the RPMBS field is equal to zero, it is determined that the SSD under test does not have RPMB functionality.
[0118] In one embodiment, when the processor executes the computer program to generate a key based on the information of the SSD under test and sends the key to the SSD under test so that the key is burned into the SSD under test, the processor specifically implements the following steps:
[0119] Using the SUBNQN information related to the SSD under test, a key is generated using the SHA256 digest algorithm provided by the hashlib standard library in Python. This key is then sent to the SSD under test so that the key is burned into the SSD.
[0120] In one embodiment, when the processor executes the computer program to implement the step of initializing the RPMB data area of the SSD under test, it specifically implements the following steps:
[0121] The RPMB data area of the SSD under test is initialized with 512 bytes as the smallest unit for reading and writing RPMB data area, and the first 8 bytes of each smallest unit are used as the CRC check value of the starting address, and the last 8 bytes of each smallest unit are used as the CRC check value of the first 504 bytes.
[0122] In one embodiment, after executing the computer program to implement the step of testing the SSD under test using the test stimulus parameters in the test case pool, the processor further implements the following steps:
[0123] Record the test process in a log.
[0124] In one embodiment, after the processor executes the computer program to generate a key based on the information of the SSD under test and sends the key to the SSD under test so that the SSD under test can burn the key, it further performs the following steps:
[0125] Record the key generation log.
[0126] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0127] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0128] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0129] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0130] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0131] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An RPMB test method, characterized in that, include: Obtain relevant information about the SSD under test; Determine whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test; If the SSD under test has RPMB functionality, a key is generated using the sha256 digest algorithm provided by the hashlib standard library of Python through the SUBNQN of the SSD under test information, and the key is sent to the SSD under test so that the key is burned into the SSD under test. Initialize the RPMB data area of the SSD under test; Generate test stimulus parameters and store them in the test case pool; The SSD under test is tested using the test stimulus parameters in the test case pool.
2. The RPMB testing method according to claim 1, characterized in that, The step of determining whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test includes: The RPMBS field of the controller data structure in the SSD under test is obtained by using the identify command specified in the NVMe protocol. Determine whether the number of RPMB units in the RPBBS field is equal to zero; If the number of RPMB units in the RPBBS field is not equal to zero, then the SSD under test is determined to have RPMB functionality. If the number of RPMB units in the RPBBS field is equal to zero, then the SSD under test is determined to lack RPMB functionality.
3. The RPMB test method according to claim 1, characterized in that, The initialization of the RPMB data area of the SSD under test includes: The RPMB data area of the SSD under test is initialized with 512 bytes as the smallest unit for reading and writing RPMB data area, and the first 8 bytes of each smallest unit are used as the CRC check value of the starting address, and the last 8 bytes of each smallest unit are used as the CRC check value of the first 504 bytes.
4. The RPMB test method according to claim 1, characterized in that, After testing the SSD under test using the test stimulus parameters in the test case pool, the method further includes: Record the test process in a log.
5. The RPMB test method according to claim 1, characterized in that, After generating a key using information related to the SSD under test and sending the key to the SSD under test so that the key is burned into the SSD under test, the process further includes: Record the key generation log.
6. An RPMB testing apparatus for performing the RPMB testing method as described in claim 1, characterized in that, include: The information acquisition unit is used to acquire information related to the SSD under test. The detection unit is used to determine whether the SSD under test has RPMB functionality based on the relevant information of the SSD under test. A key generation unit is used to generate a key based on the relevant information of the SSD under test if the SSD under test has RPMB function, and send the key to the SSD under test so that the key is burned into the SSD under test. The initialization unit is used to initialize the RPMB data area of the SSD under test. A storage unit is used to generate test stimulus parameters and store them in the test case pool; The testing unit is used to test the SSD under test using the test stimulus parameters in the test case pool.
7. The RPMB testing apparatus according to claim 6, characterized in that, The detection unit includes: The field retrieval subunit is used to retrieve the RPMBS field of the controller data structure in the SSD under test information through the identify command specified by the NVMe protocol; The judgment sub-unit is used to determine whether the number of RPMB units in the RPBBS field is equal to zero; The first determining subunit is used to determine that the SSD under test has RPMB functionality if the number of RPMB units in the RPBBS field is not equal to zero. The second determining subunit is used to determine that the SSD under test does not have RPMB functionality if the number of RPMB units in the RPBBS field is equal to zero.
8. A computer device, characterized in that, The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the RPMB test method as described in any one of claims 1 to 5.
9. A storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, implements the RPMB test method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Function test method and device for RPMB in eMMC and computer equipment
CN112133356A
Methods and devices for secure secret key generation
CN112930659A