license:cc-by-4.0 size_categories:100K<n<1M region:us AES RISC-V Dynamic-Frequency-Scaling Side-Channel-Analysis
---
license: cc-by-4.0
tags:
- AES
- RISC-V
- Dynamic-Frequency-Scaling
- Side-Channel-Analysis
pretty_name: DFS_DESYNCH
size_categories:
- 100K<n<1M
configs:
- config_name: DFS_DESYNCH
  data_files: "dfs_desynch/*.h5"
viewer: false
---

# DFS_DESYNCH

The `DFS_DESYNCH` dataset contains power traces of a software AES implementation running on a 32-bit RISC-V System-on-Chip (SoC).
The SoC incorporates a Dynamic Frequency Scaling (DFS) unit that randomly adjusts the operating frequency between 35MHz and 60MHz.

- **Curated by:** hardware-fab
- **License:** Open Data Commons License [cc-by-4.0](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/cc-by-4.0.md)
- **Repository:** DLaTA methodology [GitHub](https://github.com/hardware-fab/DLaTA)
- **Paper:** [A Deep Learning-assisted Template Attack Against Dynamic Frequency Scaling Countermeasures](https://doi.org/10.1109/TC.2024.3477997)

The dataset is designed to aid research in side-channel analysis methodologies.  
DFS_DESYNCH was created to support the DLaTA methodology [[1]](https://huggingface.co/datasets/hardware-fab/DFS_DESYNCH#note) for resynchronizing power traces collected under frequency scaling.
The code for DLaTA is publicly available on [GitHub](https://github.com/hardware-fab/DLaTA).

## How to Download

1. Download dataset.

    ```python
    from datasets import load_dataset

    dataset = load_dataset("hardware-fab/DFS_DESYNCH")
    ```

2. Assemble dataset chunks in one (virtual) dataset file.

    ```bash
    python assemble.py --dataset_dir <download_path>
    ```

    Replace `<download_path>` with the actual download path.

## Dataset Structure

The dataset has the following structure:
- **Profiling and Attack groups:** The traces are separated into two main groups: "profiling" and "attack". Each group contains 128,000 traces for a total of 256,000 traces.
- **Three Datasets per group:** Each group ("profiling" and "attack") consists of three internal datasets:
  - **traces:** This dataset includes 128,000 power traces, each containing 200,000 time samples. The traces capture the entire AES encryption process preceded by a sequence of random instructions. The traces are pre-processed with a high-pass filter with a 125 kHz cut-off frequency.
  - **labels:** This dataset provides labels for each power trace in the "traces" dataset, indicating the frequency changes that occurred during the measurement. Each label has two fields:
    - `sample`: This field denotes the time sample at which a frequency change happens, with values ranging from 0 to 200,000.
    - `frequency`: This field specifies the new operating frequency starting from the corresponding sample. It can take values from the set {35, 40, 45, 50, 55, 60}.
  - **metadata:** This dataset contains metadata for each trace, including two members:
    - `key`: The secret key used for AES encryption.
    - `plaintext`: The plaintext used for the AES encryption.

### Dataset Format

The dataset is stored in the HDF5 file format.
To alleviate the size of the file, we partitioned the dataset into 32 files based on the cryptographic key.
Keys are 16-byte arrays, we vary only the first byte keeping the remaining 15 fixed.

| Chunk          | First key byte values | Disk size (GB) | # Data  |
|----------------|----------------|----------------|----------------|
| dfs_desynch_chunk_0.h5  | [0x00-0x07] | 6.4  | 8k |  
| dfs_desynch_chunk_1.h5  | [0x08-0x0f] | 6.4  | 8k |  
| dfs_desynch_chunk_2.h5  | [0x10-0x17] | 6.4  | 8k |  
| dfs_desynch_chunk_3.h5  | [0x18-0x1f] | 6.4  | 8k |  
| dfs_desynch_chunk_4.h5  | [0x20-0x27] | 6.4  | 8k |  
| dfs_desynch_chunk_5.h5  | [0x28-0x2f] | 6.4  | 8k |  
| dfs_desynch_chunk_7.h5  | [0x30-0x37] | 6.4  | 8k |  
| dfs_desynch_chunk_7.h5  | [0x38-0x3f] | 6.4  | 8k |  
| dfs_desynch_chunk_8.h5  | [0x40-0x47] | 6.4  | 8k |  
| dfs_desynch_chunk_9.h5  | [0x48-0x4f] | 6.4  | 8k |  
| dfs_desynch_chunk_10.h5 | [0x50-0x57] | 6.4  | 8k |  
| dfs_desynch_chunk_11.h5 | [0x58-0x5f] | 6.4  | 8k |  
| dfs_desynch_chunk_12.h5 | [0x60-0x67] | 6.4  | 8k |  
| dfs_desynch_chunk_13.h5 | [0x68-0x6f] | 6.4  | 8k |  
| dfs_desynch_chunk_14.h5 | [0x70-0x77] | 6.4  | 8k |  
| dfs_desynch_chunk_15.h5 | [0x78-0x7f] | 6.4  | 8k |  
| dfs_desynch_chunk_16.h5 | [0x80-0x87] | 6.4  | 8k |  
| dfs_desynch_chunk_17.h5 | [0x88-0x8f] | 6.4  | 8k |  
| dfs_desynch_chunk_18.h5 | [0x90-0x97] | 6.4  | 8k |  
| dfs_desynch_chunk_19.h5 | [0x98-0x9f] | 6.4  | 8k |  
| dfs_desynch_chunk_20.h5 | [0xa0-0xa7] | 6.4  | 8k |  
| dfs_desynch_chunk_21.h5 | [0xa8-0xaf] | 6.4  | 8k |  
| dfs_desynch_chunk_22.h5 | [0xb0-0xb7] | 6.4  | 8k |  
| dfs_desynch_chunk_23.h5 | [0xb8-0xbf] | 6.4  | 8k |  
| dfs_desynch_chunk_24.h5 | [0xc0-0xc7] | 6.4  | 8k |  
| dfs_desynch_chunk_25.h5 | [0xc8-0xcf] | 6.4  | 8k |  
| dfs_desynch_chunk_26.h5 | [0xd0-0xd7] | 6.4  | 8k |  
| dfs_desynch_chunk_27.h5 | [0xd8-0xdf] | 6.4  | 8k |  
| dfs_desynch_chunk_28.h5 | [0xe0-0xe7] | 6.4  | 8k |  
| dfs_desynch_chunk_20.h5 | [0xe8-0xef] | 6.4  | 8k |  
| dfs_desynch_chunk_30.h5 | [0xf0-0xf7] | 6.4  | 8k |  
| dfs_desynch_chunk_31.h5 | [0xf8-0xff] | 6.4  | 8k |  

Following the structure of the dataset, below are HDF5 fields used and their atomic type:

```
.  
├── profiling  
│    ├── traces [float32]
│    ├── labels [('sample', uint32), ('frequency', uint32)]  
│    └── metadata [('key', np.uint8, (16,)), ('plaintext', np.uint8, (16,))]
└── attack  
     ├── traces [float32]
     ├── labels [('sample', uint32), ('frequency', uint32)]  
     └── metadata [('key', np.uint8, (16,)), ('plaintext', np.uint8, (16,))]    
```

## Dataset Collection

The data are collected from a real-world hardware-software infrastructure.
The setup comprises a host PC,
a [Picoscope 5244d](https://www.picotech.com/download/datasheets/picoscope-5000d-series-data-sheet.pdf)
digital sampling oscilloscope (DSO), and
a [NewAE CW305](https://rtfm.newae.com/Targets/CW305%20Artix%20FPGA/)
board which hosts an [AMD Artix-7 FPGA](https://docs.amd.com/v/u/en-US/ds180_7Series_Overview).
The board is specifically designed to facilitate the deployment
of digital designs targeting FPGAs and studying their side-channel behavior.
The sampling rate of the DSO is set to 125Msample/s
with a resolution of 12 bits for the entire dataset.

The FPGA implements a system-on-chip consisting of a 1.5Mps UART 
interface to communicate with the host, an in-order 32-bit RISC-V CPU
to execute the user applications, a CLK_LBL_GEN unit to label the
operating frequency digitally, and a DFS actuator to change the
operating frequency at runtime. The DFS actuator is instructed to change 
the operating frequency of the computing platform randomly at its
maximum speed.

As the cryptographic operation of choice, we selected
the [OpenSSL AES implementation](https://github.com/openssl/openssl),
representing the standard for symmetric cryptography.

## Social Impact of Dataset

DFS_DESYNCH has been developed to enhance side-channel security.
Notably, the side-channel analysis represents a standard procedure
for evaluating novel countermeasures. Indeed,
the [NIST FIPS-140v3](https://doi.org/10.6028/NIST.FIPS.140-3)
standard enforces side-channel security as a mandatory step
in the security validation of any novel software- and
hardware-implemented cryptographic device. To this end,
DFS_DESYNCH is a valuable asset in strengthening real-world security
by enabling researchers to identify and address potential
weaknesses in cryptographic implementations.
By promoting the creation of robust countermeasures,
this dataset ultimately contributes to a more secure digital world.

As creating a high-quality training dataset is a fundamental requirement, the quality of DFS_DESYNCH
sits on the time-consuming acquisition process that requires a clean-room acquisition setup and
system-on-chip. Without considering the design time to obtain the implementation of the computing
platform and the working acquisition setup, the time required by the acquisition procedure exceeded
40 hours.

## Citation

```plaintext
@ARTICLE{10713265,
  author={Galli, Davide and Lattari, Francesco and Matteucci, Matteo and Zoni, Davide},
  journal={IEEE Transactions on Computers}, 
  title={A Deep Learning-Assisted Template Attack Against Dynamic Frequency Scaling Countermeasures}, 
  year={2025},
  volume={74},
  number={1},
  pages={293-306},
  doi={10.1109/TC.2024.3477997}
}
```

<!-- **APA:** -->

## Note

This work is part of [1] available [online](https://doi.org/10.1109/TC.2024.3477997).

This repository is protected by copyright and licensed under the
Open Data Commons License [cc-by-4.0](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/cc-by-4.0.md) file.

© 2024 hardware-fab

> [1] D. Galli, F. Lattari, M. Matteucci and D. Zoni, "A Deep Learning-assisted Template Attack Against Dynamic Frequency Scaling Countermeasures," in IEEE Transactions on Computers, doi: 10.1109/TC.2024.3477997.
