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

psa_cipher_set_iv doesn't allow to set the counter value for chacha20 #162

Open
dbuenzli opened this issue Jan 18, 2025 · 2 comments
Open
Labels
enhancement New feature or request help wanted This issue is not being actively worked on, but PRs welcome. size-s Estimated task size: small (~2d)

Comments

@dbuenzli
Copy link

According to the spec it should be possible to set the counter value for ChaCha20 by providing a 16 bytes IV.

This is currently not possible in the current implementation. A first check in mbedtls_psa_cipher_set_iv seems to assume IV lengths are fixed for a given operation which is not the case for ChaCha20. Then barring that, mbedtls_cipher_set_iv doesn't seem anyways to have the logic for setting up the counter to something else than 0.

P.S. Not that I need this I was just writing some test code for the cipher API and trying to match the result of this vector.

@gilles-peskine-arm
Copy link
Contributor

Indeed that's a known limitation (we haven't yet migrated issues from the mbedtls repository). Do you need it in production, or just as part of testing effort?

@gilles-peskine-arm gilles-peskine-arm added enhancement New feature or request help wanted This issue is not being actively worked on, but PRs welcome. size-s Estimated task size: small (~2d) labels Feb 7, 2025
@gilles-peskine-arm gilles-peskine-arm marked this as a duplicate of Mbed-TLS/mbedtls#5616 Feb 7, 2025
@dbuenzli
Copy link
Author

dbuenzli commented Feb 7, 2025

I was just testing bindings I'm making to PSA crypto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted This issue is not being actively worked on, but PRs welcome. size-s Estimated task size: small (~2d)
Projects
None yet
Development

No branches or pull requests

2 participants