Comments (9)
👋 Thanks for filing this detailed issue!
I think in general since the unbuffered API surface is so new it hasn't seen a lot of downstream usage and feedback on the ergonomics and remaining rough edges is very helpful.
It would be nice if Rustls creates it's own trait for some kind of Rustls relevant Buffer type which has capacity that can be passed as generic to these implementations.
This seems reasonable to me, but I suspect I have less opinions on this area than the other maintainers.
Most ideally this trait could be "isolated" within a separate crate to let other implementers to follow about it without necessary pulling the whole rustls for use-cases where given implementer crate only implements underlying buffer but not other parts of rustls.
I'm not sure I understand what value there would be in only implementing the buffer without intent to integrate with Rustls as a larger goal but in either case, perhaps this could be something that's a fit for the pki-types crate? It seems conceivable that it would be useful in other Rustls crates as well.
I would be more than happy to send a PR if you would be amenable to something like this or something else which potentially could maybe reduce the need of zero-initialization and ensuring the output is sized correctly for sending out.
I think before going too far down that road it would make sense to check that djc and ctz are on board with the general premise + proposed solution. If they are, I'd be happy to try and review. I've had to pause my own work on reducing the bifurcation of the buffered/unbuffered APIs to focus on other areas but I think I could find the time to support this.
If this is not feasible then I could send a PR to document this perhaps to ensure nobody else steps into this little footgun I did.
That sounds worthwhile, thank you!
from rustls.
BorrowedBuf
is in core::io
from rustls.
Sounds okay to me!
from rustls.
I feel like we should rely on the std BorrowedBuf
and co here? Those are still unstable but I don't love the idea of reinventing that stuff ahead of them becoming stable.
from rustls.
That would require std though ? unbuffered typically operates in no_std context at least for /some of/ my use-cases.
from rustls.
Ah thanks for pointing that out - my bad
It doesn't on quick glance work for io_uring case though as it requires owned buffers due to kernel/userspace sharing ?
EDIT: I might have most definitely misunderstood how to use BorrowedCursor as owned - I need to check that
from rustls.
Would you be okay with experimental support via BorrowedBuf via PR if I hook it up ?
e.g. encode could be encode_borrowed() so it doesn't disturb the existing API and is over cfg-feature-gate e.g. borrowed_buf for unbuffered ?
from rustls.
Sweet, PR on your way soon(tm)
from rustls.
Also if there is appetite to check feature use vs used rustc version given the version-dependant feature -
We could either check nightly in build.rs or just add fallible feature if someone tries to use the feature at stable that doesn't have the said feature.
e.g. detecting nightly w/ rustc_version crate and relaying appropriate cfg-gating
if rustc_version::version_meta()
.expect("failed to detect rustc version")
.channel
== rustc_version::Channel::Nightly
{
println!("cargo:rustc-cfg=nightly");
}
With dalek we also have AVX2 gated for stable rust as below and nightly for AVX512
e.g. when the feature stabilises this could be used to guard it's use - if needed / wanted ?
let rustc_version = rustc_version::version().expect("failed to detect rustc version");
if rustc_version.major == 1 && rustc_version.minor <= 64 {
// Old versions of Rust complain when you have an `unsafe fn` and you use `unsafe {}` inside,
// so for those we want to apply the `#[allow(unused_unsafe)]` attribute to get rid of that warning.
println!("cargo:rustc-cfg=allow_unused_unsafe");
}
EDIT: Looks like there is already nightly check .. and for read-buf 🤦♀️ can just extend that 😅
from rustls.
Related Issues (20)
- 0.23 docs build is broken HOT 2
- optimize receiving data with TLS 1.2 and aes-128-gcm HOT 1
- optimize receiving data with TLS 1.3 and aes-256-gcm
- optimize server-side full handshakes for TLS 1.2 and 1.3 HOT 1
- Connection::dangerous_extract_secrets returns ConnectionTrafficSecrets::Aes128Gcm even when AES-256-GCM is negotiated
- Error: badRecordMac HOT 4
- Cipher suites configured through WebPkiServerVerifier::builder_with_provider is not working. Client hello contains more cipher suites then it configured. HOT 6
- rand_core::RngCore & CryptoRng support for CryptoProvider HOT 7
- expose more information in ClientHello HOT 4
- No common ciphersuit when FFDHE and ECDHE ciphersuites are available on server and client using TLS 1.2 HOT 4
- US Export control information HOT 4
- doc: AcceptedAlert::write doesn't necessarily write all bytes HOT 7
- Support using rustls without using specific ring or aws-lc-rs apis HOT 2
- Feature request: a way to set/get default ticketer dynamically HOT 6
- Feature Request: Avoid panicking when ring and aws_lc_rs are both specified HOT 19
- Option to Relax SNI Host Name Validation for IP Addresses HOT 7
- The support for "mipsel-unknown-linux-musl" has failed. HOT 2
- Io(Custom { kind: InvalidData, error: AlertReceived(HandshakeFailure) }) HOT 6
- Linux compilation is slow and seems unable to store compilation results HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustls.