aboutsummaryrefslogtreecommitdiffstats
path: root/src/ofb.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 18:15:52 +0000
committerlloyd <[email protected]>2008-09-28 18:15:52 +0000
commit983a8ecb42e844f89466d0ae52bba591d4fc4275 (patch)
treede01378ee9be0ba8bec28bc08d3bde6e422ff898 /src/ofb.cpp
parentd59f6a2c9e797ee22c21b2d85c662e0fe8d1cf35 (diff)
Modularize cipher modes
Diffstat (limited to 'src/ofb.cpp')
-rw-r--r--src/ofb.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/ofb.cpp b/src/ofb.cpp
deleted file mode 100644
index db254d329..000000000
--- a/src/ofb.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************
-* OFB Mode Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/ofb.h>
-#include <botan/lookup.h>
-#include <botan/xor_buf.h>
-#include <algorithm>
-
-namespace Botan {
-
-/*************************************************
-* OFB Constructor *
-*************************************************/
-OFB::OFB(const std::string& cipher_name) :
- BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2)
- {
- }
-
-/*************************************************
-* OFB Constructor *
-*************************************************/
-OFB::OFB(const std::string& cipher_name, const SymmetricKey& key,
- const InitializationVector& iv) :
- BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2)
- {
- set_key(key);
- set_iv(iv);
- }
-
-/*************************************************
-* OFB Encryption/Decryption *
-*************************************************/
-void OFB::write(const byte input[], u32bit length)
- {
- u32bit copied = std::min(BLOCK_SIZE - position, length);
- xor_buf(buffer, input, state + position, copied);
- send(buffer, copied);
- input += copied;
- length -= copied;
- position += copied;
-
- if(position == BLOCK_SIZE)
- {
- cipher->encrypt(state);
- position = 0;
- }
-
- while(length >= BLOCK_SIZE)
- {
- xor_buf(buffer, input, state, BLOCK_SIZE);
- send(buffer, BLOCK_SIZE);
-
- input += BLOCK_SIZE;
- length -= BLOCK_SIZE;
- cipher->encrypt(state);
- }
-
- xor_buf(buffer, input, state + position, length);
- send(buffer, length);
- position += length;
- }
-
-}