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
<campos@sopmac.de>
- Lars Jellema
<lars.jellema@gmail.com>
- Mauk Lemmen
<m.lemmen@student.ru.nl>
- Lars Müller
<mail@lars-mueller.com>
- Daan Sprenkels
<d.sprenkels@cs.ru.nl>
- Benoit Viguier
<b.viguier@cs.ru.nl>
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] sifive
to generate the correctMakefile
and dependencies. - Compile with
make
- Plug your SiFive board, you should see a
/dev/ttyUSB0
and/dev/ttyUSB1
appear. - In the second terminal, execute
./watch.sh
.
This will start ascreen
onttyUSB1
and log the output intomain.log
- In the first terminal, execute
make upload
(may need sudo).
This will uploadmain.elf
to 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 murax
to generate the correctMakefile
and dependencies. - In terminal 1, Compile with
make
- In terminal 2, run
make startsim
to boot the simulator - In terminal 3, once the you read
WAITING FOR TCP JTAG CONNECTION
in terminal 2, runmake openocd
to 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 spike
to generate the correctMakefile
and dependencies. - Compile with
make RISCV_ARCH=rv64gcb
in order to build a version using the B extension ormake RISCV_ARCH=rv64gc
to build a version without the B extension. - Execute
make startsim RISCV_ARCH=rv64gcb
in order to simulate using the the B extension ormake startsim RISCV_ARCH=rv64gc
to simulate w/o B extension. The corresponding binary (see step 4) should be available.