Skip to content

Add relax-rsa-key-usage feature to restore historical RSA keyUsage #512

Open
johnhurt wants to merge 1 commit into
cloudflare:masterfrom
johnhurt:kbg/relax-rsa-key-usage
Open

Add relax-rsa-key-usage feature to restore historical RSA keyUsage #512
johnhurt wants to merge 1 commit into
cloudflare:masterfrom
johnhurt:kbg/relax-rsa-key-usage

Conversation

@johnhurt

Copy link
Copy Markdown
Contributor

BoringSSL 5.x includes an update to openssl that changed SSL_CONFIG::enforce_rsa_key_usage to default to true, making client-side RSA leaf keyUsage mismatches a fatal handshake error (KEY_USAGE_BIT_INCORRECT). Many real-world origins serve certificates whose keyUsage does not include the bit required by the negotiated cipher suite; OpenSSL and prior BoringSSL pins accepted them.

This adds a new relax-rsa-key-usage Cargo feature that applies a build-time patch restoring the historical default (false). When the feature is not enabled, the BoringSSL 5.x strict behaviour is preserved. Non-RSA keyUsage enforcement is unaffected in either case.

…default

BoringSSL 5.x changed SSL_CONFIG::enforce_rsa_key_usage to default to
true, making client-side RSA leaf keyUsage mismatches a fatal handshake
error (KEY_USAGE_BIT_INCORRECT). Many real-world origins serve
certificates whose keyUsage does not include the bit required by the
negotiated cipher suite; OpenSSL and prior BoringSSL pins accepted them.

This adds a new `relax-rsa-key-usage` Cargo feature that applies a
build-time patch restoring the historical default (false). When the
feature is not enabled, the BoringSSL 5.x strict behaviour is preserved.
Non-RSA keyUsage enforcement is unaffected in either case.

@cjpatton cjpatton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can you update CI to make sure the patch is tested? Also consider adding a unit test with a cert that would validate with and without this feature.

Comment thread boring-sys/Cargo.toml
underscore-wildcards = []

# Restores the historical BoringSSL default of not enforcing RSA keyUsage
# during TLS handshakes. BoringSSL 5.x changed `enforce_rsa_key_usage` to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version number refers to the boring crate, not BoringSSL, correct? It might be more helpful to refer to the value of BORINGSSL_API_VERSION in the BoringSSL repo itself (include/openssl/base.h).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise for the commit message for the new patch.

@johnhurt

Copy link
Copy Markdown
Contributor Author

Good call. I'll take care of both.

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 this pull request may close these issues.

2 participants