From 1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 9 Apr 2012 16:35:15 +0000 Subject: Halfway through crypto-template conversion. --- src/experimental/blowfish.cpp | 2 +- src/experimental/blowfish.h | 2 +- src/experimental/cipher.cpp | 62 --------------------------------------- src/experimental/cipher.h | 67 +++++++++++++++++++++++++++++++++++++++---- 4 files changed, 63 insertions(+), 70 deletions(-) diff --git a/src/experimental/blowfish.cpp b/src/experimental/blowfish.cpp index 797ec73..7f89f0f 100644 --- a/src/experimental/blowfish.cpp +++ b/src/experimental/blowfish.cpp @@ -9,7 +9,7 @@ using Bu::sio; SB[3][x.byte.three]) Bu::Blowfish::Blowfish( Bu::Stream &rNext ) : - Bu::Cipher( rNext ) + Bu::Cipher<8>( rNext ) { } diff --git a/src/experimental/blowfish.h b/src/experimental/blowfish.h index 4dbd637..c043b12 100644 --- a/src/experimental/blowfish.h +++ b/src/experimental/blowfish.h @@ -12,7 +12,7 @@ namespace Bu { - class Blowfish : public Bu::Cipher + class Blowfish : public Bu::Cipher<8> { public: Blowfish( Bu::Stream &rNext ); diff --git a/src/experimental/cipher.cpp b/src/experimental/cipher.cpp index 3430c08..d6d01c7 100644 --- a/src/experimental/cipher.cpp +++ b/src/experimental/cipher.cpp @@ -1,65 +1,3 @@ #include "bu/cipher.h" -Bu::Cipher::Cipher( Bu::Stream &rNext ) : - Bu::Filter( rNext ) -{ -} - -Bu::Cipher::~Cipher() -{ -} - -void Bu::Cipher::start() -{ -} - -Bu::size Bu::Cipher::stop() -{ - return 0; -} - -Bu::size Bu::Cipher::read( void *pBuf, Bu::size iBytes ) -{ - uint32_t i; - - if (iBytes%8) - { - return 0; - } - - iBytes /= 8; - - for (i=0;i class Cipher : Bu::Filter { public: - Cipher( Bu::Stream &rNext ); - virtual ~Cipher(); + Cipher( Bu::Stream &rNext ) : + Bu::Filter( rNext ) + { + } - virtual void start(); - virtual Bu::size stop(); + virtual ~Cipher() + { + } - virtual Bu::size read( void *pBuf, Bu::size iBytes ); - virtual Bu::size write( const void *pBuf, Bu::size iBytes ); + virtual void start() + { + } + + virtual Bu::size stop() + { + return 0; + } + + virtual Bu::size read( void *pBuf, Bu::size iBytes ) + { + uint32_t i; + + if (iBytes%iBlockSize) + { + return 0; + } + + iBytes /= iBlockSize; + + for (i=0;i