aboutsummaryrefslogtreecommitdiffstats
path: root/src/buf_filt.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 23:10:52 +0000
committerlloyd <[email protected]>2008-09-28 23:10:52 +0000
commitfda3e1b51fbb539e3689e23148be08783afe0e21 (patch)
tree1419c8a7a9a1d179679185d6d09c8e427d34706b /src/buf_filt.cpp
parent8820c122b9cd665621729abfcf8c6751762535df (diff)
New filters module. Add deps for it in some needed areas (codec, pbes)
Diffstat (limited to 'src/buf_filt.cpp')
-rw-r--r--src/buf_filt.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/buf_filt.cpp b/src/buf_filt.cpp
deleted file mode 100644
index 7acd37435..000000000
--- a/src/buf_filt.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************
-* Buffering Filter Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/buf_filt.h>
-#include <algorithm>
-
-namespace Botan {
-
-/*************************************************
-* Buffering_Filter Constructor *
-*************************************************/
-Buffering_Filter::Buffering_Filter(u32bit b, u32bit i) : INITIAL_BLOCK_SIZE(i),
- BLOCK_SIZE(b)
- {
- initial_block_pos = block_pos = 0;
- initial.create(INITIAL_BLOCK_SIZE);
- block.create(BLOCK_SIZE);
- }
-
-/*************************************************
-* Reset the Buffering Filter *
-*************************************************/
-void Buffering_Filter::end_msg()
- {
- if(initial_block_pos != INITIAL_BLOCK_SIZE)
- throw Exception("Buffering_Filter: Not enough data for first block");
- final_block(block, block_pos);
- initial_block_pos = block_pos = 0;
- initial.clear();
- block.clear();
- }
-
-/*************************************************
-* Buffer input into blocks *
-*************************************************/
-void Buffering_Filter::write(const byte input[], u32bit length)
- {
- if(initial_block_pos != INITIAL_BLOCK_SIZE)
- {
- u32bit copied = std::min(INITIAL_BLOCK_SIZE - initial_block_pos, length);
- initial.copy(initial_block_pos, input, copied);
- input += copied;
- length -= copied;
- initial_block_pos += copied;
- if(initial_block_pos == INITIAL_BLOCK_SIZE)
- initial_block(initial);
- }
- block.copy(block_pos, input, length);
- if(block_pos + length >= BLOCK_SIZE)
- {
- main_block(block);
- input += (BLOCK_SIZE - block_pos);
- length -= (BLOCK_SIZE - block_pos);
- while(length >= BLOCK_SIZE)
- {
- main_block(input);
- input += BLOCK_SIZE;
- length -= BLOCK_SIZE;
- }
- block.copy(input, length);
- block_pos = 0;
- }
- block_pos += length;
- }
-
-}