I looked pretty hard at the example file encryption code in the secretstream documentation for a while. I think that the comment in this statement is backwards:
if (tag == crypto_secretstream_xchacha20poly1305_TAG_FINAL && ! eof) {
goto ret; /* premature end (end of file reached before the end of the stream) */
}
I think what it should say is End of stream reached before the end of the file because ! eof will be true if we have not reached the end of the file.
I also added a check for if the file ends before the end of the stream to the example code.
Feel free to add suggestions or correct me if I'm wrong.
I looked pretty hard at the example file encryption code in the secretstream documentation for a while. I think that the comment in this statement is backwards:
I think what it should say is
End of stream reached before the end of the file
because! eof
will betrue
if we have not reached the end of the file.I also added a check for if the file ends before the end of the stream to the example code.
Feel free to add suggestions or correct me if I'm wrong.