Resource allocation device, apparatus and storage medium

By employing a shared counter design in the integrity tree and dynamically adjusting the storage resources of the sub-counters, the counter overflow problem is solved, and the performance of data integrity verification is improved.

CN116171443BActive Publication Date: 2026-03-13HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

The counters in the existing integrity tree are prone to overflow, resulting in poor data integrity verification performance.

Method used

By adopting a shared counter design, the storage resources of the sub-counters are dynamically adjusted to prevent counter overflow and improve the utilization of storage resources.

Benefits of technology

It effectively prevents counter overflow and improves the performance of data integrity verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116171443B_ABST
    Figure CN116171443B_ABST
Patent Text Reader

Abstract

A resource allocation method, apparatus, and storage medium are disclosed. The method includes: in response to a write request for a target data block, obtaining the value of a first sub-counter corresponding to the target data block in an integrity tree (S101), wherein the first sub-counter is a sub-counter of a first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter; when it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, allocating a second storage resource to the first sub-counter (S102). This method enables dynamic adjustment of the storage resource of the first shared counter, improves the utilization rate of the storage resource of the first shared counter, increases the storage resource of the adjusted first sub-counter, thereby preventing the first sub-counter from overflowing, and thus improving the data integrity verification performance of the integrity tree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer security technology, and in particular to a resource allocation device, apparatus and storage medium. Background Technology

[0002] Data integrity is one of the three fundamental elements of information security. It refers to ensuring that information or data is not tampered with without authorization or that any tampering can be detected quickly during the transmission, storage, and processing of information or data.

[0003] To prevent data tampering, Intel's Software Guard Extensions (SGX) architecture introduces the concept of an Integrity Tree. The Integrity Tree protects the integrity of memory data, safeguarding it from replay attacks. The leaf layer counters protect Dynamic Random Access Memory (DRAM) data, while the intermediate layer counters protect the data in the next layer. Each time data is written to DRAM, the corresponding counter value is changed. During subsequent data reads, the integrity of the read data is verified based on the counter value.

[0004] During the data integrity verification process, it was found that the counters in the current integrity tree are prone to overflow, resulting in poor performance of data integrity verification. Summary of the Invention

[0005] This application provides a resource allocation device, apparatus, and storage medium to prevent frequent overflow of counters in integrity verification, thereby improving the performance of data integrity verification of the complete tree.

[0006] In a first aspect, embodiments of this application provide a resource allocation method, comprising: responding to a write request for a target data block, obtaining the value of a first sub-counter corresponding to the target data block in an integrity tree, wherein the first sub-counter is a sub-counter of a first shared counter, the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter, and the first shared counter is a shared counter of a leaf node corresponding to the target data block in the integrity tree; when it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, allocating a second storage resource to the first sub-counter, wherein the second storage resource belongs to the storage resource of the first shared counter, and the first value is a positive integer.

[0007] In this embodiment, the first sub-counter is a sub-counter of the first shared counter. The first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. When the processor detects that the value of the first sub-counter after increasing by a first value is greater than the maximum storage value of the first storage resource, it allocates the second storage resource of the storage resource of the first shared counter to the first sub-counter. This realizes the dynamic adjustment of the storage resource of the first shared counter, improves the utilization rate of the storage resource of the first shared counter, increases the storage resource of the adjusted first sub-counter, prevents the first sub-counter from overflowing, and thus improves the data integrity verification performance of the integrity tree.

[0008] Optionally, the first value mentioned above is 1.

[0009] In some embodiments, the first shared counter further includes a second sub-counter, the third storage resource of the second sub-counter belongs to the storage resource of the first shared counter, and the second storage resource includes unused free storage resources in the third storage resource.

[0010] In some embodiments, the first shared counter further includes a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter.

[0011] In some embodiments, the above-mentioned response to a write request for a target data block, obtaining the value of the first sub-counter corresponding to the target data block in the integrity tree, includes: responding to a write request for the target data block, obtaining a first shared counter; obtaining a first resource partition identifier from the first shared counter; obtaining a first storage resource based on the first resource partition identifier and a preset correspondence between the resource partition identifier and the storage resource; and parsing the value of the first sub-counter from the first shared counter based on the first storage resource, thereby achieving accurate parsing of the value of the first sub-counter.

[0012] In some embodiments, allocating the second storage resource to the first sub-counter includes: obtaining the storage resource corresponding to the second resource partitioning identifier based on the first storage resource and a preset correspondence between resource partitioning identifiers and storage resources, wherein the storage resource corresponding to the second resource partitioning identifier is greater than the first storage resource; determining the size of the second storage resource based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource; obtaining the second storage resource from unused free storage resources in the third storage resource based on the size of the second storage resource, and allocating the obtained second storage resource to the first sub-counter to increase the storage resource of the first counter.

[0013] In some embodiments, when the processor allocates the second storage resource to the first sub-counter, it needs to increment the value of the first sub-counter by a first value; and determine the message authentication code (MAC) value of the target data block based on the incremented value of the first sub-counter.

[0014] In one example, allocating the second storage resource to the first sub-counter as described above includes:

[0015] When an unused free storage resource is detected in the third storage resource, the second storage resource in the unused free storage resource is allocated to the first sub-counter.

[0016] In this embodiment of the application, when it is detected that there is no unused free storage resource in the third storage resource, the overflow counter of the first node where the first shared counter is located is incremented by a second value, and the values ​​of the first sub-counter and the second sub-counter are both set to a third value, where the second value is a positive integer and the third value is a positive number.

[0017] Optionally, the second value is 1 and the third value is 0.

[0018] In this case, the method of this application embodiment further includes: when the values ​​of the first counter and the second sub-counter are set to a third value, the values ​​of all counters in the first node except the overflow counter are set to the third value.

[0019] In some embodiments, the storage addresses of data blocks corresponding to two adjacent sub-counters in the first shared counter differ by a preset value in the storage device.

[0020] Secondly, embodiments of this application provide a resource allocation device, the device including a processor:

[0021] The processor, in response to a write request for a target data block, obtains the value of a first sub-counter corresponding to the target data block in the integrity tree. The first sub-counter is a sub-counter of a first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. The first shared counter is a shared counter of the leaf node corresponding to the target data block in the integrity tree. When it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, a second storage resource is allocated to the first sub-counter. The second storage resource belongs to the storage resource of the first shared counter, and the first value is a positive integer.

[0022] In some embodiments, the first shared counter further includes a second sub-counter, the third storage resource of the second sub-counter belongs to the storage resource of the first shared counter, and the second storage resource includes unused free storage resources in the third storage resource.

[0023] In some embodiments, the first shared counter further includes a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter.

[0024] In some embodiments, the processor is specifically configured to, in response to a write request for a target data block, obtain a first shared counter; obtain a first resource partition identifier from the first shared counter; obtain a first storage resource based on the first resource partition identifier and a preset correspondence between the resource partition identifier and the storage resource; and parse the value of a first sub-counter from the first shared counter based on the first storage resource.

[0025] In some embodiments, the processor is specifically configured to: obtain the storage resource corresponding to the second resource partition identifier based on the first storage resource and a preset correspondence between the resource partition identifier and the storage resource, wherein the storage resource corresponding to the second resource partition identifier is greater than the first storage resource; determine the size of the second storage resource based on the size of the storage resource corresponding to the second resource partition identifier and the size of the first storage resource; and obtain the second storage resource from the unused free storage resources in the third storage resource based on the size of the second storage resource, and allocate the obtained second storage resource to the first sub-counter.

[0026] In some embodiments, the processor is further configured to increment the value of the first sub-counter by a first value when the second storage resource is allocated to the first sub-counter; and to determine the message authentication code (MAC) value of the target data block based on the incremented value of the first sub-counter.

[0027] In some embodiments, the processor is further configured to allocate the second storage resource in the unused free storage resource to the first sub-counter when it is detected that there is an unused free storage resource in the storage resources of the second sub-counter.

[0028] In some embodiments, the above-described apparatus further includes:

[0029] The processor is further configured to, when it is detected that there are no unused free storage resources in the storage resources of the second sub-counter and there are no unallocated free storage resources in the first shared counter, add a second value to the overflow counter of the first node where the first shared counter is located, and set the values ​​of both the first sub-counter and the second sub-counter to a third value, wherein the second value is a positive integer and the third value is a positive number.

[0030] In some embodiments, the above-described apparatus further includes:

[0031] When the values ​​of the first counter and the second sub-counter are set to the third value, the values ​​of all other counters in the first node except the overflow counter are also set to the third value.

[0032] In some embodiments, the storage addresses of data blocks corresponding to two adjacent sub-counters in the first shared counter differ by a preset value in the storage device.

[0033] The beneficial effects of the resource allocation apparatus provided by the second aspect and the various possible implementations of the second aspect can be seen from the beneficial effects of the first aspect and the various possible implementations of the first aspect, and will not be repeated here.

[0034] Thirdly, embodiments of this application provide a computer storage medium including computer instructions that, when executed by a computer, cause the computer to implement the resource allocation method as described in any of the first aspects.

[0035] Fourthly, embodiments of this application provide a computer program product, the program product including a computer program stored in a readable storage medium, at least one processor of a communication device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the communication device to implement any of the resource allocation methods described in the first aspect.

