This repository presents SPECT, a domain specific processor designed for performing calculations related to Elliptic Curve Cryptography (ECC). SPECT offers dedicated instructions for operations involving 256-bit numbers and modular arithmetic, making it useful for implementing algorithms like ECDSA (Elliptic Curve Digital Signature Algorithm) and ECDH (Elliptic Curve Diffie-Hellman).
-
Download the pre-built binaries:
Visit the releases page and download the binaries for the SPECT compiler and ISS (Instruction Set Simulator) that match your system architecture (either AMD64 or ARM64v7). The binaries are named in the format
spect_compiler_linux_<arch>_<git-tag>
andspect_iss_linux_<arch>_<git-tag>
. -
Rename the Binaries
Rename the binaries to
spect_compiler
andspect_iss
. These names are used by the Makefiles in thets-spect-fw
repository.Open a terminal, navigate to the directory containing the downloaded binaries, and rename them using the
mv
command.mv spect_compiler_linux_amd64_master spect_compiler mv spect_iss_linux_amd64_master spect_iss
-
Make the Binaries Executable:
From the same directory containing the downloaded binaries, make them executable using the
chmod
command.chmod +x spect_compiler chmod +x spect_iss
-
Run the Binaries:
Execute the binary with your desired command-line options.
./spect_compiler --help ./spect_iss --help
-
Optional: Add to $PATH (Convenient Access): For easy access from any directory, add the binary's directory to your system's
$PATH
. Edit your shell configuration file (e.g.,~/.bashrc
):# Replace '/path/to/directory' with the actual path echo 'export PATH="${PATH}:/path/to/directory"' >> ~/.bashrc
Restart your terminal or run
source ~/.bashrc
, and you can usespect_compiler
andspect_iss
from anywhere on your Linux system.When compiling a firmware from
ts-spect-fw
repository usingmake
, the SPECT compiler and instruction set simulator don't have to be visible in a new shell started bymake
. To ensure so, add the binary's directory using absolute path (don't use~
) to the$PATH
variable in your/etc/environment
and restart system. The other way to build the SPECT firmware usingmake
is to specify the absolute path to the binaries in Makefile.
If you prefer to build the SPECT compiler and instruction set simulator from source using Docker, follow these steps:
-
Clone the Repository:
First, make sure you have Git installed on your system and recursively clone this repository to your local machine:
git clone https://github.com/tropicsquare/ts-spect-compiler.git --recurse-submodules cd ts-spect-compiler # Navigate to the repository directory
-
Build the Docker Image:
If Docker is not already installed on your system, you can follow the official Docker installation instructions for your system to get it set up: Docker Installation Guide.
Once docker is installed and configured on your system, build the Docker image from the root of the repository. This image will contain the necessary environment for building SPECT:
docker build -t spect-env . -f Dockerfiles/Dockerfile
-
Build the Binaries Inside the Docker Image:
Once the Docker image is built, you can use it to build the SPECT compiler. Run the following command to build the binaries inside the Docker container:
docker run --rm -v $(pwd):/app -w /app spect-env ./build.sh --clean
This command mounts your current working directory into the Docker container and executes the build process. The resulting binaries will be stored in
<repo_root>/build/src/apps
. -
Make the Binaries Executable:
If necessary, make the generated binaries executable as described in the previous instructions:
chmod +x spect_compiler chmod +x spect_iss
-
Optional: Add Binaries to $PATH:
To easily access these binaries from anywhere, add their directory to your system's
$PATH
as described in the previous instructions:export PATH="${PATH}:$(pwd)/build/src/apps/"
You can also add this line to your shell configuration file (e.g.,
~/.bashrc
or~/.zshrc
) to make the changes persistent. -
Run the Binaries:
Finally, you can run the SPECT compiler and instruction set simulator:
spect_compiler --help spect_iss --help
Before you begin, ensure you have the following prerequisites installed on your system:
-
CMake (version 3.18.2 or higher)
sudo apt-get install cmake
-
C++ compiler (like g++ or clang-*)
sudo apt-get install g++
-
Python (version 3.8 or higher)
sudo apt-get update sudo apt-get install python3-pip
-
Python packages (Jinja2)
pip install jinja2
-
XsltProc
sudo apt-get install xsltproc
Now, follow these steps to build SPECT from source with CMake:
-
Clone the Repository:
First, recursively clone the SPECT repository to your local machine:
git clone https://github.com/tropicsquare/ts-spect-compiler.git --recurse-submodules cd ts-spect-compiler # Navigate to the repository directory
-
Build SPECT:
Use the provided
build.sh
script to build SPECT with CMake:./build.sh --clean
This script will compile SPECT and generate binaries for the compiler
spect_compiler
and the instruction set simulatorspect_iss
in the default build directory, which isbuild/src/apps
. -
Make the Binaries Executable (Optional):
If necessary, make the generated binaries executable as follows:
chmod +x build/src/apps/spect_compiler chmod +x build/src/apps/spect_iss
-
Optional: Add Binaries to $PATH (Convenient Access):
To easily access these binaries from anywhere, you can add their directory to your system's
$PATH
:export PATH="${PATH}:$(pwd)/build/src/apps/"
You can also add this line to your shell configuration file (e.g.,
~/.bashrc
or~/.zshrc
) to make the changes persistent. -
Run the Binaries:
Finally, you can run the SPECT compiler and instruction set simulator using the following commands:
spect_compiler --help spect_iss --help
We appreciate your interest in contributing to the SPECT compiler! Currently, we are not accepting pull requests. However, we are actively considering community contributions and may provide support for them in the future. Stay tuned for updates, and thank you for your understanding.