This repository contains auxiliary material for the paper "Assembly or Optimized C for Lightweight Cryptography on RISC-V?" which was accepted to CANS 2020.
Authors
- Fabio Campos
<[email protected]> - Lars Jellema
<[email protected]> - Mauk Lemmen
<[email protected]> - Lars Müller
<[email protected]> - Daan Sprenkels
<[email protected]> - Benoit Viguier
<[email protected]>
The paper is available at https://eprint.iacr.org/2020/836.pdf
Have a look at install.sh
We install compilers and libraries in /opt/riscv and in /opt/verilator
First edit config.mk and config.sh to reflect the correct path of the compilers
- Open 2 terminals.
- Execute
./configure.py [SCHEME Folder] [compiler] sifiveto generate the correctMakefileand dependencies. - Compile with
make - Plug your SiFive board, you should see a
/dev/ttyUSB0and/dev/ttyUSB1appear. - In the second terminal, execute
./watch.sh.
This will start ascreenonttyUSB1and log the output intomain.log - In the first terminal, execute
make upload(may need sudo).
This will uploadmain.elfto the board, you should see output on the second terminal. - To compile for another scheme, execute
make clean, this will remove any generated file (including theMakefile)
main-valid.elf to "reset" the board in a working state. To flash it on the board, simply do make reset.
- Open 3 terminals.
- Execute
./configure.py [SCHEME Folder] gcc muraxto generate the correctMakefileand dependencies. - In terminal 1, Compile with
make - In terminal 2, run
make startsimto boot the simulator - In terminal 3, once the you read
WAITING FOR TCP JTAG CONNECTIONin terminal 2, runmake openocdto start openocd. - In terminal 1, once you read
Info : Listening on port 4444 for telnet connections, runmake flash. This will upload the binary to the simulator. - In terminal 2, you should see the result of the execution.
This simulator requires compilation with GCC and with -O2 instead of -O3
- Execute
./configure.py [SCHEME Folder] [compiler] riscvOVPsim - Execute
make startsim
- Clone the "RISC-V Bitmanip (Bit Manipulation) Extension"
git clone https://github.com/riscv/riscv-bitmanip. - Build and install the tools following the instructions from https://github.com/riscv/riscv-bitmanip/tree/master/tools.
- Execute
./configure.py [SCHEME Folder] gcc_b spiketo generate the correctMakefileand dependencies. - Compile with
make RISCV_ARCH=rv64gcbin order to build a version using the B extension ormake RISCV_ARCH=rv64gcto build a version without the B extension. - Execute
make startsim RISCV_ARCH=rv64gcbin order to simulate using the the B extension ormake startsim RISCV_ARCH=rv64gcto simulate w/o B extension. The corresponding binary (see step 4) should be available.