[0036] The resource allocation device, apparatus, and storage medium provided in this application embodiment, in response to a write request for a target data block, obtain the value of a first sub-counter corresponding to the target data block in the integrity tree. The first sub-counter is a sub-counter of a first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. When it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, a second storage resource is allocated to the first sub-counter. This realizes the dynamic adjustment of the storage resource of the first shared counter, improves the utilization rate of the storage resource of the first shared counter, increases the storage resource of the adjusted first sub-counter, and prevents the first sub-counter from overflowing, thereby improving the data integrity verification performance of the integrity tree. Attached Figure Description

[0037] Figure 1 This is a schematic diagram of the structure of a computer system stack according to an embodiment of this application;

[0038] Figure 2 This is a schematic diagram of the structure of an integrity tree according to an embodiment of this application;

[0039] Figure 3 This is a schematic diagram illustrating a label determination method according to an embodiment of this application;

[0040] Figure 4 This is a schematic diagram illustrating another label determination method according to an embodiment of this application;

[0041] Figure 5 This is a schematic diagram of another data structure for a counter integrity tree according to an embodiment of this application;

[0042] Figure 6 A schematic diagram of a data structure for a node in an integrity tree;

[0043] Figure 7 This is a schematic diagram of a computing system with an integrity protection mechanism involved in an embodiment of this application;

[0044] Figure 8 This is a schematic diagram of the resource allocation method provided in the embodiments of this application;

[0045] Figure 9 This is a schematic diagram of a structure of the integrity tree involved in an embodiment of this application;

[0046] Figure 10 This is a schematic diagram of a shared counter.

[0047] Figure 11 This is another structural schematic diagram of a shared counter involved in an embodiment of this application;

[0048] Figure 12 This is another schematic diagram of a shared counter involved in an embodiment of this application;

[0049] Figure 13 This is another structural schematic diagram of a shared counter involved in an embodiment of this application;

[0050] Figure 14 This is a schematic diagram illustrating the resource allocation of the shared counter involved in an embodiment of this application;

[0051] Figure 15 This is a schematic diagram illustrating the resource allocation of the shared counter involved in an embodiment of this application;

[0052] Figure 16 This is another structural diagram of the integrity tree involved in the embodiments of this application;

[0053] Figure 17 This is another structural diagram of the integrity tree involved in the embodiments of this application;

[0054] Figure 18 Another flowchart illustrating the resource partitioning method provided in this application embodiment;

[0055] Figure 19 This is a schematic diagram of the structure of a resource allocation device provided in an embodiment of this application. Detailed Implementation

[0056] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0057] It should be understood that in the embodiments of this application, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information. The term "multiple" in this document refers to two or more. The term "and / or" in this document is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, the character " / " in this document generally indicates that the related objects before and after are in an "or" relationship; in formulas, the character " / " indicates that the related objects before and after are in a "division" relationship.

[0058] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention distinguish between identical or similar items that have substantially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or order of execution, and that "first," "second," etc., do not necessarily imply differences.

[0059] Figure 1 This is a schematic diagram of the structure of a computer system stack according to an embodiment of this application, such as... Figure 1 As shown, this computer system stack includes a software side and a hardware side. The software side includes: Untrusted App, Enclave data, and Operating System Kernel. The hardware side includes: Processor, DRAM, and Flash Memory (Disk).

[0060] Big data and cloud computing have made information processing more centralized and efficient. Cloud providers offer cloud tenants massive computing power, freeing them from tasks such as hardware and network maintenance and expansion. However, this also brings security challenges: all of a cloud tenant's data is completely exposed to the cloud provider. Malicious cloud providers, or their employees, can easily steal and tamper with this data. This discourages cloud tenants from uploading confidential data to the cloud, hindering the development of cloud computing.

[0061] In the SGX architecture, cloud tenants trust only the processor (e.g., an Intel CPU), not the cloud provider. The cloud tenant's applications run in an isolated operating mode (called an Enclave). The cloud provider cannot read or tamper with the enclave data, either through software or hardware. Figure 1In this context, untrusted applications, operating system kernels, DRAM, and flash memory are untrusted; the Enclave and processor are trusted. Regarding software, the cloud provider's software (including operating system, drivers, and software libraries) is isolated from the Enclave and cannot read or write Enclave data. Regarding hardware, Enclave data is encrypted and stored in memory and on hard drives, and is only decrypted within the processor. Due to the complexity and high density of processor circuitry, it is generally difficult for cloud providers to physically access the processor to obtain data.

[0062] Encryption can prevent data theft, but it cannot prevent data tampering. To prevent tampering, the processor needs to perform data integrity verification. The technical solution provided in this application embodiment is used for data integrity verification.

[0063] To facilitate understanding of the embodiments of this application, the relevant concepts involved in the embodiments of this application will be briefly introduced as follows:

[0064] Data integrity is one of the three fundamental elements of information security. It refers to ensuring that information or data is not tampered with without authorization or that any tampering can be detected quickly during the transmission, storage, and processing of information or data.

[0065] A replay attack refers to an attacker recording data and MAC values ​​at time point T1, and then replaying the data and MAC values ​​recorded at time point T1 at time point T2, attempting to tamper with the data at time point T2 and change it to the data at time point T1.

[0066] The branching factor (Fanout), also known as fan-out, describes how many child nodes a node has in a tree structure.

[0067] A cache is a storage unit that is faster than memory. This patent involves two types of caches: data caches (L1, L2, L3) and integrity tree node caches.

[0068] A cache line is a unit of memory access that the CPU reads and writes to, typically 64 bytes in size.

[0069] Nonce is an abbreviation for Number used once, a number that can only be used once in encrypted communication to prevent replay attacks.

[0070] Counter: To prevent replay attacks, a counter is introduced. The counter is incremented each time memory is written, ensuring that the data written is different each time. In this application, the Counter in the Merkle Tree is used as a Nonce.

[0071] A data block is the basic data unit for memory integrity protection.

[0072] An integrity tree is a data structure used to protect memory integrity. It is a tree-like structure composed of multiple integrity tree nodes. Its key feature is its ability to quickly verify the integrity of local data, and it is widely used in scenarios including Bitcoin and Android phone system partitions. A Merkle tree is a typical example of an integrity tree.

[0073] There are many variations of integrity trees. Below, we introduce a common type of integrity tree.

[0074] Figure 2 This is a schematic diagram of a completeness tree structure according to an embodiment of this application. Figure 2 As shown, this integrity tree consists of 4 levels, with each level connected by specific dependencies. The branching factor is 8, meaning each node has 8 child nodes. It should be noted that... Figure 2 This is just one example; the number of levels in the integrity tree is not limited to this. Figure 2 The number of layers can be more than four or less, and the molecular factor is not limited to eight; for example, it can be more than eight or less than eight. Figure 2 As shown, n30 is one of the eight root nodes, and n20, n21, ..., n27 are the eight child nodes of root node n30, located in layer 2. Each of the eight nodes n20, n21, ..., n27 consists of eight counters. For example, node n20 includes eight counters from n200 to n207, and node n27 includes eight counters from n270 to n277. n10, n11, ..., n17 are the eight child nodes of node n20, located in layer 1. Each of the eight nodes n10, n11, ..., n17 consists of eight counters. For example, node n10 includes eight counters from n100 to n107, and node n17 includes eight counters from n170 to n177. n00, n01, ..., n07 are the eight child nodes of node n10, also known as leaf nodes, located in layer 0. Each node in n00, n01, ..., n07 consists of eight counters. For example, node n00 includes eight counters n000 to n007, and node n07 includes eight counters n070 to n077. The memory's storage area is divided into multiple data blocks. Each counter in the leaf node corresponds to one data block. For example, counter n000 in leaf node n00 corresponds to data block 0 and is used to maintain the integrity of the data in data block 0; counter n001 in leaf node n00 corresponds to data block 1 and is used to maintain the integrity of the data in data block 1; counter n007 in leaf node n00 corresponds to data block 7 and is used to maintain the integrity of the data in data block 7.

[0075] Depend on Figure 2 As can be seen, each child node includes 8 counters and a tag (Tag, abbreviated as T), which can be understood as a nonce. Figure 3 and Figure 4 The process of determining the value of a label is shown, specifically, by... Figure 2 It can be seen that a node corresponds to a counter in its parent node. Therefore, based on the value of the counter corresponding to that node in its parent node and the values ​​of all counters in that node, the label of that node can be determined through a pre-defined calculation rule. For example... Figure 2 As shown, node n00 corresponds to counter n100 in its parent node n10, thus... Figure 3 As shown, the value of the label T of node n00 can be obtained based on the value of counter n100 and the values ​​of counters n000 to n007 in node n10, according to a preset calculation rule. Figure 2 As shown, each data block also corresponds to a label T. The process of determining the label value of a data block is similar to the process of determining the label value of a node. Specifically, a data block corresponds to a counter in a leaf node, for example... Figure 2 Data block 7 in the middle corresponds to counter n007 in leaf node n00. This allows the label value of the data block to be determined based on the counter value and the data within that data block, using a preset calculation rule. For example... Figure 4 As shown, based on the data stored in data block 7 and the value of counter n007 corresponding to data block 7, the value of tag T7 corresponding to data block 7 is obtained through preset calculation rules.

[0076] Optionally, the operation used to determine the label can be a hash operation or a MAC operation, that is, the label value can be a MAC value.

