# US 2021/0240817 A1 · System and method for facilitating stateful processing of a middlebox module implemented in a trusted execution environment

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0240817 A1
- Document ID: US20210240817A1
- Status: Published application
- Kind: A1
- Application number: 16/782,171
- Filed: 2020-02-05
- Published: 2021-08-05
- Earliest claimed: 2020-02-05
- Assignees: City University of Hong Kong
- Applicants: City University of Hong Kong
- Inventors: Huayi Duan; Cong Wang
- Web page: https://patentgrep.com/patent/US20210240817A1

## CPC

- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F 12/0813: with a network or matrix configuration
- G06F 16/24552: {Database cache management}
- H04L 67/5682: Policies or rules for updating, deleting or replacing the stored data
- G06F 2212/6042: Allocation of cache space to multiple users or processors
- G06F 2221/034: Test or assess a computer or a system
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

A computer-implemented method, and a related system, for facilitating stateful processing of a middlebox module implemented in a trusted execution environment. The method includes: determining, based on an identifier, from a lookup module in the trusted execution environment, whether a lookup entry of a flow and corresponding to the identifier exists. The method also includes determining, based on the lookup entry, whether an entry associated with the flow is arranged inside the trusted execution environment or outside the trusted execution environment, if it is determined that the lookup entry corresponding to the identifier exists. The method further includes caching, in a cache in the trusted execution environment, the entry associated with the flow and corresponding to the identifier, if it is determined that the entry associated with the flow is outside the trusted execution environment. The flow state associated with the flow may then be provided to the middlebox module.

## Claims

### Claim 1

A computer-implemented method for facilitating stateful processing of a middlebox module implemented in a trusted execution environment, the computer-implemented method comprising:
(a) determining, based on an identifier, from a lookup module in the trusted execution environment, whether a lookup entry of a flow and corresponding to the identifier exists;
(b) if it is determined that the lookup entry corresponding to the identifier exists, determining, based on the lookup entry, whether an entry associated with the flow is arranged inside the trusted execution environment or outside the trusted execution environment; and
(c) if it is determined that the entry associated with the flow is outside the trusted execution environment, caching, in a cache in the trusted execution environment, the entry associated with the flow and corresponding to the identifier to facilitate provision of a flow state associated with the flow to the middlebox module.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, further comprising:
(d) if it is determined that the entry associated with the flow is inside the trusted execution environment, arranging the corresponding entry associated with the flow to the front of the cache.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein arranging the corresponding entry to the front of the cache includes updating a pointer to the entry associated with the flow.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, further comprising:
(e) if it is determined that the lookup entry corresponding to the identifier does not exist, caching, in the cache in the trusted execution environment, the entry associated with the flow and corresponding to the identifier to facilitate provision of a flow state associated with the flow to the middlebox module.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, further comprising:
prior to step (a), extracting the identifier from an input packet.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, further comprising:
after step (c), providing the flow state associated with the flow to the middlebox module for processing.

### Claim 7 (depends on 4)

The computer-implemented method of claim 4, wherein step (b) comprises:
determining, based on the lookup entry, whether an entry associated with the flow is arranged in a flow cache module inside the trusted execution environment or in a flow store module outside the trusted execution environment

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein step (c) comprises:
caching, in the flow cache module in the trusted execution environment, the entry associated with the flow and corresponding to the identifier to facilitate provision of a flow state associated with the flow to the middlebox module.

### Claim 9 (depends on 8)

The computer-implemented method of claim 8, wherein step (c) comprises:
removing an entry from the flow cache module before or upon caching the entry associated with the flow and corresponding to the identifier in the flow cache module.

### Claim 10 (depends on 9)

The computer-implemented method of claim 9, wherein removing the entry comprise removing the least recently used entry from the flow cache module.

### Claim 11 (depends on 7)

The computer-implemented method of claim 7, wherein step (d) comprises:
arranging the corresponding entry associated with the flow to the front of the flow cache module.

### Claim 12 (depends on 7)

The computer-implemented method of claim 7, wherein step (e) comprises:
prior to the caching, creating a new entry associated with the identifier in the flow store module.

### Claim 13 (depends on 12)

The computer-implemented method of claim 12, further comprising:
moving the new entry from the flow store module to the flow cache module.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, further comprising:
checking memory safety of the new entry prior to moving the new entry.

### Claim 15 (depends on 13)

The computer-implemented method of claim 13, further comprising:
removing an entry from the flow cache module before or upon moving the new entry.

### Claim 16 (depends on 15)

The computer-implemented method of claim 15, further comprising:
encrypting the entry to be removed prior to the removal; and
the moving comprises moving the encrypted entry to the flow store module.

