Hard disk ATA password function test method and device, equipment and medium
By analyzing and grouping hard disk password commands, standard test commands are generated and encapsulated into a state transition interface, the problem of NVMe SSD hard disk ATA Password functional testing is solved, and systematic testing and efficient testing process are realized.
Patent Information
- Application Number
- CN202510279692.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-04-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to conduct a complete and systematic test of the ATA Password function on the SSD hard disk of the NVMe interface protocol, especially in the lack of detailed descriptions in terms of operations such as setting passwords, unlocking, disabling passwords, secure erasing and status querying.
By parsing the preset protocol document, we obtain the NVMe standard protocol command format, obtain multiple hard disk password commands, and compile them into standard test commands according to this format. These test commands are encapsulated as a state transition interface, which is used to invoke and test the various security states of the hard disk to be tested.
The systemic testing of the ATA Password function of the SSD hard disk of the NVMe interface protocol has been implemented, which improves the convenience and efficiency of the test and reduces labor costs.
Smart Images

Figure CN119782073A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface testing, and in particular to a method, device, equipment and medium for testing the ATA password function of a hard disk. Background Art
[0002] Advanced Technology Attachment Password (ATA Password) is a feature in the Non-Volatile Memory Express (NVMe) protocol. It was originally designed as a password protection feature for hard disks with the ATA interface protocol. With the emergence of NVMe SSDs, this feature has also been applied to NVMe SSDs, but there is no detailed description of the ATA Password feature in the NVMe protocol. As a result, how to perform security operations such as setting passwords, unlocking, disabling passwords, securely erasing, and ATA hard disk password-related security operations on SSDs with the NVMe interface protocol, and even a complete and systematic test of the ATA Password function of NVMe SSDs has become an urgent problem to be solved. Summary of the invention
[0003] In view of this, the purpose of the present invention is to overcome the deficiencies in the prior art and provide a hard disk ATA password function test method, device, equipment and medium. The present invention provides the following technical solutions: In a first aspect, the present invention provides a method for testing the ATA password function of a hard disk, the method comprising: parsing a preset protocol document to obtain an NVMe standard protocol command format; obtaining multiple hard disk password commands from the preset protocol document, and respectively packaging each of the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; encapsulating multiple of the standard test commands to obtain multiple state transition interfaces; calling each of the state transition interfaces to respectively test each security status of the hard disk to be tested to obtain test results for each security status.
[0004] In one embodiment, before packaging each of the hard disk password commands according to the NVMe standard protocol command format, it also includes: determining command parameters corresponding to each of the hard disk password commands.
[0005] In one implementation, the plurality of hard disk password commands include: a password setting command, an unlocking command, a freezing command, a disabling command, an erasing command, and a status query command.
[0006] In one embodiment, the plurality of state conversion interfaces include: a first state conversion interface, a second state conversion interface, a third state conversion interface, a fourth state conversion interface, a fifth state conversion interface and a sixth state conversion interface, and each of the security states includes: a disabled state, a frozen disabled state, a power-off state, an unfrozen locked state, an unfrozen unlocked state and a frozen unlocked state; and calling each of the state conversion interfaces to test each security state of the hard disk to be tested includes: Calling the first state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to a disabled state; Calling the second state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to a frozen disabled state; Calling the third state transition interface to set the hard disk ATA password security state of the hard disk to be tested to a power-off state; Calling the fourth state transition interface to set the hard disk ATA password security state of the hard disk to be tested to an unfrozen and locked state; Calling the fifth state transition interface to set the hard disk ATA password security state of the hard disk to be tested to an unfrozen and unlocked state; The sixth state transition interface is called to set the hard disk ATA password security state of the hard disk to be tested to a frozen unlock state.
[0007] In one embodiment, the method further includes: calling the fourth state conversion interface to adjust the hard disk to be tested to the unfrozen locked state, so as to provide password protection for the hard disk to be tested.
[0008] In one embodiment, before calling the fourth state transition interface to adjust the hard disk under test to the unfrozen locked state, it also includes: calling the fifth state transition interface to adjust the hard disk under test to the unfrozen unlocked state; before calling the fifth state transition interface to adjust the hard disk under test to the unfrozen unlocked state, it also includes: calling the first state transition interface to adjust the hard disk under test to the disabled state.
[0009] In one embodiment, the calling of each state transition interface to test each security state of the hard disk to be tested includes: calling each state transition interface to adjust the hard disk ATA password security state of the hard disk to be tested; determining whether the adjusted hard disk to be tested is in the security state corresponding to the called state transition interface, and if so, determining that the test has passed; if not, determining that the test has failed.
[0010] In a second aspect, the present invention provides a hard disk ATA password function test device, the device comprising: The parsing module is used to parse the preset protocol document and obtain the NVMe standard protocol command format; A package assembly module, used for obtaining a plurality of hard disk password commands from the preset protocol document, and respectively assembling the hard disk password commands according to the NVMe standard protocol command format to obtain a plurality of standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; An encapsulation module, used for encapsulating a plurality of the standard test commands to obtain a plurality of state transition interfaces; The execution module is used to call a target state transition interface from the plurality of state transition interfaces to adjust the hard disk to be tested to a target security state, so as to provide password protection for the hard disk to be tested.
[0011] In a third aspect, the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the hard disk ATA password function test method described in the first aspect is executed.
[0012] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the hard disk ATA password function testing method described in the first aspect is implemented.
[0013] The hard disk ATA password function test method, device, equipment and medium provided by the embodiment of the present invention parse the preset protocol document to obtain the NVMe standard protocol command format; obtain multiple hard disk password commands from the preset protocol document, and respectively package each of the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; encapsulate multiple of the standard test commands to obtain multiple state transition interfaces; call each of the state transition interfaces to test each security status of the hard disk to be tested, and obtain the test results of each security status. This application improves the convenience of testing, reduces the labor cost during the testing process, and improves the testing efficiency by packaging and encapsulating the hard disk password commands.
[0014] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A schematic diagram of a process flow of a cryptographic function testing method provided in an embodiment of the present application is shown; Figure 2 A flow chart showing calling the first state conversion interface to configure the hard disk ATA password security state of the hard disk to be tested to be a disabled state; Figure 3 A flow chart showing calling the second state transition interface to configure the hard disk ATA password security state of the hard disk to be tested to be a frozen disabled state; Figure 4 A flow chart showing calling the fifth state transition interface to configure the hard disk ATA password security state of the hard disk to be tested to be an unfrozen and unlocked state; Figure 5 A flow chart showing calling the fourth state transition interface to configure the hard disk ATA password security state of the hard disk to be tested to be an unfrozen and locked state; Figure 6 A flow chart showing calling the sixth state interface to configure the hard disk ATA password security state of the hard disk to be tested to be a frozen locked state; Figure 7 A schematic diagram of the structure of a hard disk ATA password testing device provided in an embodiment of the present application is shown; Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.
[0017] Description of main component symbols: 700 - hard disk ATA password function test device; 710 - parsing module; 720 - packaging module; 730 - encapsulation module; 740 - execution module; 800 - electronic device; 801 - transceiver; 802 - processor; 803 - memory. DETAILED DESCRIPTION
[0018] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0019] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the template herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0021] Example 1 ATA Password is a function in the NVMe protocol and is usually used to provide password protection for hard disks. The ATA Password function was originally designed for hard disks with the ATA interface protocol. With the widespread use and development of hard disks with the NVMe interface protocol, this function has also been applied to hard disks with the NVMe interface protocol. However, the NVMe protocol does not provide detailed instructions on how to set passwords, unlock, securely erase, query security status, etc. for NVMe SSDs. How to test the password function of hard disks with the NVMe interface protocol has become an urgent problem to be solved. For this, please refer to Figure 1 , an embodiment of the present application provides a password function testing method, the method comprising: steps S110~S140.
[0022] S110, parsing the preset protocol document to obtain the NVMe standard protocol command format.
[0023] In this embodiment, the preset protocol document includes: an ATA protocol document and an NVMe protocol document, and the NVMe standard protocol command format of ATA Password related operations is obtained by respectively parsing the ATA protocol document and the NVMe protocol document. Among them, the ATA Password related operations include multiple hard disk password commands.
[0024] S120, obtaining multiple hard disk password commands from the preset protocol document, and respectively packaging the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status.
[0025] In this embodiment, a plurality of hard disk password commands related to the hard disk password are extracted from a preset protocol document, wherein each hard disk password command is used to execute a different operation related to the hard disk password.
[0026] It can be understood that by packaging each hard disk password command group into the NVMe standard protocol command format, standardized processing of hard disk password commands is achieved, which improves the compatibility and reliability of subsequent operations while reducing the adverse effects caused by errors in command format and command parameter input.
[0027] In one implementation, the plurality of hard disk password commands include: a password setting command, an unlocking command, a freezing command, a disabling command, an erasing command, and a status query command.
[0028] It can be understood that the password setting command is used to set a password for the hard disk; the unlock command is used to unlock the hard disk; the freeze command is used to freeze all security operations except querying the security status; the disable command is used to disable the password function when the hard disk password function is enabled or enabled; the erase command is used to erase the hard disk password and user data at the same time when the hard disk password is configured or to erase user data when the hard disk password is not configured; the status query command is used to query the security status of the hard disk.
[0029] In one embodiment, before packaging each of the hard disk password commands according to the NVMe standard protocol command format, it also includes: determining command parameters corresponding to each of the hard disk password commands.
[0030] It can be understood that before the hard disk command is packaged according to the NVMe standard protocol command format, it is necessary to first determine at least one command parameter corresponding to each hard disk password command, wherein the command parameter defines the specific behavior of the hard disk password command.
[0031] S130, encapsulating a plurality of the standard test commands to obtain a plurality of state transition interfaces.
[0032] In this embodiment, each state conversion interface corresponds to a plurality of standard test commands. By calling different state conversion interfaces, different standard test commands are sent to the hard disk under test, so that the hard disk under test enters different safety states.
[0033] In one embodiment, the plurality of state conversion interfaces include: a first state conversion interface, a second state conversion interface, a third state conversion interface, a fourth state conversion interface, a fifth state conversion interface and a sixth state conversion interface, and each of the security states includes: a disabled state, a frozen disabled state, a power-off state, an unfrozen locked state, an unfrozen unlocked state and a frozen unlocked state; the calling of each of the state conversion interfaces to test each security state of the hard disk to be tested includes: calling the first state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the disabled state; calling the second state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the frozen disabled state; calling the third state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the power-off state; calling the fourth state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the unfrozen locked state; calling the fifth state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the unfrozen unlocked state; calling the sixth state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to the frozen unlocked state.
[0034] It can be understood that by calling different state transition interfaces, the hard disk under test can enter different security states. Figure 2 , Figure 2 The invention shows a flow chart of calling the first state conversion interface to test the disabled function of the hard disk to be tested, specifically: querying the first safety state of the hard disk to be tested through the state query command, and judging whether the first safety state is a frozen state; if it is the frozen state, controlling the hard disk to be tested to perform a power on and off operation; if it is not the frozen state, judging whether the first safety state is a disabled state; if it is not a disabled state, determining that the test is passed; if it is the disabled state, after executing the disable command, querying the second safety state of the hard disk to be tested through the state query command, and judging whether the second safety state is the disabled state (SEC1); if so, determining that the test is passed; if not, determining that the test is failed, and executing abnormal exit.
[0035] See also Figure 3 , Figure 3The invention shows a flow chart of calling the second state conversion interface to test the freeze disabled function of the hard disk to be tested, specifically: querying the first safety state of the hard disk to be tested through a state query command; judging whether the first safety state is a frozen state, and if it is the frozen state, controlling the hard disk to be tested to perform a power on and off operation; if it is not the frozen state, judging whether the first safety state is a locked state, and if it is the locked state, executing an unlock command, and judging whether the second safety state is an enabled state after querying the second safety state of the hard disk to be tested through the state query command; if it is not the locked state, directly judging whether the first safety state is a disabled state; if not, after executing the freeze command, querying the third safety state of the hard disk to be tested through the state query command; judging whether the hard disk to be tested is in a frozen disabled state (SEC2) according to the third safety state, and if so, determining that the test is passed; if not, determining that the test is failed, and executing abnormal exit.
[0036] See also Figure 4 , Figure 4 The present invention shows a flow chart of calling the fifth state transition interface to test the unlocking function of the hard disk to be tested. Specifically, the first security state of the hard disk to be tested is queried through the state query command, and it is determined whether the first security state is a disabled state (SEC1). If not, it is determined that the test fails and an abnormal exit is performed; if so, after executing the password setting command, the second security state of the hard disk to be tested is queried through the state query command again, and it is determined whether the second security state is an unlocked state (SEC5). If so, it is determined that the test passes. If not, it is determined that the test fails and an abnormal exit is performed. It should be noted that before querying the first security state of the hard disk to be tested through the state query command, it also includes: calling the test interface for configuring the disabled state (SEC1), that is, calling the first state transition interface to adjust the hard disk to be tested to the disabled state.
[0037] See also Figure 5 , Figure 5The present invention shows a flow chart of calling the fourth state transition interface to test the password setting function of the hard disk to be tested. Specifically, the first security state of the hard disk to be tested is queried through the state query command, and it is determined whether the first security state is an unlocked state (SEC5). If not, it is determined that the test fails and an abnormal exit is performed; if so, the hard disk to be tested is controlled to perform a power-on and power-off operation, and then the second security state of the hard disk to be tested is queried again through the state query command to determine whether the second security state is a locked state (SEC4). If so, it is determined that the test passes; if not, it is determined that the test fails and an abnormal exit is performed. It should be noted that before querying the first security state of the hard disk to be tested through the state query command, it also includes: calling the test interface for configuring the unlocked state (SEC5), that is, calling the fifth state transition interface to adjust the hard disk to be tested to the unlocked state.
[0038] See also Figure 6 , Figure 6 The present invention shows a flow chart of calling the sixth state interface to test the state query function of the hard disk to be tested. Specifically, the first safety state of the hard disk to be tested is queried through the state query command, and it is determined whether the first safety state is an unlocked state (SEC5). If not, it is determined that the test fails and an abnormal exit is performed; if so, after executing the freeze command, the second safety state of the hard disk to be tested is queried through the state query command again, and it is determined whether the second safety state is a frozen unlocked state (SEC6). If so, it is determined that the test passes; if not, it is determined that the test fails and an abnormal exit is performed. It should be noted that before querying the first safety state of the hard disk to be tested through the state query command, it also includes: calling the test interface for configuring the unlocked state (SEC5), that is, calling the fifth state conversion interface to adjust the hard disk to be tested to the unlocked state.
[0039] S140, calling each of the state conversion interfaces to test each security state of the hard disk to be tested, and obtaining a test result of each security state.
[0040] As described above, different state transition interfaces are used to adjust the hard disk under test to different security states. If after calling the corresponding state transition interface for adjustment, the state of the hard disk under test is the security state corresponding to the currently called state transition interface, then the current test is determined to have passed; if after the conversion, the state of the hard disk under test is not the security state corresponding to the currently called state transition interface, then the current test is determined to have failed.
[0041] In one embodiment, the calling of each state transition interface to test each security state of the hard disk to be tested includes: calling each state transition interface to adjust the hard disk ATA password security state of the hard disk to be tested; determining whether the adjusted hard disk to be tested is in the security state corresponding to the called state transition interface, and if so, determining that the test has passed; if not, determining that the test has failed.
[0042] In this embodiment, taking the first state conversion interface corresponding to the disabled state as an example, if the first state interface is called to adjust the hard disk to be tested, if the hard disk to be tested after adjustment is in the disabled state, it is determined that the current test has passed; conversely, if the hard disk to be tested after adjustment is in the enabled state, it is determined that the current test has failed.
[0043] In one embodiment, the method further includes: calling the fourth state conversion interface to adjust the hard disk to be tested to the unfrozen locked state, so as to provide password protection for the hard disk to be tested.
[0044] In this embodiment, the fourth state conversion interface is called to execute a plurality of standard test commands for encapsulating and obtaining the fourth conversion interface, so as to set a password for the hard disk to be tested.
[0045] In one embodiment, before calling the fourth state transition interface to adjust the hard disk under test to the unfrozen locked state, it also includes: calling the fifth state transition interface to adjust the hard disk under test to the unfrozen unlocked state; before calling the fifth state transition interface to adjust the hard disk under test to the unfrozen unlocked state, it also includes: calling the first state transition interface to adjust the hard disk under test to the disabled state.
[0046] In this embodiment, adjusting the hard disk to be tested to enter a locked state includes: first calling the first state interface to configure the security state of the hard disk to be tested to a disabled state, then calling the fifth state conversion interface to configure the hard disk to be tested to an unlocked state, and then calling the fourth state interface to configure the hard disk to be tested to a locked state.
[0047] The embodiment of the present application provides a hard disk ATA password function test method, which obtains the NVMe standard protocol command format by parsing a preset protocol document; obtains multiple hard disk password commands from the preset protocol document, and respectively packages each of the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; encapsulates multiple of the standard test commands to obtain multiple state transition interfaces; calls each of the state transition interfaces to test each security status of the hard disk to be tested, and obtains the test results of each security status. The present application improves the convenience of testing, reduces the labor cost during the testing process, and improves the testing efficiency by packaging and encapsulating the hard disk password commands.
[0048] Example 2 Also, see Figure 7 The embodiment of the present application provides a hard disk ATA password function testing device 700, comprising: The parsing module 710 is used to parse the preset protocol document to obtain the NVMe standard protocol command format; The package assembly module 720 is used to obtain multiple hard disk password commands from the preset protocol document, and respectively package the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; The encapsulation module 730 is used to encapsulate the plurality of standard test commands to obtain a plurality of state transition interfaces; The execution module 740 is used to call a target state transition interface from the plurality of state transition interfaces to adjust the hard disk to be tested to a target security state, so as to provide password protection for the hard disk to be tested.
[0049] The hard disk ATA password function testing device 700 provided in the embodiment of the present application is used to implement the hard disk ATA password function testing method described in the above-mentioned embodiment 1, and will not be described again here to avoid repetition.
[0050] The embodiment of the present application provides a method for testing the ATA password function of a hard disk. The parsing module parses the preset protocol document to obtain the NVMe standard protocol command format; the packaging module obtains multiple hard disk password commands from the preset protocol document, and packages each of the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; the encapsulation module encapsulates multiple of the standard test commands to obtain multiple state transition interfaces; the execution module calls each of the state transition interfaces to test each security status of the hard disk to be tested, and obtains the test results of each security status, thereby realizing the hard disk password function of the hard disk that tests the NVMe interface protocol. The present application improves the convenience of testing, reduces the labor cost during the testing process, and improves the testing efficiency by packaging and encapsulating the hard disk password command.
[0051] Example 3 In addition, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the hard disk ATA password function test method provided in embodiment 1 is executed.
[0052] For details, see Figure 8 The electronic device 800 includes: a transceiver 801, a bus interface and a processor 802, wherein the processor 802 is used to parse a preset protocol document to obtain an NVMe standard protocol command format; obtain multiple hard disk password commands from the preset protocol document, and respectively package each of the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; encapsulate multiple of the standard test commands to obtain multiple state transition interfaces; call each of the state transition interfaces to test each security status of the hard disk to be tested, and obtain test results of each security status.
[0053] In the embodiment of the present invention, the electronic device 800 further includes a memory 803. Figure 8In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 802 and memory represented by memory 803. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 801 may be a plurality of components, i.e., including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 802 is responsible for managing the bus architecture and general processing, and the memory 803 may store data used by the processor 802 when performing operations.
[0054] The electronic device 800 provided in the embodiment of the present invention can execute the hard disk ATA password function testing method provided in the above method embodiment 1, which will not be described again to avoid repetition.
[0055] Example 4 In addition, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the hard disk ATA password function testing method provided in Embodiment 1 is implemented.
[0056] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0057] The computer-readable storage medium provided in this embodiment can implement the hard disk ATA password function testing method provided in Embodiment 1, and will not be described again here to avoid repetition.
[0058] In all examples shown and described herein, any specific values should be interpreted as merely exemplary and not as limiting, and thus other examples of the exemplary embodiments may have different values.
[0059] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0060] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A method for testing the ATA password function of a hard disk, characterized in that: The method comprises: Parse the preset protocol document to obtain the NVMe standard protocol command format; Acquire multiple hard disk password commands from the preset protocol document, and respectively package the hard disk password commands according to the NVMe standard protocol command format to obtain multiple standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; Encapsulating a plurality of the standard test commands to obtain a plurality of state transition interfaces; Each of the state conversion interfaces is called to test each security state of the hard disk to be tested, and obtain the test results of each security state.
2. The hard disk ATA password function testing method according to claim 1, characterized in that: Before respectively packaging the hard disk password commands according to the NVMe standard protocol command format, the method further includes: The command parameters corresponding to each of the hard disk password commands are determined respectively.
3. The hard disk ATA password function testing method according to claim 2, characterized in that: The plurality of hard disk password commands include: a password setting command, an unlocking command, a freezing command, a disabling command, an erasing command and a status query command.
4. The hard disk ATA password function testing method according to claim 3, characterized in that: The multiple state conversion interfaces include: a first state conversion interface, a second state conversion interface, a third state conversion interface, a fourth state conversion interface, a fifth state conversion interface and a sixth state conversion interface, each of the security states includes: a disabled state, a frozen disabled state, a power-off state, an unfrozen locked state, an unfrozen unlocked state and a frozen unlocked state; each of the state conversion interfaces is called to test each security state of the hard disk to be tested, including: Calling the first state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to a disabled state; Calling the second state conversion interface to set the hard disk ATA password security state of the hard disk to be tested to a frozen disabled state; Calling the third state transition interface to set the hard disk ATA password security state of the hard disk to be tested to a power-off state; Calling the fourth state transition interface to set the hard disk ATA password security state of the hard disk to be tested to an unfrozen and locked state; Calling the fifth state transition interface to set the hard disk ATA password security state of the hard disk to be tested to an unfrozen and unlocked state; The sixth state transition interface is called to set the hard disk ATA password security state of the hard disk to be tested to a frozen unlock state.
5. The hard disk ATA password function testing method according to claim 4, characterized in that: The method further comprises: The fourth state conversion interface is called to adjust the hard disk to be tested to the unfrozen and locked state, so as to provide password protection for the hard disk to be tested.
6. The hard disk ATA password function testing method according to claim 5, characterized in that: Before calling the fourth state transition interface to adjust the hard disk to be tested to the unfrozen locked state, the method further includes: calling the fifth state transition interface to adjust the hard disk to be tested to the unfrozen unlocked state; Before calling the fifth state transition interface to adjust the hard disk to be tested to the unfrozen and unlocked state, the method further includes: calling the first state transition interface to adjust the hard disk to be tested to the disabled state.
7. The hard disk ATA password function testing method according to any one of claims 1 to 6, characterized in that: The calling of each state conversion interface to test each security state of the hard disk to be tested includes: respectively calling the state conversion interfaces to adjust the hard disk ATA password security state of the hard disk to be tested; It is determined whether the hard disk to be tested after adjustment is in the safe state corresponding to the called state transition interface. If so, it is determined that the test is passed; if not, it is determined that the test is failed.
8. A hard disk ATA password function test device, characterized in that: The device comprises: The parsing module is used to parse the preset protocol document and obtain the NVMe standard protocol command format; A package assembly module, used for obtaining a plurality of hard disk password commands from the preset protocol document, and respectively assembling the hard disk password commands according to the NVMe standard protocol command format to obtain a plurality of standard test commands, wherein the hard disk password command is a command for performing security management operations on the hard disk ATA password security status; An encapsulation module, used for encapsulating a plurality of the standard test commands to obtain a plurality of state transition interfaces; The execution module is used to call a target state transition interface from the plurality of state transition interfaces to adjust the hard disk to be tested to a target security state, so as to provide password protection for the hard disk to be tested.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is run on the processor, the hard disk ATA password function testing method according to any one of claims 1 to 7 is executed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the hard disk ATA password function testing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Solid state disk password test method and device based on Driver Master
CN110427326A
Solid state disk encryption method and device, readable storage medium and electronic equipment
CN113761599A
Data access techniques
CN115705303A
Test method and system of storage device and electronic device
CN117271299A
Hard drive Anti-theft protection
US20240211642A1
Cited By
TCG protocol function test method and device, readable storage medium and electronic equipment
CN121237166A