[0077] Figure 5 This is a schematic diagram of another counter integrity tree data structure involved in an embodiment of this application, as shown below. Figure 5As shown, this integrity tree consists of 5 levels. Assuming each node's label is a Message Authentication Code (MAC), taking the root node b33 as an example, the root counter corresponding to root node b33 is root counter 11. Root node b33 includes 8 counters and MAC10. The 8 counters are denoted as C0 to C7 respectively. MAC10 is calculated using the MAC function based on the values ​​of root counter 11 and the 8 counters C0 to C7 of root node b33. The 8 counters of root node b33 correspond one-to-one with the 8 child nodes b20 to b27 of root node b33. For example, node b20 corresponds to counter C0 of root node b33, node b21 corresponds to counter C1 of root node b33, and so on, with node b27 corresponding to counter C7 of root node b33. Each child node from b20 to b27 includes eight counters and one MAC. For example, child node b20 includes eight counters C00 to C07 and MAC20, where MAC20 is calculated using the MAC function based on the root node b33's counter C0 and the eight counters C00 to C07 of child node b20. Similarly, the MAC27 of child node b27 is calculated using the MAC function based on the root node b33's counter C7 and the eight counters C70 to C77 of child node b27. Similarly, the MAC30 of child node b10 is calculated using the MAC function based on the counter C00 of node b20 and the eight counters C000 to C007 of node b10; the MAC37 of child node b17 is calculated using the MAC function based on the counter C07 of node b20 and the eight counters C070 to C077 of node b17; the MAC40 of child node b00 is calculated using the MAC function based on the counter C000 of node b10 and the eight counters C0000 to C0007 of node b00; and the MAC47 of child node b07 is calculated using the MAC function based on the counter C007 of node b10 and the eight counters C0070 to C0077 of node b07.

[0078] Similarly, for the eight leaf nodes v0 to v7 of child node b00, each leaf node includes eight counters and one MAC. Taking leaf node v0 as an example, leaf node v0 includes eight counters C00000 to C00007 and MAC50. MAC50 is calculated using the MAC function based on the counter C0000 of child node b00 and the eight counters C00000 to C00007 of leaf node v0. The eight counters of leaf node v0 correspond to eight data blocks in memory, and each data block corresponds to one MAC. For example, MAC60 of data block 70 is calculated using the MAC function based on counter C00000 and the data 000 in data block 70, and MAC67 of data block 77 is calculated using the MAC function based on counter C00007 and the data 007 in data block 77. It should be noted that the label T and MAC mentioned above can both be understood as Nonce.

[0079] Depend on Figure 5 It can be seen that the MAC used to verify the integrity of data in a data block is maintained by its corresponding leaf node, while the MAC used to verify the integrity of a leaf node is maintained by its parent node, and the integrity of the parent node itself can be maintained by other parent nodes in the tree, and so on, until the root node.

[0080] During the data writing process, such as Figure 5 As shown, each time data is written to a data block, the corresponding counter in the integrity tree is incremented or updated. For example, when data is written to data block 70 and the data in data block 70 is updated, the counter C00000 in the leaf node v0 corresponding to data block 70 is incremented, for example, by 1. The incrementing of the counter C00000 in leaf node v0 will trigger the recalculation of the MAC of leaf node v0.

[0081] During the data reading process, such as Figure 5As shown, for example, when reading data 000 from data block 70, in order to verify the integrity of data 000 in data block 70, the MAC60 of data block 70 is verified. Specifically, the counter C00000 in leaf node v0 is read, and the value 1 is calculated using the MAC function based on the value of counter C00000 and data 000. The calculated value 1 is then matched with the value 2 of MAC60 stored in data block 70. If the stored value 2 does not match the calculated value 1, it indicates that data 000 has been tampered with. If the stored value 2 matches the calculated value 1, the integrity of leaf node v0 is verified. Specifically, the parent node of leaf node v0 (i.e., node b00) is read. Based on the value of the counter (i.e., counter C0000) corresponding to leaf node v0 in node b00 and the values ​​of the eight counters of leaf node v0, the calculated MAC of leaf node v0 is calculated using the MAC function. The calculated MAC of leaf node v0 is then matched with its stored MAC. If the stored MAC of leaf node v0 does not match its calculated MAC, it indicates that leaf node v0 has been tampered with, and the integrity verification of data 000 fails. If the stored MAC of leaf node v0 matches its calculated MAC, the integrity of the parent node of leaf node v0 (i.e., node b00) is verified. This process continues until the root node b33 is verified. If the stored MAC of root node b33 matches its calculated MAC, it indicates that data 000 has not been tampered with.

[0082] It should be noted that the above Figure 5 This shows that the labels of the data blocks and their corresponding data storage are in the same cache line, optionally, such as Figure 2 The labels of the data blocks shown can be stored separately from the corresponding data.

[0083] Each node in the integrity tree stores its MAC address and multiple counters in the same cache line to ensure the integrity of that node. Figure 5 The MAC addresses of a node are stored together, optionally, for example. Figure 6 As shown, Figure 6 This is a schematic diagram of a data structure for a node in an integrity tree. A node's MAC address can be stored separately; that is, the node's MAC address can be divided into multiple parts for separate storage. For example, the node's MAC address can be divided into 8 equal parts, each corresponding to one of the node's 8 counters, with each counter occupying 56 bits. For example... Figure 6 The diagram shows a MAC size of 56 bits, divided into 8 equal parts, each 8 bits long. Of these 8 bits, 7 bits are used and 1 bit is unused. Optionally, the MAC size may include, but is not limited to, 56 bits, and the MAC may not be divided into equal parts during partitioning.

[0084] Optional, Figure 5 The MAC function can be a one-way cryptographic function such as AES-GCM or SHA-256.

[0085] As mentioned above, each data block corresponds to a counter. Each time data is written to a data block, the corresponding counter increments by 1. In practical applications, the processor accesses different data blocks at different frequencies. For example, the number of times data is written to data block 1 is higher than the number of times data is written to data block 2. This makes the storage resource requirement for the counter of data block 1 higher than that of data block 2. For instance, the counter corresponding to data block 1 needs 30 bits of storage resources to record the number of write operations to data block 1 without overflowing, while the counter corresponding to data block 2 only needs 10 bits of storage resources to record the number of write operations to data block 2. However, in the current integrity tree, the storage resources for the counters corresponding to different data blocks are the same. For example... Figure 5 In this system, each counter has a storage resource of 50 bits. This can cause the counters for data blocks with high access frequency to overflow, while the storage resources for the counters for data blocks with low access frequency are wasted, resulting in poor performance of data integrity verification.

[0086] To address the aforementioned technical problems, this application embodiment establishes a shared counter comprising at least two sub-counters. These at least two sub-counters share the storage resources of the shared counter, and the size of the shared storage resources for each sub-counter can be dynamically adjusted based on the access patterns of data blocks. For example, if sub-counter 1 initially occupies 30 bits of storage resources within its shared counter, and if a higher access frequency is detected in sub-counter 1 in a second instance, its storage resources can be adjusted from 30 bits to 40 bits. This achieves dynamic adjustment of the storage resources for each sub-counter, reduces the overflow probability of counters corresponding to frequently accessed data blocks, improves the utilization rate of counter storage resources, and enhances the performance of data integrity verification.

[0087] The technical solutions of the embodiments of this application will be described in detail below through some examples. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0088] First, combine Figure 7 The computer systems involved in the embodiments of this application will be described in detail.

[0089] Figure 7 This is a schematic diagram of a computing system with an integrity protection mechanism involved in an embodiment of this application, such as... Figure 7As shown, the computer system includes a processor and DRAM (main memory). The processor is trusted, while the DRAM is untrusted. This means the data in the processor cannot be attacked or tampered with by an attacker; therefore, the edge of the processor can be considered the trust boundary. However, the data in the DRAM can be arbitrarily attacked or tampered with by an attacker. For example, data in main memory or data through the physical channel between main memory and the processor may be intercepted or modified. The processor and main memory are connected via a bus, for example, a bus communication connection. To prevent attackers from reading the data in the DRAM, the data in the DRAM needs to be encrypted, preventing attackers from reading it. Furthermore, to prevent attackers from performing replay attacks on the data in the DRAM to tamper with the data, data integrity verification is required every time data is read from the DRAM.

[0090] like Figure 7 As shown, the processor includes: a computing core (such as a CPU core), a first cache, a Merkletree root node, a Memory Integrity Controller, and a Merkle tree cache.

[0091] The first cache may include multiple levels of cache, such as L1, L2, and L3. This first cache is used to cache data, for example, data read from main memory. The data in the first cache is data that has passed integrity verification. Thus, during the process of reading target data, the processor first queries the first cache. Specifically, the processor searches for the target data in the L1 cache. If the target data is not found in the L1 cache, it searches in the L2 cache, and if it is not found in the L2 cache, it searches in the L3 cache. If the processor finds the target data in the first cache, it directly returns the retrieved data. If the processor does not find the target data in the first cache, it reads the target data from main memory and performs integrity verification on it.

[0092] The root node of the integrity tree is the root of the integrity tree. It contains private data that cannot be tampered with externally. It is stored in the processor to prevent attackers from reading or tampering with the root node, thereby ensuring the reliability and accuracy of data integrity verification.

