blob: e2efd6c447540a0f8565995e86a1b847ea1e287a [file] [log] [blame] [view]
Benjamin Brittain8d8d8f32021-09-28 10:00:50 -04001bssl-sys
2============
3
4A low-level binding crate for Rust that moves in lockstop with BoringSSL. BoringSSL explicitly does not have a stable ABI, `bssl-sys` is the solution for preventing subtle-memory corruption bugs due to version skew.
5
6### How it works
David Benjamin26669ff2023-04-21 15:12:24 -04007`bssl-sys` uses `bindgen` as part of the cmake build process to generate Rust compatibility shims for the targeted platform. It is important to generate it for the correct platform because `bindgen` uses LLVM information for alignment which varies depending on architecture.
Benjamin Brittainea46caf2022-01-20 15:50:12 -05008
9### To Use
David Benjamin26669ff2023-04-21 15:12:24 -040010Build `boringssl` with `-DRUST_BINDINGS=<rust-triple>` and ensure that you have `bindgen` installed. The `rust-triple` option should match the [Rust target triple](https://doc.rust-lang.org/nightly/rustc/platform-support.html) when building `bssl-sys`.
Benjamin Brittainea46caf2022-01-20 15:50:12 -050011
David Benjamin26669ff2023-04-21 15:12:24 -040012From there, the `bssl-sys` crate can be built. By default, it looks for `bindgen` output and BoringSSL static libraries in the `build` directory. This can be reconfigured with `BORINGSSL_BUILD_DIR` environment variable. Note the environment variable is evaluated relative to `rust/bssl-sys/src`, so using an absolute path may be more convenient.