[svsm-devel] Using crates in SVSM kernel
Jörg Rödel
joro at 8bytes.org
Tue Apr 8 11:20:42 CEST 2025
Hey John,
On Mon, Apr 07, 2025 at 02:46:51PM -0500, John Allen wrote:
> I am new to the project and embedded rust in general. I'm working with
> Pankaj G. on SVSM support for SNP live migration and I'm starting to
> sketch out some code for key exchange, but I'm learning that many crates
> available in non-embedded rust depend on std or on OS abstractions. For
> example, I want to generate a ecdsa p384 key using the p384 crate, but
> this depends on "get_random" which relies on a whitelist of supported
> targets to determine the rng method. This is just one of several crates
> that I would have liked to use, but depend on std or are incompatible
> with the "x86_64-unknown-none" target.
>
> What is best practice when it comes to including libraries like this?
> What options do we have here other than reimplementing functionality
> from these crates or is reimplementation the expected course of action
> in this environment?
You are right that currently there is not support for the Rust standard
library in the COCONUT environment. This comes from the nature of the
project which is more on an OS kernel level than a binary for an
ordinary target.
There is currently work underway to enable support for the Rust standard
library for user-mode binaries running on the COCONUT platform, but that
is not ready for use yet.
So the options are to either wait for this support to materialize or (as
Stefano pointed out) use Rust libraries which support a no_std
environment.
Regards,
Joerg
More information about the Svsm-devel
mailing list