[Botan-devel] clearing pipe messages

Muzaffar Mahkamov mahkamov at gmail.com
Tue Dec 13 05:50:22 EST 2005


Is it possible to clear all the messages of Pipe and reuse it several
times? I need to encrypt/decrypt large amounts of data in small chunks
and constructing Pipe with calling get_cipher with lookups each time
is a pretty expensive operation.

set_default_msg() is inacceptable for this case since it does not
remove the previous messages and doesn't free the memory.

I want to modify the Pipe class by adding the following function:

void Pipe::clear_messages()
      throw Invalid_State("Pipe cannot be modified while it is locked");

   for(u32bit j = 0; j != messages.size(); j++)
      delete messages[j];

   locked = false;

Would it be sufficient for reusing the pipe or there are some internal
states/flags that also must be cleared?

Thanks in advance,

More information about the botan-devel mailing list