diff options
author | lloyd <[email protected]> | 2013-08-15 19:35:38 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-08-15 19:35:38 +0000 |
commit | 10bab015381aceecdf37bc7c7c325e014f2da676 (patch) | |
tree | 41dfffbef7a115a3200d9870a53eb8d039239b91 /src/modes/cbc/cbc.cpp | |
parent | 84cd26db4770ccf09a80a99b7ccfd899d8eeb1a8 (diff) |
Keeping this buffer persistently greatly helps performance
Diffstat (limited to 'src/modes/cbc/cbc.cpp')
-rw-r--r-- | src/modes/cbc/cbc.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/modes/cbc/cbc.cpp b/src/modes/cbc/cbc.cpp index 65b78fbc5..bb7c56858 100644 --- a/src/modes/cbc/cbc.cpp +++ b/src/modes/cbc/cbc.cpp @@ -163,19 +163,17 @@ void CBC_Decryption::update(secure_vector<byte>& buffer, size_t offset) BOTAN_ASSERT(sz % BS == 0, "Input is full blocks"); size_t blocks = sz / BS; - secure_vector<byte> temp(update_granularity()); - while(blocks) { - const size_t to_proc = std::min(sz, temp.size()); + const size_t to_proc = std::min(sz, m_tempbuf.size()); - cipher().decrypt_n(buf, &temp[0], to_proc / BS); + cipher().decrypt_n(buf, &m_tempbuf[0], to_proc / BS); - xor_buf(&temp[0], state_ptr(), BS); - xor_buf(&temp[BS], buf, to_proc - BS); + xor_buf(&m_tempbuf[0], state_ptr(), BS); + xor_buf(&m_tempbuf[BS], buf, to_proc - BS); copy_mem(state_ptr(), buf + (to_proc - BS), BS); - copy_mem(buf, &temp[0], to_proc); + copy_mem(buf, &m_tempbuf[0], to_proc); buf += to_proc; blocks -= to_proc / BS; |