[botan-devel] When to read message from pipe?

Jack Lloyd lloyd at randombit.net
Thu Jan 23 11:20:31 EST 2014

On Tue, Jan 07, 2014 at 06:21:04PM +0600, Ivan Romanov wrote:
>     bool update(const QCA::SecureArray &in, QCA::SecureArray *out)
>     {
>         QCA::SecureArray result( in.size() + blockSize() );
>         m_crypter->write((Botan::byte*)in.data(), in.size());
>         int bytes_read = m_crypter->read((Botan::byte*)result.data(), 
> result.size());
>         result.resize(bytes_read);
>         *out = result;
>         return true;
>     }
> In this function I must have ouptut.
> So I should to do end_msg() with some algorythms if I want to get output?
> For which algorythms I can safely do end_msg()?

If you require output be provided immediately in all cases then yes,
you would need to to call end_msg. Filters make progress as they are
able based on some strategy (often involving batching operations) so
always producing output in this fashion has never been guaranteed by
the api.

If you are doing CTR mode, or XTS or CBC without padding (and ending
all messages on block boundaries), the end_msg trick should work. It
doesn't work for any AEAD mode, obviously.


More information about the botan-devel mailing list