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
Add hkdf::Prk::expand_to_secret() #891
base: main
Are you sure you want to change the base?
Conversation
Thanks for this. This was in fact the exact type signature that I had originally given to |
Yes, I ended up incorporating something like this in Quinn: https://github.com/djc/quinn/blob/master/quinn-proto/src/crypto/ring.rs#L238 |
Sorry if I wasn't clear. What I mean is, did you find that your new function failed to work because of type inference problems, or did you find that there were no type inference problems in your usage, or something in between? |
Also, since Quinn is based on Rustls, IMO Rustls should just expose an API that makes all that Quinn code unnecessary. Quinn shouldn't be doing HKDF at all, AFAICT. |
It took me a while to figure out the correct incantation, so it would be nice if that could live in ring. Especially since it took me quite some time to grok how to use the current API, and this new method makes it clearer how the pieces fit together. |
@ctz took the opinion back when I started that he wanted rustls to know as little as possible QUIC-specific stuff, but maybe we ought to reconsider that position. |
Off-topic, but I think Rustls would actually be simpler if it did everything related to key derivation for QUIC, even not considering how much simpler Quinn would be. Rustls already has duplicate code for QUIC- and non-QUIC- code paths. I suggest making a Rustls PR so we can see how much better Rustls would get. |
Oh, I 100% agree. My point was that I implemented the harder-to-understand API because the easier-to-understand API didn't work as well due to type inference issues. I am wondering if you found that to be the case too, or if the stuff I was trying to do before was an anomaly. I'll double-check when I have some time. |
IIRC rustc still can't figure out the return type of my |
@briansmith are you still interested in this? If yes, does it need any further work? |
@djc Yes, I think it would be good to have this. It isn't being tested in hkdf_tests, which is the main blocker that I see. |
I've updated the |
Something like this seems to work.