Multi-part transaction integrity protection and encryption
Multi-part transaction integrity protection and encryption is disclosed, including generating, by a first device, a first message authentication code (MAC) for authenticating a plurality of packets of a transaction, the plurality of packets including at least a first packet received from a second device over a data link and a second packet generated by the first device in response to receiving the first packet, wherein the first MAC is generated using data included in the plurality of packets; and sending, by the first device to the second device, the second packet and the first MAC over the data link.
1 . A method for multi-part transaction integrity protection and encryption, the method comprising:
generating, by a first device, plaintext based on a first packet received from a second device,
wherein the first packet is received without receiving a message authentication code (MAC);
encrypting, by the first device, the plaintext to generate a ciphertext for a second packet;
generating, by a first device, a first MAC for authenticating a plurality of packets of a transaction, the plurality of packets including at least the first packet received from the second device over a data link and the second packet generated by the first device in response to receiving the first packet, wherein the first MAC is generated using data included in the plurality of packets including the first packet, the second packet, and one or more additional packets, the data including the plaintext; and
sending, by the first device to the second device, the plurality of packets and the first MAC over the data link to cause the second device to generate a second MAC to authenticate the second packet, the plurality of packets including the second packet and the one or more additional packets.
2 . The method of claim 1 , wherein the plurality of packets includes at least one of a request packet and a response packet.
3 . The method of claim 1 , wherein the plurality of packets includes a data header packet and one or more data transmission packets.
4 . The method of claim 1 further comprising:
receiving, by the first device from the second device, one or more additional packets of the transaction and a third MAC for authenticating the plurality of packets of the transaction including the one or more additional packets;
decrypting, by the first device, the one or more additional packets;
generating, by the first device, a fourth MAC for authenticating the plurality of packets of the transaction, including the one or more additional packets, using data included in the plurality of packets; and
authenticating, by the first device, the plurality of packets including the one or more additional packets based on a comparison of the third MAC and the fourth MAC.
5 . The method of claim 1 further comprising:
generating, by the first device, an initialization vector (IV) based on a combination of a pre-shared information and information included in the first packet, wherein the IV is used to decrypt data in the first packet.
6 . The method of claim 5 , wherein the pre-shared information includes at least one of an IV base and a generation count.
7 . The method of claim 6 , wherein one or more commands are used to update at least one of the IV base and the generation count.
8 . The method of claim 5 , wherein the information included in the first packet includes at least a tag and a generation identifier for the tag.
9 . The method of claim 1 , wherein transactions are reordered by the data link.
10 . The method of claim 1 , wherein the data link is a bus.
11 . The method of claim 10 , wherein the bus is a compute express link (CXL) bus.
12 . The method of claim 1 , wherein the first device is a host processor.
13 . The method of claim 1 , wherein the second device is a host processor.
14 . An apparatus for multi-part transaction integrity protection and encryption, the apparatus including a first device coupled to a data link for exchanging packetized data in multi-part transactions over the data link with one or more other devices, wherein the first device is configured to:
generate, by the first device, plaintext based on a first packet received from a second device,
wherein the first packet is received over a data link without receiving a message authentication code (MAC);
encrypt, by the first device, the plaintext to generate a ciphertext for a second packet;
generate, by the first device, a first MAC for authenticating a plurality of packets of a transaction, the plurality of packets including at least the first packet received from the second device over the data link and the second packet generated by the first device in response to receiving the first packet, wherein the first MAC is generated using data included in the plurality of packets including the first packet, the second packet, and one or more additional packets, the data including the plaintext; and
send, by the first device to the second device, the plurality of packets and the first MAC over the data link, the plurality of packets including the second packet and the one or more additional packets.
15 . The apparatus of claim 14 , wherein the plurality of packets includes at least one of a request packet and a response packet.
16 . The apparatus of claim 14 , wherein the plurality of packets includes a data header packet and one or more data transmission packets.
17 . The apparatus of claim 14 , wherein the first device is further configured to:
receive, by the first device from the second device, one or more additional packets of the transaction and a second MAC for authenticating the plurality of packets of the transaction including the one or more additional packets;
decrypt, by the first device, the one or more additional packets;
generate, by the first device, a third MAC for authenticating the plurality of packets of the transaction, including the one or more additional packets, using data included in the plurality of packets; and
authenticate, by the first device, the plurality of packets including the one or more additional packets based on a comparison of the second MAC and the third MAC.
18 . The apparatus of claim 14 , wherein the first device is further configured to:
generate, by the first device, an initialization vector (IV) based on a combination of a pre-shared information and information included in the first packet, wherein the IV is used to decrypt data in the first packet.
19 . The apparatus of claim 18 , wherein the pre-shared information includes at least one of an IV base and a generation count.
20 . The apparatus of claim 19 , wherein one or more commands are used to update at least one of the IV base and the generation count.
21 . The apparatus of claim 18 , wherein the information included in the first packet includes at least a tag and a generation identifier for the tag.
22 . The apparatus of claim 14 , wherein transactions are reordered by the data link.
23 . The apparatus of claim 14 , wherein the data link is a bus.
24 . The apparatus of claim 23 , wherein the bus is a compute express link (CXL) bus.
25 . A method for multi-part transaction integrity protection and encryption, the method comprising:
exchanging, by a first device with a second device, a plurality of packets of a transaction;
decrypting ciphertext in a packet, of the plurality of packets, to obtain plaintext,
the packet being received from the second device;
storing, by the first device, transaction state information covering data included in each of the plurality of packets;
generating, by the first device, a second message authentication code (MAC) in response to receiving a first MAC from the second device, wherein the second MAC is generated based on the transaction state information, the data included in each of the plurality of packets, and the plaintext; and
authenticating, by the first device, the plurality of packets based on a comparison of the first MAC and the second MAC.