Skip to content

vector-sdk/rust-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Rust SDK for building Keystone enclave applications

This project aims to provide a Rust programming language SDK for building Keystone enclave and host applications for the RISC-V architecture.

The SDK is designed to be compatible with the Keystone Eyrie Modular Runtime (available in subdirectory runtime).

NOTE: This work is experimental and on a very early stage. The security of the API or its implementation has not been properly verified yet. Therefore, Do not use in production!

Prerequisites

Bulding Keystone

The Rust SDK is compatible with the Keystone enclave. You can use either the upstream Keystone version or a custom fork. The custom version includes patches that are not yet merged into the upstream repository. For example, support for the StarFive VisionFive2 development board. This setup has been tested with both QEMU and the StarFive VisionFive2 board.

Custom Keystone repository

Download or clone custom Keystone. Build for QEMU:

make

Alternatively, build for the StarFive VisionFive2 development board:

scripts/build_visionfive2.sh

Upstream Keystone repository

Download or clone and build Keystone for QEMU environment using instructions given in Keystone documentation.

Install RISC-V toolchains

If you are using Ubuntu, make sure that you have basic development environment support by installing the following essiential packages:

sudo apt install build-essential
sudo apt install crossbuild-essential-riscv64

Install also toolchain files:

sudo apt install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross
sudo apt install gcc-riscv64-unknown-elf

Install Rust

This project uses an experimental Rust feature (per-package-target) that is only available in Rust's nightly build. The current version has been tested with Rust 1.92. Use rustup to install the Rust environment and add required RISC-V targets.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default nightly
rustup target add riscv64gc-unknown-none-elf
rustup target add riscv64gc-unknown-linux-gnu

Build SDK crates

Using cargo:

cargo build --release

Using make:

make

Test

Test with Rust SDK demo application!

Cleanup

Using cargo:

cargo clean

Using make:

make clean

More information

The first version is described in an early conference paper:

Julku, J. and Kylänpää, M. (2023). Towards a Rust SDK for Keystone Enclave Application Development. In Proceedings of the 9th International Conference on Information Systems Security and Privacy - ICISSP; ISBN 978-989-758-624-8; ISSN 2184-4356, SciTePress, pages 29-37. DOI: 10.5220/0011611900003405

Acknowledgment

This work is partly supported by the European Union’s Horizon Europe research and innovation programme in the scope of the the CONFIDENTIAL6G project under Grant Agreement 101096435.

About

A Rust SDK for building Keystone enclave applications

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors