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

Forward compatibility with v5 #197

Open
wants to merge 4 commits into
base: v4.x
Choose a base branch
from

Conversation

marmichalski
Copy link

@marmichalski marmichalski commented Feb 21, 2025

Adds forward compatibility with v5 ciphertexts in v4. This (maybe) resolves #187.

In distributed environments where halite is used, it is pretty hard (impossible) to upgrade all services at the same time, when one service starts using halite v5, services using v4 can't understand what they're saying 😭

All of the stuff here is copied over from v5 with minimal changes where needed.
I can try to provide some tests verifying that v4 indeed understands v5.

// Number of pieces that go into MAC (header, first nonce, salt, ciphertext) -> 4
if ($config->USE_PAE) {
// Number of pieces:
sodium_crypto_generichash_update($mac, pack('P', 4));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not 100% compatible, as with aad you have 5 pieces. Don't think there is anything one can do here though?

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.

1 participant