[0093] Integrity Tree Caching: In general-purpose systems, the child node data of the integrity tree is often stored in main memory, which is relatively slow. Integrity tree caching can cache recently accessed integrity tree data, speeding up access and improving performance. In other words, the integrity tree cache stores one or more child nodes of the integrity tree read during the last integrity verification. During the current integrity verification, to improve speed, the processor first queries the integrity tree cache for the required child node, for example, node 1. If node 1 is found in the integrity tree cache, it is used directly for integrity verification without needing to read it from main memory, thus improving the speed of integrity verification. Furthermore, since the processor is trusted, the integrity tree nodes stored in the integrity tree cache are also trusted and cannot be tampered with by attackers. Therefore, there is no need to perform integrity verification on the cached nodes, further improving the speed of integrity verification. Figure 5 As shown, for example, the integrity tree cache contains leaf node v00, node b16, and node b22. The processor reads data 000 and its corresponding MAC 60 from data block 70 in main memory, and then performs integrity verification on data 000. Based on the correspondence between data blocks and leaf nodes, the processor determines that data block 70 corresponds to leaf node v00. Next, the processor checks the integrity tree cache to see if leaf node v00 is cached. If leaf node v00 is found in the integrity tree cache, it uses the counters C00000 to C00007 of leaf node v00 and the read data 000 to calculate the MAC corresponding to data 000 using the MAC function, denoted as MAC6. The processor matches the calculated MAC6 with the MAC60 read from main memory. If MAC6 matches MAC60, it means that data 000 has not been tampered with, the integrity verification is successful, and there is no need to perform integrity verification on leaf node v00 again. If the processor does not find leaf node v00 in the integrity tree cache, the processor reads leaf node v00 from main memory. According to the above method, it checks whether the calculated MAC6 matches the MAC60 read from main memory. If they match, it reads the parent node of leaf node v00 from main memory to verify the integrity of leaf node v00. This process continues until the root node is reached.

[0094] Optionally, in some embodiments, the processor further includes a memory encryption engine (MEE), which is used to encrypt plaintext according to a counter and to decrypt ciphertext read from main memory. This prevents malicious observers from reading data in main memory. The encryption keys used for encryption and decryption can be stored in the processor, for example, in a register within the processor. This application does not limit the encryption or decryption methods used by the encryption engine.

[0095] Continue to refer to Figure 7 As shown, DRAM includes: a memory protection region, a Merkle Tree data region, and a non-memory protection region (Normal Region).

[0096] The memory protection region refers to the memory area in main memory that is protected for integrity. In this embodiment, the data blocks refer to the data blocks corresponding to the memory protection region.

[0097] Non-memory protected area: A memory area in main memory that is not fully protected.

[0098] Integrity tree data: Data used to protect the integrity tree of main memory. This data is usually stored in main memory, but it can also be stored in other storage components, such as the CPU chip.

[0099] Optionally, the main memory includes ciphertext data, where the ciphertext data is data encrypted by an encryption engine. For example, the processor controls the encryption engine to encrypt plaintext data to obtain ciphertext data, which is then stored in the main memory. An attacker cannot decrypt this ciphertext data, thus preventing malicious observers from reading data in the main memory.

[0100] Optionally, the main memory also includes plaintext data, which is unencrypted data that can be read arbitrarily by an attacker. Optionally, this plaintext data is stored in a non-memory-protected area of ​​the main memory.

[0101] During the data reading process, the processor first checks if the target data to be read is cached in the first cache. If the target data is cached in the first cache, it is read directly from the first cache. If the target data is not found in the first cache, it is read from main memory. Specifically, the encrypted data of the target data is read from the memory protection area of ​​main memory, decrypted, and then placed into the first cache.

[0102] To verify the integrity of the target data, the processor checks the integrity tree cache for a corresponding integrity tree node. If it exists, the processor uses that node to verify the data's integrity. If the processor does not find the node in the cache, it reads it from main memory (e.g., node 1) and uses it to calculate the target data's MAC. If the calculated MAC matches the stored MAC, the processor continues verifying node 1's integrity, and so on, until the root node is verified.

[0103] When writing data, the computing core writes the target data into the corresponding data block in the memory protection area, and at the same time updates the value of the counter and the MAC value corresponding to the data block.

[0104] In the above Figure 7 Based on the computer system shown, combined with Figure 8 The resource allocation method provided in the embodiments of this application will be described in detail.

[0105] Figure 8 This is a schematic diagram of the resource allocation method provided in the embodiments of this application, such as... Figure 8 As shown, the apparatus in this application embodiment includes:

[0106] S101. In response to a write request for the target data block, obtain the value of the first sub-counter corresponding to the target data block in the integrity tree.

[0107] Among them, the first sub-counter is a sub-counter of the first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter.

[0108] Figure 9 This is a schematic diagram of a completeness tree structure involved in an embodiment of this application. The following structure... Figure 9 The integrity tree involved in the embodiments of this application will be described in detail.

[0109] like Figure 9 As shown, the integrity tree in this embodiment replaces the traditional fixed-width integrity tree counter with a dynamically adjustable width counter. Here, the width can be understood as the counter's storage resource. Specifically, a shared counter includes two or more sub-counters, and these two or more sub-counters share the shared counter's storage resource. For example... Figure 9 The diagram illustrates a node comprising multiple shared counters, for example, a node with eight shared counters. Each shared counter can be shared by multiple child counters, and the allocation of storage resources for the shared counters can be dynamically adjusted according to the needs of the child counters. Each child counter in a leaf node corresponds to a data block.

[0110] Figure 10 Here is a schematic diagram of a shared counter, as shown below. Figure 10As shown, the shared counter includes n sub-counters, which share the storage resources of the shared counter. For example, if the shared counter has 50 bits of storage resources, then these n sub-counters share these 50 bits of storage resources. Assuming n is 2, these two sub-counters are denoted as sub-counter 1 and sub-counter 2, where sub-counter 1 occupies 12 bits of the 50 bits of storage resources of the shared counter, and sub-counter 2 occupies 35 bits of the 50 bits of storage resources of the shared counter.

[0111] During the data writing process, the processor receives a write request for the target data block, which requests that data be written to the target data block. After receiving the write request for the target data block, the processor node obtains the value of the first sub-counter corresponding to the target data block in the integrity tree. For example, suppose the target data block is... Figure 9 In data block 0, when the processor receives a write request for the target data block, it obtains the value of the first sub-counter corresponding to the target data block. Assume that the value of the first sub-counter is 111111111111.

[0112] S102. When the value of the first sub-counter is detected to increase by a first value and exceed the maximum storage value of the first storage resource, the second storage resource is allocated to the first sub-counter.

[0113] The second storage resource also belongs to the storage resource of the first shared counter.

[0114] For example, suppose the first shared counter includes two sub-counters, namely the first sub-counter and the second sub-counter. The first sub-counter and the second sub-counter share the storage resources of the first shared counter, that is, the storage resources of the first sub-counter and the second sub-counter both belong to the storage resources of the first shared counter, and the storage resources of the first sub-counter do not overlap with the storage resources of the second sub-counter. There are m ways to allocate the storage resources of the first shared counter, where m is a positive integer greater than or equal to 2, as shown in Table 1:

[0115] Table 1

[0116] Allocation Method 1 12 35 Allocation Method 2 16 31 …… …… ……

[0117] Table 1 shows the m possible allocation methods for the storage resources of the first shared counter. For example, allocation method 1: when the first sub-counter occupies 12 bits of storage resources of the first shared counter, the second sub-counter occupies 35 bits of storage resources of the shared counter. Allocation method 2: when the first sub-counter occupies 20 bits of storage resources of the first shared counter, the second sub-counter occupies 27 bits of storage resources of the first shared counter.

[0118] Based on the data integrity protection principle of the integrity tree described above, when writing data to a target data block, the value of the first sub-counter corresponding to that target data block needs to be incremented by a first value to record a write operation to that target data block. The MAC value of the target data block is then recalculated based on the incremented value of the first sub-counter, denoted as MAC value 1, and saved. Subsequently, when reading data from the target data block, a MAC value is calculated based on the value of the first sub-counter and the data in the target data block, denoted as MAC value 2. MAC value 2 is then compared with the saved MAC value 1 to determine whether the data in the target data block has been tampered with.

[0119] Based on this, when the processor writes data to the target data block, it obtains the value of the first sub-counter corresponding to the target data block and determines whether the value of the first sub-counter, after being increased by a first value, is greater than the maximum storage value of the first storage resource currently allocated to the first sub-counter, where the first value is a positive integer. For example, suppose the processor obtains the value of the first sub-counter as 111111111111, and this first sub-counter occupies 12 bits of storage resource of the first shared counter, meaning the size of the first storage resource is 12 bits. After the processor increases the value of the first sub-counter by the first value, it determines that the value of the first sub-counter after the increase is greater than the maximum storage value of the first storage resource, i.e., 1111111111111. This indicates that the first sub-counter has overflowed, and the first storage resource currently allocated to the first sub-counter cannot meet its actual needs. In this case, the processor allocates the second storage resource to the first sub-counter, and the storage resource of the first sub-counter is then the sum of the first and second storage resources. For example, as shown in Table 2, 4 bits of storage resources are allocated to the first sub-counter, making the adjusted storage resources of the first sub-counter 16 bits. This increases the storage resources of the first sub-counter, prevents the first sub-counter from overflowing, and improves the data integrity verification performance of the integrity tree.

