Symmetric Cryptographic Intel FPGA Hard IP User Guide

ID 714305
Date 10/31/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

5.3.1. MAC Packing

After the AES/SM4 Inline Cryptographic Accelerator (ICA) performs an encryption/decryption on the incoming requests, the ICA generates 16 bytes authentication tag (MAC) and appends it to the end of the request. The generated MAC is always aligned at 16 bytes segments.

The table below depicts four possible MACsec output patterns showing the MAC location within the data bus.

Table 24.  MAC Packing
Profile MACsec   MACsec   MACsec   MACsec
MAC_IV_tweak_en 1   1   1   1
data_en 0   1   1   1
next_packet_en 1   1   1   0
tlast 1   1   1   1
num_empty_bytes 64   48 to 63   32 to 47   16 to 31
TID[9:0] Channel number   Channel number   Channel number   Channel number
DATA
data[127:0] MAC   AAD/Text   AAD/Text   AAD/Text
data[255:128] AAD/Text   MAC   AAD/Text/IDLE   AAD/Text/IDLE
data[391:256] AAD/Text   AAD/Text   MAC   AAD/Text/IDLE
data[511:393] AAD/Text   AAD/Text   AAD/Text   MAC
When the packet leaves the ICA, it may contain empty bytes between the last byte of the AAD/text and the MAC tag. The soft logic block removes any empty bytes such that the 16 bytes of MAC follows immediately after the last byte of AAD/text.
Figure 12. Output Packet Format

The table displays the MAC packing as it leaves the Symmetric Cryptographic IP core. The p_vld_data is a partial valid data and does not fully consume the entire 16 bytes. It contains some empty bytes within the 16 byte segment.

Since MAC must be 16 bytes aligned, it is followed by 5 bytes of partial data (p_vld_data) and 11 bytes of empty data is removed.

When the traffics using different profiles interleave, the output pattern for the profiles do not interleave between channels during the last cycle of the packet. For example, a 16 byte MAC always follows the last byte of a payload for the specific channel before interleaving with a request from a different channel. This behavior applies to all profiles except the MACsec profile.

Table 25.  Interleave Example: Traffic Pattern Format for MACsec and GCM ProfilesThe table shows the interleaving of MACsec and GCM profiles. In MACsec profile, the pattern format specified above is not guaranteed.
Profile MACsec GCM GCM GCM GCM MACsec
TID[15:0]

(Stream)

0 N/A N/A N/A N/A 0
TID[9:0]

(Channel)

1 67 67 68 68 1
DATA
Data[127:0] DATA (Pkt 0) AAD MAC AAD MAC MAC
Data[255:128] DATA (Pkt 0) DATA IDLE DATA IDLE DATA
Data[383:256] DATA (Pkt 0) DATA IDLE DATA IDLE DATA
Data[511:384] p_vld_data p_vld_data IDLE p_vld_data IDLE DATA
Table 26.  MACsec Profile Example for Egress Packet: 16 bytes MAC spread across 2 clock cyclesThe example shows the 4th segment on the first clock cycle and the 1st segment on the second clock cycle. The mac_iv_tweak_en signal asserts for both clock cycles.
Profile MACsec MACsec MACsec
TID[15:0]

(Stream)

0 N/A N/A
TID[9:0]

(Channel)

1 1 1
mac_iv_tweak_en 1 1 0
DATA
Data[127:0] DATA (Pkt 0) MAC, IDLE DATA (Pkt 0)
Data[255:128] DATA (Pkt 0) IDLE DATA (Pkt 0)
Data[383:256] DATA (Pkt 0) IDLE DATA (Pkt 0)
Data[511:384] p_vld_data, MAC IDLE DATA (Pkt 0)