cocoon-tpm-bssl-bare-sys

Crates.iococoon-tpm-bssl-bare-sys
lib.rscocoon-tpm-bssl-bare-sys
version0.1.0
created_at2025-06-04 13:12:25.993993+00
updated_at2025-06-04 13:12:25.993993+00
descriptionCocoon TPM project - bare BoringSSL FFI bindings
homepagehttps://github.com/coconut-svsm/cocoon-tpm
repositoryhttps://github.com/coconut-svsm/cocoon-tpm
max_upload_size
id1700339
size28,714,552
Nicolai Stange (nicstange)

documentation

README

Cocoon TPM project - bssl-bare-sys crate

bssl-bare-sys is a packaging crate providing a BoringSSL FFI interface to the cocoon-tpm-crypto crate.

Most notably, a copy of BoringSSL -- its libcrypto to be more specific -- will get compiled as part of the build process and a Rust FFI binding generated for it.

Note that the copy of BoringSSL is distributed as a git submodule under the bssl-bare-sys crate, it must get initialized first!

External build requirements are cmake and objcopy from binutils.

All symbols from BoringSSL will get renamed to have a prefix of bssl_a52a4823_ in order to avoid name collisions with other copies of BoringSSL or OpenSSL in your project, if any. Note that the process of renaming is a bit fragile, because all symbols have to get prefixed in a first step, and the set of known undefined symbols to be provided by the environment, i.e. libc, will have to get renamed back to the original. In case you're seeing unresolved reference linker error, chances are the list in build.rs is incomplete and must get amended.

Integration

The bssl-bare-sys supports customizing the integration into freestanding/embedded-like environments.

If the Cargo feature target-integration is enabled, bssl-bare-sys depends on a bssl-bare-sys-target-integration crate you're supposed to provide a substitute for, via e.g. Cargo's [patch.'<URL>'] mechanism.

This bssl-bare-sys-target-integration controls bssl-bare-sys' BoringSSL build from its build.rs via the cargo::metadata=KEY=VALUE mechanism.

More specifically, the bssl-bare-sys-target-integration must have links = "bssl-bare-sys-target-integration" in its Cargo.toml and may set any of the following cargo::metadata keys:

  • CPPFLAGS - C preprocessor flags for the BoringSSL build.
  • CFLAGS - C compiler flags for the BoringSSL build.
  • CXXFLAGS - C++ compiler flags for the BoringSSL build.
  • ASFLAGS - Assembler flags for the BoringSSL build.
  • BINDGEN_CFLAGS - Flags to be passed to clang for the bindgen FFI generation.

Furthermore, the bssl-bare-sys-target-integration may add any library to get linked for resolving BoringSSL's undefined references via the usual cargo::rust-link-lib and specify library search paths by means of cargo::rust-link-search.

Commit count: 170

cargo fmt