Skip to content

Use proper types in sodium_crypto_stream_xchacha20_xor_ic() #8302

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

Closed

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Apr 5, 2022

Most importantly, ic needs to be of type zend_long, not zend_long*.

Cf. afd8f84#r70509826.

Most importantly, `ic` needs to be of type `zend_long`, not `zend_long*`.
cmb69 referenced this pull request Apr 5, 2022
There are many use-cases where a PHP user is currently using sodium_compat's implementation of this low-level XChaCha20 API. For example, multi-part message processing (in low-memory settings) for a ciphertext that was encrypted with XChaCha20-Poly1305 (rather than the secretstream API).

Adding this function to ext/sodium offers better performance and lowers users' memory usage with the polyfill, and ensures that users coming from other languages that provide libsodium bindings have a more consistent experience with our bindings. This is a win-win.

This patch follows the libsodium precedent of adding functions instead of optional parameters to existing functions. The parameter order is also consistent with the C API.

https://doc.libsodium.org/advanced/stream_ciphers/xchacha20#usage

Closes GH-8276.
@cmb69 cmb69 closed this in d03a94a Apr 5, 2022
@cmb69 cmb69 deleted the cmb/sodium_crypto_stream_xchacha20_xor_ic branch April 5, 2022 14:36
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