Skip to content

BoringSSL Support #1519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benbrittain opened this issue Aug 31, 2021 · 6 comments · Fixed by #1649
Closed

BoringSSL Support #1519

benbrittain opened this issue Aug 31, 2021 · 6 comments · Fixed by #1649

Comments

@benbrittain
Copy link
Contributor

BoringSSL

I'd like to investigate adding BoringSSL support to the rust-openssl crate. BoringSSL is a fork of OpenSSL that's designed to be harder to use incorrectly, but it also lacks the same backwards compatibility guarantees and has an unstable API/ABI. Some companies use BoringSSL exclusively (e.g. Google or Cloudflare) and since rust-openssl is the de facto way to interface with TLS/SSL in the rust ecosystem it would be nice to have support through this crate.

There exists some prior art in the rust ecosystem, notably boring and mundane.

Constraints

  • Minimal cfg additions to rust-openssl
    • rust-openssl already contains many cfgs for various openssl versions. Boringssl support should be at most minimally more invasive.
    • Should not make upgrading rust-openssl harder.
  • No way for ABI drift to occur with boringssl
    • This is a scary problem because a subtle ABI violation could introduce a security hole.
    • The lack of stability in boringssl means that copy/paste headers isn't a viable solution.
  • Less relevant to rust-openssl, but we should also avoid putting an undue burden on the BoringSSL maintainers.

Implementation

I'd like to solve this in a more integrated way by adding "*-sys" binding generation support into the build system of boringssl directly. This will guarantee the ABI doesn't drift from top-of-tree. The primary maintainers of BoringSSL have expressed willingness to use this approach. As much as possible should be generated by bindgen directly, as opposed to how openssl-sys handrolls a chunk of the bindings.

We'll likely want a boringssl-sys/boringssl-source setup similar to openssl-sys however so that we can provide a quick and easy static linking solution for people who desire it.

I'm in the middle of a quick prototype of this at the moment and it seems pretty tractable. Concerns and/or thoughts?

@sfackler
Copy link
Owner

That seems reasonble to me at a high level. I'd like to keep bindgen out of the default dependency graph of openssl-sys (pulling it in as an optional feature is fine).

@sfackler
Copy link
Owner

sfackler commented Sep 7, 2021

Now that OpenSSL 3.0.0 is out, I'm going to start working on a new major version release of the openssl crate (openssl-sys will be staying at 0.9). If there are API breaks that would help with the BoringSSL integration, let me know!

@tomleavy
Copy link
Contributor

tomleavy commented Sep 17, 2021

This would be helpful for me as well. I was thinking about contributing support for AWS-LC which is a fork of BoringSSL. Wasn't sure where to start with that since I'm not yet familiar with how openssl-sys finds the library etc

@photex
Copy link

photex commented Sep 25, 2021

I'm using BoringSSL as part of a large bazel workspace and would really appreciate being able to re-use my efforts there in the rust portion of our codebase. Once we started trying to seal off the build from host environments (only use specific toolchains etc) OpenSSL has been the biggest issue so far from an integration point of view.

@sfackler
Copy link
Owner

FYI, I have started working on a Cargo feature to use bindgen to replace (at least most of) the handwritten openssl-sys bindings: #1573

@alex
Copy link
Collaborator

alex commented Jan 23, 2022

BoringSSL now comes with code to generate bindings: https://boringssl.googlesource.com/boringssl/+/8d8d8f3ea727d52df86db03e3a75008b43be7dae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants