28 stable releases (3 major)

4.7.0 May 31, 2024
4.5.0 Feb 8, 2024
4.2.0 Dec 14, 2023
4.1.0 Nov 16, 2023
1.0.2 Nov 12, 2020

#46 in Cryptography

Download history 10324/week @ 2024-02-15 7774/week @ 2024-02-22 10931/week @ 2024-02-29 10125/week @ 2024-03-07 9233/week @ 2024-03-14 9911/week @ 2024-03-21 8555/week @ 2024-03-28 10393/week @ 2024-04-04 8674/week @ 2024-04-11 8419/week @ 2024-04-18 8157/week @ 2024-04-25 10515/week @ 2024-05-02 11510/week @ 2024-05-09 13631/week @ 2024-05-16 11277/week @ 2024-05-23 9547/week @ 2024-05-30

47,876 downloads per month
Used in 33 crates (22 directly)


462K SLoC

GNU Style Assembly 206K SLoC // 0.0% comments C++ 98K SLoC // 0.2% comments C 78K SLoC // 0.2% comments Assembly 63K SLoC // 0.0% comments Rust 16K SLoC // 0.0% comments Bazel 1K SLoC



BoringSSL bindings for the Rust programming language and TLS adapters for tokio and hyper built on top of it.



Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed under the terms of both the Apache License, Version 2.0 and the MIT license without any additional terms or conditions.


The project is based on a fork of rust-openssl.


Bindings to BoringSSL

This crate provides a safe interface to the BoringSSL cryptography library.


Crate versioning

The crate and all the related crates (FFI bindings, etc.) are released simultaneously and all bumped to the same version disregard whether particular crate has any API changes or not. However, semantic versioning guarantees still hold, as all the crate versions will be updated based on the crate with most significant changes.

BoringSSL version

By default, the crate aims to statically link with the latest BoringSSL master branch. Note: any BoringSSL revision bumps will be released as a major version update of all crates.

Compilation and linking options

Environment variables

This crate uses various environment variables to tweak how boring is built. The variables are all prefixed by BORING_BSSL_ for non-FIPS builds, and by BORING_BSSL_FIPS_ for FIPS builds.

Support for pre-built binaries or custom source

While this crate can build BoringSSL on its own, you may want to provide pre-built binaries instead. To do so, specify the environment variable BORING_BSSL{,_FIPS}_PATH with the path to the binaries.

You can also provide specific headers by setting BORING_BSSL{,_FIPS}_INCLUDE_PATH.

Notes: The crate will look for headers in the$BORING_BSSL{,_FIPS}_INCLUDE_PATH/openssl/ folder, make sure to place your headers there.

In alternative a different path for the BoringSSL source code directory can be specified by setting BORING_BSSL{,_FIPS}_SOURCE_PATH which will automatically be compiled during the build process.

Warning: When providing a different version of BoringSSL make sure to use a compatible one, the crate relies on the presence of certain functions.

Building with a FIPS-validated module

Only BoringCrypto module version 853ca1ea1168dff08011e5d42d94609cc0ca2e27, as certified with FIPS 140-2 certificate 4407 is supported by this crate. Support is enabled by this crate's fips feature.

boring-sys comes with a test that FIPS is enabled/disabled depending on the feature flag. You can run it as follows:

$ cargo test --features fips fips::is_enabled

Linking current BoringSSL version with precompiled FIPS-validated module (bcm.o)

It's possible to link latest supported version of BoringSSL with FIPS-validated crypto module (bcm.o). To enable this compilation option one should enable fips-link-precompiled compilation feature and provide a BORING_BSSL_FIPS_PRECOMPILED_BCM_O env variable with a path to the precompiled FIPS-validated bcm.o module.

Note that BORING_BSSL_PRECOMPILED_BCM_O is never used, as linking BoringSSL with precompiled non-FIPS module is not supported.

Optional patches

Raw Public Key

The crate can be compiled with RawPublicKey support by turning on rpk compilation feature.

Experimental post-quantum cryptography

The crate can be compiled with post-quantum cryptography support by turning on post-quantum compilation feature.

Upstream BoringSSL support the post-quantum hybrid key agreement X25519Kyber768Draft00. Most users should stick to that one. Enabling this feature, adds a few other post-quantum key agreements:

  • X25519Kyber768Draft00Old is the same as X25519Kyber768Draft00, but under its old codepoint. -X25519Kyber512Draft00. Similar to X25519Kyber768Draft00, but uses level 1 parameter set for Kyber. Not recommended. It's useful to test whether the shorter ClientHello upsets fewer middle boxes.
  • P256Kyber768Draft00. Similar again to X25519Kyber768Draft00, but uses P256 as classical part. It uses a non-standard codepoint. Not recommended.

Presently all these key agreements are deployed by Cloudflare, but we do not guarantee continued support for them.