[0120] As can be seen from the above, in this embodiment of the application, when it is determined that the first storage resource of the first sub-counter cannot meet the needs, the second storage resource is reallocated to the first sub-counter, thereby realizing the dynamic adjustment of the storage resource of the first shared counter according to the storage resource requirements of the sub-counter, thereby improving the utilization rate of the storage resource of the first shared counter.

[0121] In one example, the aforementioned second storage resource can be an unallocated free storage resource in the first shared counter.

[0122] In another example, as described above, the first shared counter also includes a second sub-counter, the storage resource of which is denoted as the third storage resource. This third storage resource also belongs to the storage resource of the first shared counter, meaning that the first sub-counter and the second sub-counter share the storage resource of the first shared counter.

[0123] Optionally, the second storage resource mentioned above includes unused free storage resources in the third storage resource.

[0124] Optionally, the second storage resource mentioned above includes unallocated free storage resources in the first shared timer and unused free storage resources in the third storage resource.

[0125] Optionally, when the second storage resource is an unused free storage resource in the third storage resource, the embodiments of this application further include adjusting the third storage resource so that the difference between the third storage resource before adjustment and the third storage resource after adjustment is equal to the second storage resource.

[0126] The resource allocation device provided in this application embodiment, in response to a write request for a target data block, obtains the value of the first sub-counter corresponding to the target data block in the integrity tree. The first sub-counter is a sub-counter of a first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. When it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, a second storage resource is allocated to the first sub-counter. This realizes the dynamic adjustment of the storage resource of the first shared counter, improves the utilization rate of the storage resource of the first shared counter, increases the storage resource of the adjusted first sub-counter, and prevents the first sub-counter from overflowing, thereby improving the data integrity verification performance of the integrity tree.

[0127] In some embodiments, such as Figure 11 As shown, the shared counter includes at least two sub-counters and a resource partitioning identifier (e.g., Metadata), which indicates the storage resources of the sub-counters. It should be noted that the aforementioned first shared counter belongs to the shared counter described in this application embodiment; that is, the first shared counter includes a first sub-counter and a second sub-counter, as well as a resource partitioning identifier, which indicates the storage resources of the first sub-counter and / or the second sub-counter.

[0128] There are different ways to partition resources. The following section introduces two methods: continuous partitioning and discontinuous partitioning.

[0129] Method 1 involves contiguous resource partitioning, where the granularity of resource partitioning is relatively small. For example, a shared counter includes two sub-counters, denoted as sub-counter 1 and sub-counter 2. The shared counter's storage resource is 50 bits, and the resource partitioning granularity is 1 bit. Therefore, the resource partitioning identifier requires 6 bits. Sub-counter 1 and sub-counter 2 share 44 bits. The correspondence between different resource partitioning identifiers and each storage resource is shown in Table 2.

[0130] Table 2

[0131]

[0132] As shown in Table 2 above, the resource partitioning identifier 000001 indicates that sub-counter 1 occupies 2 bits of the shared counter's storage resources, starting from the 7th bit from the left, while sub-counter 2 occupies the remaining 42 bits of the shared counter's storage resources.

[0133] It should be noted that Table 2 above is only an example of the continuous allocation of resources involved in the embodiments of this application. The resource allocation methods of the shared counter involved in the embodiments of this application include, but are not limited to, Table 2 above.

[0134] Method 2 involves non-contiguous resource partitioning. In this method, the resource partitioning identifier occupies less storage resources in the shared counter. For example, the shared counter includes two sub-counters, denoted as sub-counter 1 and sub-counter 2. The shared counter's storage resources are 50 bits. There are eight preset resource allocation methods, requiring 3 bits to identify these eight methods. That is, the resource partitioning identifier needs 3 bits. Sub-counter 1 and sub-counter 2 share 47 bits. The correspondence between different resource partitioning identifiers and various storage resources is shown in Table 3.

[0135] Table 3

[0136]

[0137] As shown in Table 3 above, resource allocation marker 101 indicates that sub-counter 1 occupies 20 bits of the shared counter's storage resources, starting from the 4th bit from the left, while sub-counter 2 occupies the remaining 27 bits of the shared counter's storage resources.

[0138] It should be noted that Table 3 above is only an example of non-contiguous resource partitioning involved in the embodiments of this application. The resource partitioning methods of the shared counter involved in the embodiments of this application include, but are not limited to, Table 3 above.

[0139] In some embodiments, in the above correspondence, the difference in storage resource size between the same sub-counter corresponding to two adjacent resource partition identifiers is the same. For example, as shown in Table 1, the difference in storage resource size between sub-counter 1 corresponding to adjacent resource partition identifiers 000000 and 00001 is 1 bit, and the difference in storage resource size between sub-counter 1 corresponding to adjacent resource partition identifiers 000001 and 00010 is also 1 bit. Similarly, the difference in storage resource size between sub-counter 2 corresponding to adjacent resource partition identifiers 000000 and 00001 is 1 bit, and the difference in storage resource size between sub-counter 2 corresponding to adjacent resource partition identifiers 000001 and 00010 is also 1 bit.

[0140] In some embodiments, the difference in storage resource size between the same sub-counter corresponding to two adjacent resource partition identifiers is different in the above correspondence. For example, as shown in Table 2, the difference in storage resource size between sub-counter 1 corresponding to adjacent resource partition identifiers 010 and 011 is 3 bits, and the difference in storage resource size between sub-counter 1 corresponding to adjacent resource partition identifiers 011 and 100 is 1 bit. Similarly, the difference in storage resource size between sub-counter 2 corresponding to adjacent resource partition identifiers 010 and 011 is 3 bits, and the difference in storage resource size between sub-counter 2 corresponding to adjacent resource partition identifiers 011 and 100 is 1 bit.

[0141] The resource allocation identifier for the storage resources of the shared counter has been described above. The data structure of the shared counter is described below. In this embodiment, the data structure of the shared counter is related to the number of sub-counters included in the shared counter.

[0142] Case 1: The shared counter includes two sub-counters and a resource partitioning identifier. The resource partitioning identifier is used to indicate the storage resources of at least one of the two sub-counters. The sum of the storage resources occupied by the two sub-counters in the shared counter is equal to the remaining storage resources in the shared counter excluding the storage resources occupied by the resource partitioning identifier.

[0143] For example, if the shared counter mentioned above is a first shared counter, then the first shared counter includes a first sub-counter and a second sub-counter, as well as a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter and / or the second sub-counter.

[0144] For example, such as Figure 12As shown, the shared counter includes one resource partition identifier and two sub-counters, namely sub-counter 1 and sub-counter 2. Sub-counter 1 corresponds to data block 1 and is used to maintain the data integrity of data block 1. Sub-counter 2 corresponds to data block 2 and is used to maintain the data integrity of data block 2. The shared counter has a total of 50 bits of storage resources. The resource partition identifier occupies y bits of storage resources in shared counter 1, sub-counter 1 occupies x bits of storage resources in shared counter 1, and sub-counter 2 occupies 50-xy bits of storage resources in shared counter 1. Assuming y equals 3, when the binary value of y is 001 (as shown in Table 3), sub-counter 1 occupies 16 bits of storage resources in shared counter 1, i.e., x equals 16, while sub-counter 2 occupies the remaining 31 bits of storage resources in shared counter 1. When the binary value of y is 101 (as shown in Table 3), sub-counter 1 occupies 20 bits of storage resources in shared counter 1, i.e., x equals 20, while sub-counter 2 occupies the remaining 27 bits of storage resources in shared counter 1. In practical applications, the processor can dynamically adjust the storage resources required by the sub-counter by selecting different resource partitioning identifiers, thereby improving the utilization rate of storage resources, reducing the probability of sub-counter overflow, and enhancing the performance of data integrity verification.

[0145] Case 2: The shared counter includes n sub-counters and n resource partitioning identifiers, where n is a positive integer greater than or equal to 3. The n resource partitioning identifiers correspond one-to-one with the n sub-counters, and each resource partitioning identifier in the n resource partitioning identifiers is used to indicate the storage resources of the corresponding sub-counter.

[0146] For example, if the shared counter mentioned above is a first shared counter, then the first shared counter includes a first sub-counter and n-1 second sub-counters, as well as n resource partition identifiers. Each of the n resource partition identifiers is used to indicate the storage resources of the corresponding sub-counter.

[0147] In scenario 2, to further improve the utilization of physical resources, the shared counter includes multiple sub-counters, which share the storage resources of the shared counter.

[0148] For example, such as Figure 13As shown, the shared counter includes four resource partition identifiers and four sub-counters. These four resource partition identifiers are denoted as MD1, MD2, MD3, and MD4, respectively. The four sub-counters are denoted as sub-counter 1, sub-counter 2, sub-counter 3, and sub-counter 4, respectively. Sub-counter 1 corresponds to data block 1 and is used to maintain the data integrity of data block 1; sub-counter 2 corresponds to data block 2 and is used to maintain the data integrity of data block 2; sub-counter 3 corresponds to data block 3 and is used to maintain the data integrity of data block 3; and sub-counter 4 corresponds to data block 4 and is used to maintain the data integrity of data block 4. Assuming the shared counter has a total of 50 bits of storage resources, the four resource partition identifiers each occupy 2 bits of storage resources in the shared counter, and the four sub-counters share the remaining 32 bits of storage resources in the shared counter.

