-
Notifications
You must be signed in to change notification settings - Fork 149
boring-sys: Ignore patches when boringSSL is precompiled #331
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
Conversation
| #[cfg(all(not(feature = "fips"), feature = "pq-experimental"))] | ||
| pub const X25519_KYBER768_DRAFT00_OLD: SslCurve = | ||
| SslCurve(ffi::SSL_CURVE_X25519_KYBER768_DRAFT00_OLD as _); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we could just remove these non-standard APIs from the bindings.
0b94828 to
f587ae2
Compare
| SslCurve(ffi::SSL_CURVE_X25519_KYBER768_DRAFT00 as _); | ||
|
|
||
| #[cfg(feature = "pq-experimental")] | ||
| #[cfg(all(not(feature = "fips"), feature = "pq-experimental"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not(feature = "fips") prevents us from building this code whenever "fips" is enabled. This is necessary because this API is too new for older boringSSL builds.
We could weaken this constraint to not(feature = "fips-compat"), but this is somewhat of a broader change than what this PR is trying to do.
Note: this is not a breaking change because "fips" and "pq-experimental" were previously mutually exclusive.
Internal users often have two builds for `boring`, one using a precompiled build of boringSSL and another built from source with patches applied. However the features that enable these builds are mutually exclusive. For example, the `"pq-experimental"` feature is required to build the source with all of the necessary codepoints for PQ key exchange, but if this feature is enabled and a precompiled boringSSL is provided, then the build will fail. This means users will have to also control their builds with mutually exclusive features. An alternative is to *ignore* features that enable patches whenever a precompiled boringSSL is provided. This is a little different from the "assume patched" environment variable, which applies whenever we're building from source.
The "fips" feature implies use of a prebuilt boringSSL. The boringSSL API consumed by `SslCurve` in incompatible with older versions of boringSSL. In the `ffi` bindings, the following symbols don't exist in older builds: * NID_X25519MLKEM768 * SSL_CURVE_X25519_MLKEM768 * NID_X25519Kyber768Draft00Old The following symbols have been renamed: * SSL_CURVE_P256KYBER768DRAFT00 => SSL_CURVE_P256_KYBER768_DRAFT00 * SSL_CURVE_X25519KYBER512DRAFT00 => SSL_CURVE_X25519_KYBER512_DRAFT00 * SSL_CURVE_X25519KYBER768DRAFT00OLD => SSL_CURVE_X25519_KYBER768_DRAFT00_OLD * SSL_CURVE_P256KYBER768DRAFT00 => SSL_CURVE_P256_KYBER768_DRAFT00 Meanwhile, the `ssl_set_curves_list()` API is stable across these versions of boringSSL. These codepoints are added to the `SslCurve` API whenever "pq-experimental" is enabled. Since this feature is no longer mutually exclusive with prebuilt boringSSL (`boring-sys` just ignores patches), we also need to disable this API whenever "fips" is enabled.
f587ae2 to
90121f0
Compare
|
Rebased, plus I modified the warning to make it visible during the build. |
Internal users often have two builds for
boring, one using a precompiled build of boringSSL and another built from source with patches applied. However the features that enable these builds are mutually exclusive. For example, the"pq-experimental"feature is required to build the source with all of the necessary codepoints for PQ key exchange, but if this feature is enabled and a precompiled boringSSL is provided, then the build will fail. This means users will have to also control their builds with mutually exclusive features.An alternative is to ignore features that enable patches whenever a precompiled boringSSL is provided. This is a little different from the "assume patched" environment variable, which applies whenever we're building from source.