Skip to content

multi_encrypt: match padding entries to ciphertext size - #125

Merged
jagerman merged 1 commit into
session-foundation:devfrom
Ap4sh:fix-multi-encrypt-padding-size
Aug 11, 2026
Merged

multi_encrypt: match padding entries to ciphertext size#125
jagerman merged 1 commit into
session-foundation:devfrom
Ap4sh:fix-multi-encrypt-padding-size

Conversation

@Ap4sh

@Ap4sh Ap4sh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

summary

when pad is enabled, encrypt_for_multiple_simple() currently sizes junk entries from the plaintext. real XChaCha20-Poly1305 ciphertexts include a 16-byte tag, so padding entries stay distinguishable by length

this uses the encrypted size for padding entries, matching the existing C and C++ API docs. it also keeps padding enabled for empty messages, whose ciphertexts are still 16 bytes

tests

  • ./build-pr/tests/testAll "[simple]"
  • ./build-pr/tests/testAll
  • clang-format-19 --dry-run --Werror src/multi_encrypt.cpp tests/test_multi_encrypt.cpp

@jagerman
jagerman merged commit 23982cc into session-foundation:dev Aug 11, 2026
1 check failed
@jagerman

Copy link
Copy Markdown
Member

Nice catch & fix, thank you very much!

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