Skip to content

Add TLS 1.2 PRF module and bindings#487

Merged
kornelski merged 2 commits intocloudflare:masterfrom
janrueth:tls12-prf
Apr 13, 2026
Merged

Add TLS 1.2 PRF module and bindings#487
kornelski merged 2 commits intocloudflare:masterfrom
janrueth:tls12-prf

Conversation

@janrueth
Copy link
Copy Markdown
Contributor

Expose a new boring::prf::tls1_prf helper that wraps the TLS 1.2 PRF and document it with RFC 5246 context. Add vector tests for SHA-224, SHA-256, SHA-384, and SHA-512 to verify output compatibility.

Declare CRYPTO_tls1_prf in boring-sys as a manual extern because the symbol is exported by BoringSSL but declared only in an internal header, so bindgen does not emit it. Keep this as a small explicit declaration in lib.rs as the simplest and most robust approach for a single missing symbol, instead of adding fragile bindgen plumbing for internal headers.

Expose a new boring::prf::tls1_prf helper that wraps the TLS 1.2 PRF and document it with RFC 5246 context. Add vector tests for SHA-224, SHA-256, SHA-384, and SHA-512 to verify output compatibility.

Declare CRYPTO_tls1_prf in boring-sys as a manual extern because the symbol is exported by BoringSSL but declared only in an internal header, so bindgen does not emit it. Keep this as a small explicit declaration in lib.rs as the simplest and most robust approach for a single missing symbol, instead of adding fragile bindgen plumbing for internal headers.
@kornelski
Copy link
Copy Markdown
Collaborator

Why the -sys crate modification? bindgen should have generated the extern "C" definition for you

@janrueth
Copy link
Copy Markdown
Contributor Author

The symbol is defined in an internal header that's not looked at by bindgen. Alternative is to add a patch that exposes it to a public header but that feels more brittle than simply defining the symbol the way I did

@janrueth
Copy link
Copy Markdown
Contributor Author

Thanks for adding the feature-flag gate!

@kornelski kornelski merged commit 43efc0d into cloudflare:master Apr 13, 2026
24 checks passed
@janrueth janrueth deleted the tls12-prf branch April 13, 2026 16:26
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