Symmetric Cryptographic Intel FPGA Hard IP User Guide

ID 714305
Date 10/02/2023
Public
Document Table of Contents

6.2.1. AXI-ST Interface Using IP Security (IPsec) Profile Pattern

This section describes the IPsec-specific input and output signals. The Symmetric Cryptographic IP core samples all TUSER signals at the start of the packet.
Table 37.  IP Security Pattern Interface Signals
Signal Name Direction Description
algorithm_type Input/Output Indicates the cryptographic operation mode for the corresponding cycle.
  • 0: AES
  • 1: SM4
encrypt_decrypt Input/Output Indicates the type of cryptographic operation for the corresponding cycle.
  • 0: Encrypt
  • 1: Decrypt
key_128b_256b Input/Output Indicates the key size. The signal is only valid when the key_en signal is set to 1.
  • 0: 128 bit key
  • 1: 256 bit key
Note: The SM4 algorithm only supports 128 bit key size.
pattern[2:0] Input/Output
Pattern ID: Indicates the pattern profile selected for the current clock cycle.
  • 3'b011 = IPSEC: IP Security pattern
When the signal switches from the IDLE state to the IPSEC state, indicates that the data associated in the given clock cycle is related to the IP Security. In this mode, the Symmetric Cryptographic IP core expects you to stream in the full packet until the tlast signal is asserted.

When in this mode, the profile switching on a clock by clock basis is not supported.

TID[9:0] Input/Output Indicates the channel you want to use for IPsec. This bus can also track the output packets.
TID[25:16] Input Channel ID. Indicates to the logic which Crypto channel or slot is the old packet when there are 2 packets in same cycle.
Note: If you send back-to-back packets, you must use different channels to ensure the pipeline is not affected by the new key that is being programmed.
key_en Input For IPSec profile, when key_en is set, the data field starts with the key that required for this encryption (with or without authenticate) or decryption (with or without authenticate) stream. The key_en signal must be set when the pattern switches to IPSec for one clock before data_en is asserted. In IPSec pattern, the key sizes allowed are either 128 bits or 256 bits and you must assert the wire key_128b_256b to indicate the key size. The key is always 128 bit aligned.
Where the key starts in the packet is dependent on whether the previous packet into the subsystem had trailing bytes within this clock cycle. This information is available to the logic via the TLAST, TKEEP and data_en signals.
  • When there are no trailing bytes and when the key_128b_256b indicates 128 bits, the key is present in bits [127:0] in data[511:0] and you must pad 0 to [255:128]. When key_128b_256b indicates 256 bits, the key is present in bits [255:0] of data [511:0].
  • When there are trailing bytes, the key starts from the next 128 bit aligned address.

If the key starts at bit 0, then highest 128 bits (bits 511:384) when key_en is asserted either have the AAD or the data or both for this particular IPSec packet.

Followed by the key in IPSec is a 128 bit aligned IV [96 bits] and AAD Length 32 bits indicating the size of the AAD data.

Note: The AAD and text are packed together with the AAD being byte aligned.
next_packet_en Output When the profile is IPsec and tlast is asserted with a tkeep indicating that there is at least 1 word (128 bits) of free data lines excluding the MAC, this signal indicates that a new packet starts within the same clock. The new packet is 128 bits aligned.
data_en Input Always asserted for input mode.

In output mode, indicates the corresponding clock cycle either only has data or the data following by the authentication tag (MAC).

MAC_IV_tweak_en Input Not used in the IPsec profile.
data_en,

MAC_IV_tweak_en

Output When pattern[2:0] is set to the IP Security profile, indicates that the corresponding clock cycle includes either data only, or data followed by the MAC for the corresponding channel, per TID[9:0] setting.
tlast Input/Output When set, indicates that the data ends (EOP) in the current clock cycle.
Note: The tkeep signal specifies the number of valid bytes in this cycle.
tkeep Input/Output Specifies the number of valid bytes in the current clock cycle.
Table 38.  Decoding data_en and MAC_IV_tweak_en Signals

This table describes the data field decoded based on these signals shown above.

data_en MAC_IV_tweak_en data[511:0]
data_en and MAC_IV_tweak_en as Output Signals
0 0 Reserved
0 1 Bits [127:0] contain the MAC of the requested GCM operation.

If the next_packet_en signal is 0, a new packet does not start in this clock cycle.

1 0 Bits [511:0] contain input data sent to the AES/SM4 Inline Cryptographic Accelerator. The data is any of the following: AAD sent back to your logic, cleartext or ciphertext based on the requested operation.
1 1 Bits [511:0] contain the input data sent to the AES/SM4 Inline Cryptographic Accelerator followed by 128 bits of the MAC. The data is any of the following: AAD sent back to your logic, cleartext or ciphertext based on the requested operation.

You must assert the tlast signal to indicate the end of one packet. The tkeep signal indicates the length of the valid data.

Figure 22. IPsec Profile: Input SignalsThe figure depicts a simple waveform for the IPsec input data.
Figure 23. IPsec Profile: Output SignalsThe figure depicts a simple waveform for the IPsec output data.