Commit b49fa488 authored by Geoff Simmons's avatar Geoff Simmons

Bugfix: encrypt VFP main loop flushes if the output stream is full.

parent e942b008
......@@ -82,11 +82,15 @@ encrypt(struct vfp_ctx *ctx, struct ece *ece, enum vfp_status vp)
record_len = stream->avail_in + TAG_LEN + 1;
}
assert(record_len <= ece->rs);
if (record_len > stream->avail_out)
if (record_len > stream->avail_out) {
assert(vp != VFP_END);
return (VFP_NULL);
}
plaintext_len = record_len - (TAG_LEN + 1);
if (plaintext_len > stream->avail_in)
if (plaintext_len > stream->avail_in) {
assert(vp != VFP_END);
return (VFP_NULL);
}
nonce_xor_seq(crypto, nonce);
ciphertext_len = encrypt_record(ece->ectx, stream->next_in,
......@@ -238,6 +242,8 @@ vfp_encrypt_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
}
while (vp == VFP_OK) {
if (isOutputBufFull(stream))
break;
if (isInputBufEmpty(stream)) {
size_t len = ece->chunksz;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment