Skip to content
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

How does Hacl_HKDF_expand_sha2_256 signal errors, i.e., invalid arguments? #123

Open
duesee opened this issue Aug 8, 2022 · 2 comments
Open
Labels

Comments

@duesee
Copy link
Contributor

duesee commented Aug 8, 2022

The output size of HKDF is limited to 255 * HashLen, see https://www.rfc-editor.org/rfc/rfc5869.html#section-2.3. However, Hacl_HKDF_expand_sha2_256 accepts greater values. Should this be handled? And if so, how?

@duesee duesee added the question Further information is requested label Aug 8, 2022
@duesee
Copy link
Contributor Author

duesee commented Aug 8, 2022

This code passes all tests, although it shouldn't according to the RFC ...

    bytes got_OKM = std::vector<uint8_t>(8161);

    Hacl_HKDF_expand_sha2_256(got_OKM.data(),
                              got_prk.data(),
                              got_prk.size(),
                              test.info.data(),
                              test.info.size(),
                              8161);

    std::cout << bytes_to_hex(got_OKM) << std::endl;
    got_OKM.resize(test.L);
    std::cout << bytes_to_hex(got_OKM) << std::endl;

@franziskuskiefer
Copy link
Member

HKDF functions don't throw errors. This is something that must be handled on the outside for now.

@duesee duesee added api and removed question Further information is requested labels Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants