summaryrefslogtreecommitdiff
path: root/modes.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2004-07-22 00:51:57 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2004-07-22 00:51:57 +0000
commita2828f6ae67c3d7294118a8144b1b2ec431237c4 (patch)
treefaff40f3429fb7fb70249c83afd5378f92ebdb31 /modes.h
parente87d537834e72b242b4c16b99f0a40586940104b (diff)
downloadcryptopp-a2828f6ae67c3d7294118a8144b1b2ec431237c4.tar.gz
fix documentation, fix PanamaMAC, fix algorithm names
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@186 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'modes.h')
-rw-r--r--modes.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/modes.h b/modes.h
index a657eb0..4fe1772 100644
--- a/modes.h
+++ b/modes.h
@@ -82,6 +82,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTe
{
public:
IV_Requirement IVRequirement() const {return RANDOM_IV;}
+ static const char *StaticAlgorithmName() {return "CFB";}
protected:
unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
@@ -126,6 +127,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTe
public:
bool IsRandomAccess() const {return false;}
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
+ static const char *StaticAlgorithmName() {return "OFB";}
private:
unsigned int GetBytesPerIteration() const {return BlockSize();}
@@ -148,6 +150,7 @@ public:
bool IsRandomAccess() const {return true;}
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
void GetNextIV(byte *IV);
+ static const char *StaticAlgorithmName() {return "Counter-BE";}
private:
unsigned int GetBytesPerIteration() const {return BlockSize();}
@@ -194,6 +197,7 @@ public:
unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks)
{m_cipher->ProcessAndXorMultipleBlocks(inString, NULL, outString, numberOfBlocks);}
+ static const char *StaticAlgorithmName() {return "ECB";}
};
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase
@@ -202,6 +206,7 @@ public:
IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
bool RequireAlignedInput() const {return false;}
unsigned int MinLastBlockSize() const {return 0;}
+ static const char *StaticAlgorithmName() {return "CBC";}
};
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Encryption : public CBC_ModeBase
@@ -216,6 +221,7 @@ public:
void SetStolenIV(byte *iv) {m_stolenIV = iv;}
unsigned int MinLastBlockSize() const {return BlockSize()+1;}
void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);
+ static const char *StaticAlgorithmName() {return "CBC/CTS";}
protected:
void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv)
@@ -248,9 +254,9 @@ public:
void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);
};
-//! .
+//! _
template <class CIPHER, class BASE>
-class CipherModeFinalTemplate_CipherHolder : public ObjectHolder<CIPHER>, public BASE
+class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> >
{
public:
CipherModeFinalTemplate_CipherHolder()
@@ -273,9 +279,12 @@ public:
this->m_cipher = &this->m_object;
this->SetKey(key, length, MakeParameters(Name::IV(), iv)(Name::FeedbackSize(), feedbackSize));
}
+
+ static std::string StaticAlgorithmName()
+ {return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
};
-//! .
+//! _
template <class BASE>
class CipherModeFinalTemplate_ExternalCipher : public BASE
{