[0149] In scenario 2, in order to save storage resources and reduce the excessive storage resources occupied by resource partitioning identifiers in shared resources, a non-contiguous resource partitioning method is adopted to partition the storage resources of shared resources. Table 4 shows one resource partitioning method involved in the embodiments of this application. It should be noted that Table 4 is only an example, and the resource partitioning methods involved in the embodiments of this application include, but are not limited to, those shown in Table 4.

[0150] Table 4

[0151]

[0152] As shown in Table 4 above, when the value of MD1 is 01, it means that sub-counter 1 occupies 8 bits of storage resources of the shared counter, starting from the 3rd bit from the left.

[0153] In the first example, the sum of the storage resources occupied by the n sub-counters in the shared counter is equal to the remaining storage resources of the shared counter excluding the storage resources occupied by the n resource partition identifiers. For example Figure 13 As shown, assume the shared counter includes 4 resource partition identifiers and 4 sub-counters. The shared counter has 50 bits of storage resources. Each of the 4 resource partition identifiers occupies 2 bits of storage resources, and the 4 resource partition identifiers collectively occupy 8 bits of storage resources for the shared counter. The remaining 32 bits of storage resources are shared by the 4 sub-counters. Figure 14As shown, assuming the value of the shared counter is: 00011001 10000101 01010001 00110000 10001010, the value of each resource partition identifier is obtained by parsing the shared counter. Combined with Table 4, the value of MD1 is 00, indicating that sub-counter 1 occupies 0 bits of storage resources of the shared counter; the value of MD2 is 01, indicating that sub-counter 2 occupies 8 bits of storage resources of the shared counter; the value of MD3 is 10, indicating that sub-counter 3 occupies 16 bits of storage resources of the shared counter; and the value of MD4 is 01, indicating that sub-counter 4 occupies 8 bits of storage resources of the shared counter.

[0154] In the second example, the sum of the storage resources occupied by the n sub-counters in the shared counter is less than the remaining storage resources of the shared counter excluding the storage resources occupied by the n resource partition identifiers. (See reference...) Figure 13 As shown, assume the shared counter includes 4 resource partition identifiers and 4 sub-counters. The shared counter has 50 bits of storage resources. Each of the 4 resource partition identifiers occupies 2 bits of storage resources, and the 4 resource partition identifiers collectively occupy 8 bits of storage resources for the shared counter. The remaining 32 bits of storage resources are shared by the 4 sub-counters. Figure 15 As shown, assuming the value of the shared counter is: 01010010 10000101 01010001 00000000 10001010, parsing the 8-bit resource partition identifier, the value of each resource partition identifier, combined with Table 4, yields the following: MD1 has a value of 01, indicating that sub-counter 1 occupies 8 bits of storage resources in the shared counter; MD2 has a value of 01, indicating that sub-counter 2 occupies 8 bits of storage resources in the shared counter; MD3 has a value of 00, indicating that sub-counter 3 occupies 0 bits of storage resources in the shared counter; and MD4 has a value of 01, indicating that sub-counter 4 occupies 8 bits of storage resources in the shared counter. These four sub-counters occupy a total of 24 bits of storage resources in the shared counter, and the shared counter has 8 bits of idle storage resources.

[0155] In some embodiments, to improve the parsing speed of resource partition identifiers, the processor can use at least two threads to parse the shared counter and obtain the value of the sub-counter corresponding to each of the n resource partition identifiers. For example... Figure 14 and Figure 15The processor shown starts two threads (Thread 1 and Thread 2) to parse the shared counter 2 from both ends. For example, Thread 1 starts parsing from the left end of the shared counter, and Thread 2 starts parsing from the right end of the sub-counters, thus quickly obtaining the values ​​of each sub-counter. It should be noted that before parsing the sub-counter values, Thread 1 and Thread 2 need to parse the resource partition identifier values. Specifically, Thread 1 starts parsing the resource partition identifier value from the left side of its storage location, and Thread 2 starts parsing the resource partition identifier value from the right side of its storage location.

[0156] It should be noted that in the second example above, where the sum of the storage resources occupied by the n sub-counters in the shared counter is less than the remaining storage resources of the shared counter excluding the storage resources occupied by the n resource partition identifiers, when resolving the shared counter from both ends, there will be idle resources at the boundary between two adjacent sub-counters in the middle. For example, Figure 15 In this example, assume that sub-counter 1 occupies 8 bits of shared counter storage resources, sub-counter 2 occupies 8 bits of shared counter storage resources, sub-counter 3 occupies 0 bits of shared counter storage resources, and sub-counter 4 occupies 8 bits of shared counter storage resources. When two threads are started to parse these four sub-counters from both ends of shared counter 2, thread 1 starts from the 9th bit from the left, offsetting 8 bits to obtain the value of sub-counter 1 as 10000101. Starting from the 17th bit, it offsets 8 bits to the right to obtain the value of sub-counter 2 as 01010001. Thread 2 starts from the right and offsets 8 bits to the left to obtain the value of sub-counter 4 as 10001010, and the value of sub-counter 3 as 0. At this point, there are 8 bits of free storage resources between counter 2 and sub-counter 3.

[0157] In some embodiments, among the sub-counters included in the shared counter, the storage addresses of data blocks corresponding to two adjacent sub-counters differ by a preset value in the storage device.

[0158] In one example, taking the first shared counter as an example, such as Figure 16 As shown, assume the first shared counter includes sub-counter 1 and sub-counter 2, where the target data block is... Figure 16 Data block 1, the second data block is Figure 16 In the context of data block 2, data block 1 is adjacent to data block 2, meaning the storage address of the target data block is adjacent to the storage address of the block at the second time step. It should be noted that the storage address of the data block mentioned here refers to its storage address in a storage device (e.g., memory).

[0159] In another example, taking the first shared counter as an example, such as Figure 17As shown, assume the first shared counter includes sub-counter 1 and sub-counter 2, where the target data block is... Figure 17 Data block 1, the second data block is Figure 17 In the data block p, the storage address of data block 1 is farthest from that of data block 2. Because data access follows certain patterns during actual program execution, the number of accesses to adjacent data blocks is often similar, resulting in similar demand for counter resources. Mapping data blocks with far-distant addresses to adjacent sub-counters weakens the correlation between the access counts of distant address data blocks, thus maximizing the utilization of shared storage resources.

[0160] This embodiment provides a detailed description of the data structure of the shared counter when it includes a resource partitioning identifier. Based on this, and combined with... Figure 18 The resource allocation method provided in the embodiments of this application will be further explained.

[0161] Figure 18 This is another flowchart illustrating the resource allocation method provided in the embodiments of this application, in the above 11 to Figure 17 On the basis of, such as Figure 18 As shown, the method in this application embodiment includes:

[0162] S201. In response to a write request for the target data block, obtain the first shared counter.

[0163] Specifically, when the processor receives a write request for the target data block, it obtains the first sub-counter corresponding to the target data block and the first shared counter to which the first sub-counter belongs. For example... Figure 12 As shown, assuming the target data block is data block 1, the corresponding first sub-counter is sub-counter 1, and this sub-counter 1 belongs to shared counter 1, that is, shared counter 1 is recorded as the first shared counter.

[0164] S202. Obtain the first resource partitioning identifier corresponding to the first sub-counter from the first shared counter.

[0165] Specifically, the processor parses the first shared counter to obtain the first resource partitioning identifier corresponding to the first sub-counter in the first shared counter. For example, the first resource partitioning identifier corresponding to the first sub-counter obtained by parsing is b001 in Table 3 above.

[0166] S203. Obtain the first storage resource based on the first resource partitioning identifier and the preset correspondence between the resource partitioning identifier and the storage resource.

[0167] S204. Based on the first storage resource, parse the value of the first sub-counter from the first shared counter.

[0168] Assuming the preset correspondence between resource partitioning identifiers and storage resources is as shown in Table 3 above, the processor obtains the first resource partitioning identifier, searches for the storage resource corresponding to the first resource partitioning identifier in the preset correspondence between resource partitioning identifiers and storage resources, records this storage resource as the first storage resource, and obtains the value of the first sub-counter corresponding to the first storage resource in the first shared counter. For example, assuming the first shared counter has 50 bits of storage resource, its value is: 001 1111111111111111 0000000000000011100001000000100, where the leftmost 3 bits represent the storage resource occupied by the first resource partitioning identifier, which has a value of 001. Table 3 shows that 001 corresponds to 16 bits of first storage resource, meaning that at the current moment, the first sub-counter occupies 16 bits of storage resource of the first shared counter, and the value of the first sub-counter is 1111111111111111.

[0169] S205. When the value of the first sub-counter after being increased by the first value is greater than the maximum storage value of the first storage resource, the storage resource corresponding to the second resource partitioning identifier is obtained according to the first storage resource and the preset correspondence between the resource partitioning identifier and the storage resource.

[0170] Among them, the storage resources corresponding to the second resource allocation identifier are greater than the first storage resources;

[0171] S206. Determine the size of the second storage resource based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource.

[0172] S207. Based on the size of the second storage resource, obtain the second storage resource from the unused free storage resource in the third storage resource and allocate it to the first sub-counter.

