Skip to content

Instantly share code, notes, and snippets.

@dsprenkels
Last active September 5, 2022 11:59
Show Gist options
  • Save dsprenkels/21209d4e70bb0403b30dabe38a8995b7 to your computer and use it in GitHub Desktop.
Save dsprenkels/21209d4e70bb0403b30dabe38a8995b7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# install.sh
#
# Installation instruction for getting Ethan's Dilithium code up and running.
#
# Author: Amber Sprenkels <[email protected]>
# Date: 17 May 2022
# shellcheck disable=SC2164,SC2155
echo "error: This file contains documentation. It is not meant to be run."
exit 1
# Install and start Docker
yay -S docker
sudo systemctl start docker.service
sudo docker pull nixos/nix
sudo docker create \
--tty \
--interactive \
--name nixos \
--user "$(id --user):$(id --group)" \
--volume "$(pwd)":/workspace \
nixos/nix bash
sudo docker start nixos --attach --interactive # Start and open a regular shell
sudo docker exec --user root --tty --interactive nixos bash # Open a root shell
# Inside the container
cd /workspace
git clone --recursive https://github.com/jasmin-lang/jasmin.git
git checkout v2022.04.0
# Install jasmin using nix
cd /workspace/jasmin
nix-channel --update
nix-env --install ncurses
nix-shell
# Build jasmin compiler
cd /workspace/jasmin/compiler
make CIL
make all
# Get Ethan's code
git clone --recursive http://github.com/ethanlee515/jasmin-dilithium
cd jasmin-dilithium
# Build a reference impl of Dilithium first
make -C dilithium/ref shared randombytes.o
PATH=/workspace/jasmin/compiler:$PATH
export LD_LIBRARY_PATH="$(pwd)/dilithium/ref:$LD_LIBRARY_PATH"
# Make and run some tests
cd tests
make test_keygen test_sign && ./test_keygen && ./test_sign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment