GPU Accelerated AES Algorithm

Canhui Wang, Xiaowen ChuarXiv 2019

Abstract

The Advanced Encryption Standard (AES) is a critical component of modern digital security, yet its computational demands can create bottlenecks in high-volume data environments. This paper investigates the acceleration of AES using NVIDIA GPUs through the CUDA framework. By employing Electronic Code Book (ECB) mode, "one state per thread" granularity, and optimized memory allocation—specifically placing precomputed look-up tables in constant memory—the proposed implementation achieves throughput speeds exceeding 220 MB/s. This represents a significant performance gain, outperforming traditional CPU-based implementations by over 30x for large-scale data processing.

Introduction

As data volumes continue to grow exponentially, the efficiency of cryptographic algorithms like AES becomes paramount. While traditional CPUs handle sequential tasks well, they often struggle with the massive parallelism required for high-throughput encryption. Graphics Processing Units (GPUs), with their thousands of cores, present a compelling alternative. However, porting AES to a GPU requires addressing challenges in parallel granularity and memory hierarchy optimization to avoid latency bottlenecks.

Methodology

The implementation utilizes the Compute Unified Device Architecture (CUDA) to parallelize AES encryption and decryption. The design is centered on three primary optimizations:

1. Parallel Mode Selection

The authors selected the Electronic Code Book (ECB) mode due to its inherent parallelizability. Unlike modes such as Cipher Block Chaining (CBC), where each block depends on the previous one, ECB allows every 16-byte block to be processed independently. This makes it "embarrassingly parallel" and ideal for GPU architectures.

2. T-Box Implementation

To minimize on-the-fly mathematical computations (such as SubBytes and MixColumns), the implementation uses precomputed "T-Tables." These tables map complex transformations to simple memory lookups. The underlying mathematical structure of these transformations relies on Galois Field representations, where polynomials are mapped to bit-tuples and integers.

Mapping of polynomials to tri-tuples and integers in AES mathematical foundations.

3. Memory Hierarchy Optimization

Efficient data access is crucial for GPU performance. The implementation leverages:

  • Constant Memory: Used for T-Tables and Round Keys to provide high-speed, cached access for all threads.
  • Registers: Used for the active 16-byte state within each thread, providing the lowest possible latency.

Benchmarking and Results

The system was tested using generated files ranging from approximately 1KB to 1.2MB on an NVIDIA GeForce 940MX GPU and an Intel i5-7200U CPU.

  • Throughput: For a 1.2MB file, the GPU achieved an encryption throughput of 223.9 MB/s, compared to the CPU's 7.5 MB/s—a nearly 30x improvement. Decryption showed a similar 39x speedup.
  • Scaling: GPU performance scales dramatically with file size. While the CPU performance remained relatively flat, the GPU's throughput increased by over 130x as the workload grew from 1KB to 1MB, demonstrating its efficiency in high-load scenarios.
  • Overhead: For small files (under 4KB), the CPU remains faster due to the overhead associated with data transfer between the host (CPU) and device (GPU).

Conclusion and Future Work

This research demonstrates that GPUs can significantly accelerate AES when the implementation is tailored to the hardware's strengths. While ECB mode was used for its parallel simplicity, its security limitations (pattern leakage) suggest that future work should focus on Counter Mode (CTR), which offers similar parallel capacity with improved security. Additionally, exploring shared memory for T-Table storage could further reduce access latencies on high-end hardware.

Summary updated

BibTeX
@misc{wang2019gpu,
  author = {Canhui Wang and Xiaowen Chu},
  title = {{GPU Accelerated AES Algorithm}},
  year = {2019},
  eprint = {1902.05234},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.05234},
}
Figure