HYDRA: multi-core RISC-V with cryptographically interesting modes of operation
Multi-core processor designs often represent an efficient, flexible solution for general-purpose workloads. Based on the premise that multi-core processors are generally viable as an implementation platform for cryptography, this work investigates specific instances dubbed HYDRA which harness the concept of Composable Lightweight Processors to support three cryptographically useful composition modes, namely, Redundant, Simd, and Widen data-path. So, HYDRA can also operate in the modes specifically designed to address domain-specific challenges relating to efficiency and security while retaining characteristics which stem from a generic multi-core design. The Architecture Diagram of HYDRA is illustrated below:
The Repo. contains the source code of a framework to implement the HYDRA system and evaluate its supporting modes. We presented this work in [1].
├── bin - scripts (e.g., environment configuration)
├── board - the flows to implement the SoC system on specific supported boards: sakura-x, arty, iceFUN
├── build - working directory for build
├── docs - consists of figures and other documents
├── rtl - Verilog rtl code of HYDRA SoC system
└── src - ASM/C code of software to test and evaluate the HYDRA system
├── hal - source code for SoC hardware abstract layer
├── redundant - source code for AES encryption run in the HYDRA redundant mode
├── simd - source code for ChaCha20 encryption run in the HYDRA Simd mode
└── wide_data - source code for multi-precision algorithms run in the HYDRA widen data-path mode
-
For seting up the repository
-
Clone the repository and setup environment
git clone https://github.com/scarv/hydra ./hydra cd ./hydra source bin/conf.sh
-
Fix paths for the RV32IM RISCV toolchains, Iverilog root and Vivado Tool, e.g.,
export RISCV=/opt/riscv export PATH=/opt/iverilog/build/bin:$PATH export VIVADO_TOOL_DIR=/opt/Xilinx/Vivado/2018.2 source $VIVADO_TOOL_DIR/settings64.sh
-
-
Run a software, e.g., multi-precision algorithms (in the wide_data mode), or ChaCha20 (in the SIMD mode) on HYDRA to evaluate the performance on a FPGA platform:
- Compile a test case
TESTCASE=[wide_data|simd] make software
- Build the system on FPGA using Sakura-x, and generate bitstream including the testcase compiled binary
make sakura-x
- Program the bitstream on Sakura-x
make program-sakura-x
- Open another terminal to observe the result
microcom -p /dev/ttyUSB0 -s 9600
-
For software development and debug avoiding FPGA re-implementation process, compile and update software for FPGA as belows:
TESTCASE=[wide_data|simd] make -B software make bit-update make update-program
-
Evaluate the fault detection in the redundant mode of HYDRA using the iverilog simulation.
- Compile and run unprotected AES encryption under the PC-fault injection attack
TESTCASE=redundant ACT="-DPC_FAULT_INJ" make -B simulate
Or compile and run unprotected AES encryption under the data-fault injection attack
TESTCASE=redundant ACT="-DREG_FAULT_INJ" make -B simulate
- Compile and run protected AES encryption on the HYDRA, configured with the redundant mode, under the PC- or data-fault injection attacks
TESTCASE=redundant MODE=PROTECTED ACT="-D[PC_FAULT_INJ|REG_FAULT_INJ]" make -B simulate
-
Cycle and instruction counts compared across a single core and the HYDRA composed wide data-path mode configured with 2 cores and 4 cores. The multi-precision algorithms with 1024-bit operands are used.
1024-bit Operations Metric Single Core 2-core composed System 4-core composed System Addition Instructions
Cycles431
2023228
1225124
843Multiplication Instructions
Cycles15822
1793954083
724901091
32086ModExp Instructions
Cycles57395054
59483839515019653
2382937654144180
106391562 -
Comparison of ChaCha20 encryption performance in Single Core, 128-bit vector System and the HYDRA composed SIMD mode configured with 2 cores and 4 cores for different message sizes
Message size Metric Single Core 2-core composed System 4-core composed System 128-bit Vector 64 bytes Instructions
Cycles1765
176031199
11905659
7609607
-256 bytes Instructions
Cycles6919
695244637
464352537
296592332
-1024 bytes Instructions
Cycles27535
27720818389
18455510049
1178599232
- -
Results of unprotected and protected AES encryption against control flow and data fault injections. The protected AES encryption is executed in the HYDRA composed redundant mode to detect a fault happened in one composed core. The results reports 100 fault cases where a fault is injected into the program counter (resp. a general purpose register) in a Control flow fault case (resp. Data fault case)
- Control flow fault case
Implementations Passed Failed Broken Detected Unprotected AES 30 62 8 -- Protected AES 12 0 2 87 - Data fault case
Implementations Passed Failed Broken Detected Unprotected AES 42 29 29 -- Protected AES 46 0 0 54
This work has been supported in part by EPSRC via grant EP/R012288/1 (under the RISE programme).