Open conradoplg opened 6 years ago
There is another way to fix this: use copy
which does support overlapped arguments to shuffle things around when doing in-place operations.
The two branches mentioned above implement the two strategies. Which one do you prefer, if you're going down this route?
According to Seal/Open documentations (and the
cipher.AEAD
interface), they should work whendst
andplaintext
(resp.ciphertext
) overlap entirely.However, that doesn't work. This test fails:
I can write a MR fixing this, however, since the tag comes before the ciphertext it seems that will require making a whole copy of the input in this case (since
XORKeyStream
alse requires its input to overlap entirely or not at all), entirely defeating the purpose of the in-place optimization. However, I don't see a way out without breaking thecipher.AEAD
contract, or moving the tag after the ciphertext (#152)What do you think?