ChaCha20Poly1305-IP Demo Instruction

 

1      Environment Setup. 2

2      FPGA Development Board Setup. 3

3      Nios Command Shell 4

4      Command Details and Test Results. 5

4.1   Change Mode. 5

4.2   Edit Key. 6

4.3   Edit IV. 6

4.4   Edit AAD & Data. 7

4.5   Show AAD & Data. 9

4.6   Execute Operation. 10

4.6.1     Encrypt 10

4.6.2     Decrypt 11

4.6.3     Bypass. 12

4.6.4     Speed Test 13

5      Revision History. 14

 


 

This document describes the instruction to demonstrate the operation of ChaCha20Poly1305-IP Arria10 SoC Board. In the demonstration, ChaCha20Poly1305-IP is used to encrypt/decrypt data between two memories in FPGA and provide authentication tag. User can fill memory with Additional Authenticated Data (AAD) and Input Data, set encryption/decryption key and Initialization Vector (IV), and control test operation via serial console.

1        Environment Setup

To operate ChaCha20Poly1305-IP demo, please prepare the following test environment.

1)      FPGA development board

2)      Test PC.

3)      Micro USB cable for JTAG connection between FPGA board and Test PC.

4)      Quartus programmer for programming FPGA and Nios command shell, installed on PC.

5)      Demo configuration file (To download this file, please visit our web site at www.design-gateway.com).

Figure 1 ChaCha20Poly1305-IP demo environment on Arria10 SoC board


 

2        FPGA Development Board Setup

1)      Make sure power switch is off and connect power supply to FPGA development board.

2)      Connect USB cables between FPGA board and PC via micro-USB ports.

3)      Turn on power switch for FPGA board.

4)      Open Quartus Programmer to program FPGA through USB-1 by following step.

i).       Click “Hardware Setup…” to select USB-BlasterII [USB-1]

ii).      Click “Auto Detect” and select FPGA number.

iii).     Select FPGA device icon.

iv).    Click “Change File” button, select SOF file in pop-up window and click “open” button.

v).      Check “program”.

vi).    Click “Start” button to program FPGA.

vii).   Wait until Progress status is equal to 100%.

Figure 2 Program device

For A10SoC, after the SOF file has been programmed, Quartus Prime will show popup message of Intel FPGA IP Evaluation Mode Status as shown in Figure 3. Please do not press cancel button.

Figure 3 Intel FPGA IP evaluation mode status


 

3        Nios Command Shell

User can fill RAMs with AAD, IV, Input Data, and encryption/decryption key via Nios II Command Shell. The current parameters are shown together with the available options in the main menu as shown in Figure 4. The details of each menu are described in topic 4.

Figure 4 Main menu on Nios II Command Shell


 

4        Command Details and Test Results

4.1      Change Mode

Select “Change Mode” from the main menu to switch the ChaCha20Poly1305-IP operation mode. The available options are shown in Figure 5.

1)       ENCRYPT: Encrypts Input Data stored in memory.

2)       DECRYPT: Decrypts Input Data stored in memory.

3)       BYPASS: Bypasses Input Data stored in memory without encryption or decryption.

4)       SPEED TEST: Evaluates the computational efficiency of the ChaCha20Poly1305-IP when processing large volumes of data.

Figure 5 Change mode menu


 

4.2      Edit Key

The steps to edit key are as follows

1)     Select “Edit Key”.

2)     Enter up to 256-bit key value in hexadecimal format as shown in Figure 6.

3)     After pressing Enter, the new key value will be updated and displayed in the main menu.

Figure 6 Key setting example

4.3      Edit IV

The steps to edit IV are as follows

1)     Select “Edit IV”.

2)     Enter up to 96-bit IV value in hexadecimal format as shown in Figure 7.

3)     After pressing Enter, the new IV value will be updated and displayed in the main menu.

Figure 7 IV setting example


 

4.4      Edit AAD & Data

Select “Edit AAD & Data” to update AAD and Data in memory. Users must update both AAD and Data in this menu. Editing differs by mode:

Speed Test Mode:

1)     Enter AAD size (bytes) and press Enter.

2)     Enter Data size (bytes) as shown in Figure 8 and press Enter.

3)     After both inputs, the new sizes are updated and shown in the main menu.

Other Modes:

1)     Enter AAD value in hexadecimal and press Enter.

2)     Enter Data value in hexadecimal as shown in Figure 9 and press Enter.

3)     After both inputs, the new values and sizes are updated and shown in the main menu.

Notes:

·       Combined AAD + Data size cannot exceed 16 KB.

·       In Decrypt mode, Data is treated as Ciphertext; in Encrypt mode, it is Plaintext.

·       In Speed Test Mode, the entered AAD size and Data size can be any value; the IP rounds each size up to the nearest 16-byte alignment.

Figure 8 AAD & Data setting example in Speed Test mode

Figure 9 AAD & Data setting example in other modes

4.5      Show AAD & Data

The steps to show AAD & Data in memory are as follows:

1)     Select “Show AAD & Data”

2)     Enter the number of bytes to display (or press Enter to display all).

3)     The AAD and Data values are shown in table form as shown in Figure 10.

4)     After pressing Enter, the console will return to the main menu.

Figure 10 Show AAD & Data example


 

4.6      Execute Operation

Select “Execute Operation” to start the operation in the currently selected mode.

4.6.1     Encrypt

In Encrypt mode, the IP uses the current key and IV to encrypt the Input Data in memory. The Output Data (Ciphertext) and 128-bit authentication tag are displayed as shown in Figure 11.

Figure 11 Encryption mode result


 

4.6.2     Decrypt

In Decrypt mode, the IP uses the current key and IV to decrypt the Input Data in memory. The Output Data (recovered Plaintext) and the 128-bit authentication tag are displayed as shown in Figure 12.

Figure 12 Decryption mode result

4.6.3     Bypass

In Bypass mode, the IP simply passes the Input Data from memory to output memory without any encryption or decryption. Both Input Data and Output Data are displayed as shown in Figure 13.

Figure 13 Bypass mode result


 

4.6.4     Speed Test

In Speed Test mode, the IP ignores the actual AAD and Data values. Only the entered sizes, together with the current key and IV, are used to run the encryption process. The console shows the execution time and calculated throughput, as shown in Figure 14.

Figure 14 Speed Test mode result


 

5        Revision History

Revision

Date (D-M-Y)

Description

1.00

31-Jul-26

Initial version release