From a2828f6ae67c3d7294118a8144b1b2ec431237c4 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 22 Jul 2004 00:51:57 +0000 Subject: 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 --- modes.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'modes.h') 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 ¶ms, 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 CipherModeFinalTemplate_CipherHolder : public ObjectHolder, public BASE +class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder, public AlgorithmImpl > { 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 CipherModeFinalTemplate_ExternalCipher : public BASE { -- cgit v1.2.1