Acting as a component part of the wider
SCARV
project,
libscarv
is a library of cryptographic reference implementations for
RISC-V generally, and the SCARV-related cryptographic ISE
XCrypto
specifically; the implementations are written in a mixture of C and/or
assembly language.
Note that libscarv
definitely isn't a library you'd expect (or want)
to see in production code: it's really only intended for internal use,
e.g., as
a) a guide for (e.g., ISE) design and implementation work,
plus
b) a resource for benchmarking and evaluation.
One could therefore view it as a cryptography-specific analogue of more
general-purpose alternatives, e.g., the
Embench
benchmark.
├── bin - scripts (e.g., environment configuration)
├── build - working directory for build
├── conf - global, architecture-specific configuration
└── src
├── docker - source code for containers
├── libscarv - source code for libscarv library
│ ├─ block - block ciphers
│ ├─ hash - hash functions
│ ├─ mp - multi-precision integer arithmetic
│ ├─ share - shared functions, macros, etc.
│ └─ stream - stream ciphers
└── test - source code for libscarv test suite
├─ block - block ciphers
├─ hash - hash functions
├─ mp - multi-precision integer arithmetic
├─ share - shared functions, macros, etc.
└─ stream - stream ciphers
Quickstart (with more detail in the wiki)
-
Either
-
provide a native build context by installing associated pre-requisites, e.g.,
-
a suitable compiler and simulator tool-chain, e.g.,
-
for the
riscv
target architecture,- build and install
riscv/riscv-tools
, then - export the
RISCV
environment variable st.${RISCV}/bin
houses the associated executables,
- build and install
-
for the
riscv-xcrypto
target architecture,- build and install
scarv/riscv-tools
, then - export the
RISCV_XCRYPTO
environment variable st.${RISCV_XCRYPTO}/bin
houses the associated executables,
- build and install
-
-
a Python 3 distribution,
-
the Doxygen documentation generation system.
and/or
-
-
provide a Docker build context by installing the Docker container platform.
-
-
Execute
git clone https://github.com/scarv/libscarv.git ./libscarv cd ./libscarv source ./bin/conf.sh
to clone and initialise the repository, then configure the environment; for example, you should find that the
REPO_HOME
environment variable is set appropriately. -
Perform various preparatory steps:
-
Create and populate a suitable Python virtual environment based on
${REPO_HOME}/requirements.txt
by executingmake venv
then activate it by executing
source ${REPO_HOME}/build/venv/bin/activate
-
Optionally, select the build context by setting the
CONTEXT
environment variable appropriately, e.g., viaexport CONTEXT="native"
or just accept the default(s) per
${REPO_HOME}/Makefile
. -
Optionally, select the target architecture and library content (i.e., the set of kernels included) by setting the
ARCH
andKERNELS
environment variables appropriately, e.g., viaexport ARCH="riscv" export KERNELS="block/aes hash/sha*"
or just accept the default(s) per
${REPO_HOME}/Makefile
.
-
-
Use targets in the top-level
Makefile
to drive a set of common tasks, e.g.,Command Description make doc
build the Doxygen-based documentation make venv
build the Python virtual environment make build-libscarv
build the libscarv
librarymake build-test
build the libscarv
test suitemake generate-test
generate the libscarv
test suite (i.e., produce meta-program from test executable)make generate-test
validate the libscarv
test suite (i.e., execute meta-program)make clean
clean-up (e.g., remove everything built in ${REPO_HOME}/build
)
This work has been supported in part by EPSRC via grant EP/R012288/1 (under the RISE programme).