[0173] Specifically, after obtaining the value of the first sub-counter according to the above steps, the processor determines whether the value of the first sub-counter after increasing by a first value is greater than the maximum storage value of the first storage resource. Continuing with the example above, assuming the first storage resource is 16 bits and its maximum storage value is 11111111111111111, and the current value of the first sub-counter is also 1111111111111111, the value of the first sub-counter after increasing by the first value (assuming the first value is 1) is greater than the maximum storage value of the first storage resource, causing the first sub-counter to overflow and preventing the recording of a write operation to the target data block. To solve this technical problem, this embodiment dynamically adjusts the storage resource of the first sub-counter, that is, by adding a second storage resource based on the first storage resource, thereby increasing the storage resource of the first sub-counter and reducing the overflow frequency of the first sub-counter. Next, based on the first storage resource and the preset correspondence between resource partitioning identifiers and storage resources, the storage resource corresponding to the second resource partitioning identifier is obtained, and this storage resource corresponding to the second resource partitioning identifier is greater than the first storage resource. Then, based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource, the size of the second storage resource is determined, and based on the size of the second storage resource, the second storage resource is obtained from the unused free storage resources in the third storage resource and allocated to the first sub-counter.

[0174] For example, the processor determines whether the first shared counter has free resources based on the value of the second sub-counter. For instance, if the value of the second sub-counter is 0000000000000011100001000000100, the first 14 bits of storage resources are free. Thus, the processor can determine the maximum adjusted storage resource value of the first sub-counter based on the first sub-counter's storage resources and the free storage resources of the first shared counter. For example, the maximum adjusted storage resource value of the first sub-counter is 16 + 14 = 30 bits. As shown in Table 3, the storage resources of the first sub-counter that fall between 16 bits and 30 bits are: 20 bits, 23 bits, 24 bits, and 27 bits. This means that the second storage resource can be any value from 20 bits, 23 bits, 24 bits, and 27 bits. For example, if the second resource partition identifier is b011, its corresponding storage resource is 23 bits. Therefore, the expected adjusted storage resource of the first sub-counter is 23 bits, which determines the size of the second storage resource to be 7 bits. Next, the processor acquires the second storage resource from the unused free storage resource in the third storage resource and allocates the second storage resource to the first sub-counter. In this way, the processor adjusts the storage resource of the first sub-counter from 16 bits to 23 bits, and correspondingly adjusts the storage resource of the second sub-counter from 31 bits to 24 bits.

[0175] Optionally, the first resource partitioning identifier and the second resource partitioning identifier mentioned above are two adjacent resource partitioning identifiers in the correspondence relationship. Continuing to refer to Table 3 above, if the first resource partitioning identifier is b001, the second resource partitioning identifier is b010.

[0176] Next, the first resource partition identifier in the first shared counter is replaced with the second resource partition identifier.

[0177] Specifically, the processor allocates the second storage resource to the first sub-counter. Simultaneously, the processor replaces the first resource allocation identifier in the first shared counter with the second resource allocation identifier. Thus, when reading data from the target data block subsequently, the processor can obtain the second resource allocation identifier from the first shared counter, accurately determine the storage resource of the first sub-counter based on the second resource allocation identifier, and then accurately read the value of the first sub-counter from the first shared counter for data integrity verification. Referring to the example above, assuming the adjusted first storage resource is 23 bits and the corresponding second resource partitioning identifier is b011, the first resource partitioning identifier b001 in the first shared counter is replaced with the second resource partitioning identifier b011. The value of the first shared counter after replacement is: 011 000000011111111111111111000000011100001000000100. Among them, the first sub-counter occupies 23 bits of storage resources of the first shared counter, and the value of the first sub-counter is 00000001111111111111111111. The second sub-counter occupies 24 bits of storage resources of the first shared counter, and the value of the second sub-counter is 000000011100001000000100.

[0178] S208, Increment the value of the first sub-counter by the first value.

[0179] In this embodiment of the application, the processor allocates the second storage resource to the first sub-counter according to the above steps, thereby increasing the storage resource of the first sub-counter. In this way, when the value of the first sub-counter is increased by the first value, the first sub-counter will not overflow, thereby enabling the first sub-counter to accurately record a write operation of the processor on the target data block.

[0180] S209. Determine the MAC value of the target data block based on the value of the first sub-counter after the increment.

[0181] After the processor increments the value of the first sub-counter by a first value, the value of the first sub-counter corresponding to the target data block changes. At this point, it is necessary to recalculate the MAC value of the target data block using the MAC calculation function based on the updated value of the first sub-counter and the data in the target data block.

[0182] Furthermore, since the value of the first sub-counter has changed, the value of the first shared counter has also changed. Therefore, it is necessary to recalculate the MAC value of the first shared counter. The calculation process for the MAC value can be referred to the above. Figures 3 to 5 The description will not be repeated here.

[0183] In the resource partitioning apparatus of this application embodiment, when the first shared counter includes a resource partitioning identifier, the processor, in response to a write request for the target data block, obtains the first shared counter in the integrity tree, obtains the first resource partitioning identifier corresponding to the first sub-counter from the first shared counter, and obtains the value of the first sub-counter in the first shared counter according to the first resource partitioning identifier and a preset correspondence between resource partitioning identifiers and storage resources. Next, when the processor detects that the value of the first sub-counter after incrementing by a first value is greater than the maximum storage value of the first storage resource, it obtains the storage resource corresponding to the second resource partitioning identifier according to the first storage resource and the preset correspondence between resource partitioning identifiers and storage resources. The storage resource corresponding to the second resource partitioning identifier is greater than the first storage resource. The size of the second storage resource is determined based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource. Based on the size of the second storage resource, the second storage resource is obtained from unused free storage resources in the third storage resource and allocated to the first sub-counter. Additionally, the value of the first sub-counter is incremented by a first value, and the MAC value of the target data block is determined based on the incremented value of the first sub-counter. In this way, by adjusting the storage resources of the first sub-counter from the storage resources corresponding to the first resource partitioning identifier to the storage resources corresponding to the second resource partitioning identifier, the storage resources of the first sub-counter are increased, the overflow probability of the first sub-counter is reduced, and the utilization rate of the first shared counter resources is improved.

[0184] In one possible implementation of this application, when the second storage resource belongs to the third storage resource, before allocating the second storage resource to the first sub-counter, it is first necessary to check whether there are any unused free storage resources in the third storage resource. If there are, the second storage resource in the unused free storage resources of the third storage resource is allocated to the first sub-counter.

[0185] When it is found that there are no unused free storage resources in the third storage resource, the overflow counter of the first node where the first shared counter is located is incremented by a second value, and the values ​​of the first sub-counter and the second sub-counter are both set to a third value, where the second value is a positive integer and the third value is a positive number.

[0186] For example, suppose the value of the first shared counter is: 001 11111111111111111000000000000011100001000000100, the value of the first sub-counter is: 1111111111111111, the maximum storage value of the first storage resource is: 1111111111111111, the value of the first sub-counter after adding the first value is greater than the maximum storage value of the first storage resource currently allocated by the first sub-counter, and the value of the second sub-counter is: 1000000000000011100001000000100, then it is determined that the unused free storage resource of the third storage resource is allocated to the first sub-counter. At this time, the overflow counter value of the first node where the first shared counter is located is increased by a second value, for example, the second value is 1, and the values ​​of all sub-counters of the first shared counter are all increased by a third value, that is, the values ​​of the first sub-counter and the second sub-counter are both set to the third value. Assuming the third value is 0, the value of the first shared counter after the reset is: 001 0000000000000000 0000000000000000000000000000000000000.

[0187] In some embodiments, in addition to setting the values ​​of the first sub-counter and the second sub-counter in the first shared counter to a third value (e.g., 0), the value of the resource partitioning identifier in the first shared counter can also be set to a third value (e.g., 0), and the resource partitioning method can be redefined. For example, the resource partitioning method corresponding to resource partitioning identifier 010 in Table 3 is that the first sub-counter occupies 20 bits of storage resources of the first shared counter, and the second sub-counter occupies 27 bits of storage resources of the first shared counter.

[0188] In some embodiments, in addition to setting the values ​​of each sub-counter of the first shared counter in the first node to a third value (e.g., 0), the values ​​of all other counters in the first node except the first shared counter and the overflow counter can also be set to a third value (e.g., 0).

[0189] After the above reset, the value of at least one counter in the first node changes. For example, the value of the overflow counter and the value of the first shared counter in the first node change. At this time, it is necessary to redetermine the MAC value of the first node based on the reset values ​​of each counter in the first node. Specifically, based on the reset values ​​of each counter in the first node and the corresponding counter values ​​of the first node in the parent node, the MAC value of the first node is obtained through the corresponding operation.

[0190] Furthermore, as described above, each sub-counter corresponds to a data block. When the value of the sub-counter changes, the MAC value corresponding to the data block also changes. Therefore, in this embodiment, after resetting the sub-counter, it is necessary to re-determine the MAC value of the data block corresponding to the sub-counter based on the reset sub-counter value. Specifically, based on the reset sub-counter value and the data in the data block, the MAC value of the data block is re-determined through corresponding operations.

[0191] Figure 19 This application provides a schematic diagram of the structure of a resource allocation device 100, which includes a processor 110:

[0192] The processor 100 is configured to, in response to a write request for a target data block, obtain the value of a first sub-counter corresponding to the target data block in the integrity tree, wherein the first sub-counter is a sub-counter of a first shared counter, the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter, and the first shared counter is a shared counter of the leaf node corresponding to the target data block in the integrity tree; and when it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, allocate a second storage resource to the first sub-counter, wherein the second storage resource belongs to the storage resource of the first shared counter, and the first value is a positive integer.

[0193] In some embodiments, the first shared counter further includes a second sub-counter, the third storage resource of the second sub-counter being a storage resource of the first shared counter, and the second storage resource including unused free storage resources in the third storage resource.

[0194] In some embodiments, the first shared counter further includes a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter.

[0195] In some embodiments, the processor 100 is specifically configured to, in response to a write request for the target data block, obtain the first shared counter; obtain a first resource partition identifier from the first shared counter; obtain the first storage resource according to the first resource partition identifier and a preset correspondence between the resource partition identifier and the storage resource; and parse the value of the first sub-counter from the first shared counter according to the first storage resource.

[0196] In some embodiments, the processor 100 is specifically configured to: obtain the storage resource corresponding to the second resource partition identifier based on the first storage resource and a preset correspondence between the resource partition identifier and the storage resource, wherein the storage resource corresponding to the second resource partition identifier is greater than the first storage resource; determine the size of the second storage resource based on the size of the storage resource corresponding to the second resource partition identifier and the size of the first storage resource; and obtain the second storage resource from the unused free storage resources in the third storage resource based on the size of the second storage resource, and allocate the obtained second storage resource to the first sub-counter.

[0197] In some embodiments, the processor 100 is further configured to, when allocating the second storage resource to the first sub-counter, increment the value of the first sub-counter by the first value; and determine the message authentication code (MAC) value of the target data block based on the incremented value of the first sub-counter.

[0198] In some embodiments, the processor 100 is further configured to allocate the second storage resource in the unused free storage resource to the first sub-counter when it is detected that there is an unused free storage resource in the storage resources of the second sub-counter.

[0199] In some embodiments, the processor 100 is further configured to, when it is detected that there are no unused free storage resources in the storage resources of the second sub-counter and no unallocated free storage resources in the first shared counter, add a second value to the overflow counter of the first node where the first shared counter is located, and set the values ​​of both the first sub-counter and the second sub-counter to a third value, wherein the second value is a positive integer and the third value is a positive number.

[0200] In some embodiments, when the values ​​of the first counter and the second sub-counter are set to the third value, the values ​​of all other counters in the first node except the overflow counter are also set to the third value.

[0201] In some embodiments, the storage addresses of data blocks corresponding to two adjacent sub-counters in the first shared counter differ by a preset value in the storage device.

[0202] The resource allocation device in this application embodiment can be used to execute the technical solutions of the above methods. Its implementation principle and technical effect are similar, and will not be described again here.

[0203] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0204] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Furthermore, reference can be made between the various method embodiments and between the various device embodiments; identical or corresponding content in different embodiments can be mutually referenced, without further elaboration.

Claims

1. A resource allocation method, characterized in that, include: In response to a write request for a target data block, the value of the first sub-counter corresponding to the target data block in the integrity tree is obtained. The first sub-counter is a sub-counter of the first shared counter. The first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. The first shared counter is a shared counter of the leaf node corresponding to the target data block in the integrity tree. The first shared counter also includes a second sub-counter, the third storage resource of the second sub-counter belongs to the storage resource of the first shared counter, and the second storage resource includes unused free storage resources in the third storage resource; When the value of the first sub-counter after incrementing by a first value is detected to be greater than the maximum storage value of the first storage resource, the second storage resource is obtained from the unused free storage resource in the third storage resource and allocated to the first sub-counter. The second storage resource belongs to the storage resource of the first shared counter, and the first value is a positive integer.

2. The method according to claim 1, characterized in that, The first shared counter further includes a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter and / or the second sub-counter.

3. The method according to claim 2, characterized in that, The step of obtaining the value of the first sub-counter corresponding to the target data block in the integrity tree in response to a write request for the target data block includes: In response to a write request for the target data block, the first shared counter is obtained; Obtain the first resource partition identifier from the first shared counter; The first storage resource is obtained based on the first resource partitioning identifier and the preset correspondence between the resource partitioning identifier and the storage resource; Based on the first storage resource, the value of the first sub-counter is parsed from the first shared counter.

4. The method according to claim 3, characterized in that, The step of obtaining the second storage resource from the unused free storage resource in the third storage resource and allocating the second storage resource to the first sub-counter includes: Based on the first storage resource and the preset correspondence between the resource partitioning identifier and the storage resource, the storage resource corresponding to the second resource partitioning identifier is obtained, and the storage resource corresponding to the second resource partitioning identifier is greater than the first storage resource. The size of the second storage resource is determined based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource; Based on the size of the second storage resource, the second storage resource is obtained from the unused free storage resources in the third storage resource and allocated to the first sub-counter.

5. The method according to claim 4, characterized in that, The method further includes: When the second storage resource is allocated to the first sub-counter, the value of the first sub-counter is increased by the first value; The message authentication code (MAC) value of the target data block is determined based on the increased value of the first sub-counter.

6. The method according to any one of claims 1-5, characterized in that, The step of allocating the second storage resource to the first sub-counter includes: When an unused free storage resource is detected in the third storage resource, the second storage resource in the unused free storage resource is allocated to the first sub-counter.

7. The method according to claim 6, characterized in that, The method further includes: When it is detected that there are no unused free storage resources in the third storage resource, the overflow counter of the first node where the first shared counter is located is incremented by a second value, and the values ​​of the first sub-counter and the second sub-counter are both set to a third value, where the second value is a positive integer and the third value is a positive number.

8. The method according to claim 7, characterized in that, The method further includes: When the values ​​of the first sub-counter and the second sub-counter are set to the third value, the values ​​of all other counters in the first node except the overflow counter are also set to the third value.

9. The method according to any one of claims 1-5 and 7-8, characterized in that, The data blocks corresponding to two adjacent sub-counters in the first shared counter have storage addresses that differ by a preset value in the storage device.

10. A resource allocation device, characterized in that, Including the processor; The processor is configured to, in response to a write request for a target data block, obtain the value of a first sub-counter corresponding to the target data block in the integrity tree. The first sub-counter is a sub-counter of a first shared counter, and the first storage resource of the first sub-counter belongs to the storage resource of the first shared counter. The first shared counter is a shared counter of the leaf node corresponding to the target data block in the integrity tree. The first shared counter further includes a second sub-counter, and the third storage resource of the second sub-counter belongs to the storage resource of the first shared counter. The second storage resource includes unused free storage resources in the third storage resource. When it is detected that the value of the first sub-counter after being increased by a first value is greater than the maximum storage value of the first storage resource, the processor obtains the second storage resource from the unused free storage resource in the third storage resource and allocates the second storage resource to the first sub-counter. The second storage resource belongs to the storage resource of the first shared counter, and the first value is a positive integer.

11. The apparatus according to claim 10, characterized in that, The first shared counter also includes a resource partitioning identifier, which is used to indicate the storage resources of the first sub-counter.

12. The apparatus according to claim 11, characterized in that, The processor is specifically configured to, in response to a write request for the target data block, obtain the first shared counter; obtain a first resource partition identifier from the first shared counter; obtain the first storage resource based on the first resource partition identifier and a preset correspondence between the resource partition identifier and the storage resource; and parse the value of the first sub-counter from the first shared counter based on the first storage resource.

13. The apparatus according to claim 12, characterized in that, The processor is specifically configured to obtain the storage resource corresponding to the second resource partitioning identifier based on the first storage resource and the preset correspondence between the resource partitioning identifier and the storage resource, wherein the storage resource corresponding to the second resource partitioning identifier is greater than the first storage resource. The size of the second storage resource is determined based on the size of the storage resource corresponding to the second resource partitioning identifier and the size of the first storage resource; and the second storage resource is obtained from the unused free storage resources in the third storage resource according to the size of the second storage resource, and the obtained second storage resource is allocated to the first sub-counter.

14. The apparatus according to claim 13, characterized in that, The processor is further configured to, when allocating the second storage resource to the first sub-counter, increment the value of the first sub-counter by the first value; and determine the message authentication code (MAC) value of the target data block based on the incremented value of the first sub-counter.

15. The apparatus according to any one of claims 10-14, characterized in that, The processor is further configured to allocate the second storage resource in the unused free storage resource to the first sub-counter when it is detected that there is an unused free storage resource in the storage resources of the second sub-counter.

16. The apparatus according to claim 15, characterized in that, The processor is further configured to, when it is detected that there are no unused free storage resources in the storage resources of the second sub-counter and there are no unallocated free storage resources in the first shared counter, add a second value to the overflow counter of the first node where the first shared counter is located, and set the values ​​of both the first sub-counter and the second sub-counter to a third value, wherein the second value is a positive integer and the third value is a positive number.

17. The apparatus according to claim 16, characterized in that, When the values ​​of the first sub-counter and the second sub-counter are set to the third value, the values ​​of all other counters in the first node except the overflow counter are also set to the third value.

18. The apparatus according to any one of claims 10-14 and 16-17, characterized in that, The data blocks corresponding to two adjacent sub-counters in the first shared counter have storage addresses that differ by a preset value in the storage device.

19. A computer storage medium, characterized in that, The device stores a computer-readable program that, when read and executed, causes the resource allocator device to perform the method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Counter integrity tree for memory security

    CN110945509A

  • Key rotating trees with split counters for efficient hardware replay protection

    US20190229924A1