### Claim 17 (depends on 13)

The computer-implemented method of claim 13, further comprising:
decrypting the new entry before moving the new entry.

### Claim 18 (depends on 13)

The computer-implemented method of claim 13, further comprising:
updating the lookup module upon or after moving the new entry from the flow store module to the flow cache module.

### Claim 19 (depends on 7)

The computer-implemented method of claim 7, wherein the lookup module includes a plurality of lookup entries, each of the lookup entries includes a respective identifier and an associated link to either a flow cache entry in the flow cache module or a flow store entry in the flow store module.

### Claim 20 (depends on 19)

The computer-implemented method of claim 19, wherein the plurality of lookup entries includes a plurality of flow cache lookup entries and a plurality of flow store lookup entries.

### Claim 21 (depends on 20)

The computer-implemented method of claim 20, wherein the number of flow cache lookup entries is smaller than the number of flow store lookup entries.

### Claim 22 (depends on 21)

The computer-implemented method of claim 21, wherein step (b) comprises:
searching the plurality of flow cache lookup entries prior to searching the plurality of flow store lookup entries.

### Claim 23 (depends on 19)

The computer-implemented method of claim 19, wherein each of the lookup entries further include a respective swap counter and a respective timestamp indicative of a time of last access of the entry.

### Claim 24 (depends on 7)

The computer-implemented method of claim 7, wherein the flow cache module includes a plurality of flow cache entries, each of the flow cache entries includes a respective identifier of a lookup entry in the lookup module and respective flow state information.

### Claim 25 (depends on 24)

The computer-implemented method of claim 24, wherein each of the flow cache entries further includes a first pointer identifying a previous cache entry and a second pointer identifying a next cache entry.

### Claim 26 (depends on 7)

The computer-implemented method of claim 7, wherein the flow store module includes a plurality of flow store entries, each of the flow store entries include respective flow state information.

### Claim 27 (depends on 26)

The computer-implemented method of claim 26, wherein each of the flow store entries further include a respective authentication media access control address (MAC).

### Claim 28 (depends on 26)

The computer-implemented method of claim 26, wherein the flow store entries are encrypted.

### Claim 29 (depends on 7)

The computer-implemented method of claim 7, wherein the flow store module is arranged in an untrusted execution environment.

### Claim 30 (depends on 7)

The computer-implemented method of claim 7, wherein the flow cache module has a fixed capacity.

### Claim 31 (depends on 30)

The computer-implemented method of claim 30, wherein the flow store module has a variable capacity.

### Claim 32 (depends on 31)

The computer-implemented method of claim 31, wherein the lookup module has a variable capacity.

### Claim 33 (depends on 32)

The computer-implemented method of claim 32, wherein a capacity of the flow cache module is smaller than a capacity of the flow store module; and the capacity of the flow cache module is smaller than a capacity of the lookup module.

### Claim 34 (depends on 1)

The computer-implemented method of claim 1, wherein the trusted execution environment comprises a Software Guard Extension (SGX) enclave.

### Claim 35 (depends on 1)

The computer-implemented method of claim 1, wherein the trusted execution environment is initialized or provided using one or more processors.

### Claim 36

A system for facilitating stateful processing of a middlebox module implemented in a trusted execution environment, the system comprise:
one or more processors arranged to
(a) determine, based on an identifier, from a lookup module in the trusted execution environment, whether a lookup entry of a flow and corresponding to the identifier exists;
(b) if it is determined that the lookup entry corresponding to the identifier exists, determine, based on the lookup entry, whether an entry associated with the flow is arranged inside the trusted execution environment or outside the trusted execution environment; and
(c) if it is determined that the entry associated with the flow is outside the trusted execution environment, cache, in a cache in the trusted execution environment, the entry associated with the flow and corresponding to the identifier to facilitate provision of a flow state associated with the flow to the middlebox module.

### Claim 37

A non-transistory computer readable medium storing computer instructions that, when executed by one or more processors, are arranged to cause the one or more processors to perform a computer-implemented method for facilitating stateful processing of a middlebox module implemented in a trusted execution environment, the computer-implemented method comprising:
(a) determining, based on an identifier, from a lookup module in the trusted execution environment, whether a lookup entry of a flow and corresponding to the identifier exists;
(b) if it is determined that the lookup entry corresponding to the identifier exists, determining, based on the lookup entry, whether an entry associated with the flow is arranged inside the trusted execution environment or outside the trusted execution environment; and
(c) if it is determined that the entry associated with the flow is outside the trusted execution environment, caching, in a cache in the trusted execution environment, the entry associated with the flow and corresponding to the identifier to facilitate provision of a flow state associated with the flow to the middlebox module.
