From 60b7db799a5d9d607dba4b9a66c4421bb60f2577 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 14 Dec 2006 10:58:31 +0000 Subject: implement AlgorithmName() for hash and signature filters git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@259 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- filters.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'filters.h') diff --git a/filters.h b/filters.h index 2737dc0..9cc70ef 100644 --- a/filters.h +++ b/filters.h @@ -108,9 +108,12 @@ private: bool ShouldPropagateMessageEnd() const {return m_transparent;} bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;} - struct MessageRange {unsigned int message; lword position; lword size;}; - friend inline bool operator<(const MessageRange &a, const MessageRange &b) - {return a.message < b.message || (a.message == b.message && a.position < b.position);} + struct MessageRange + { + inline bool operator<(const MessageRange &b) + {return message < b.message || (message == b.message && position < b.position);} + unsigned int message; lword position; lword size; + }; bool m_transparent; lword m_currentMessageBytes, m_totalBytes; @@ -282,6 +285,8 @@ public: HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false, int truncatedDigestSize=-1) : m_hashModule(hm), m_putMessage(putMessage), m_truncatedDigestSize(truncatedDigestSize) {Detach(attachment);} + std::string AlgorithmName() const {return m_hashModule.AlgorithmName();} + void IsolatedInitialize(const NameValuePairs ¶meters); size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); @@ -309,6 +314,8 @@ public: enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = HASH_AT_BEGIN | PUT_RESULT}; HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS); + std::string AlgorithmName() const {return m_hashModule.AlgorithmName();} + bool GetLastResult() const {return m_verified;} protected: @@ -336,6 +343,8 @@ public: SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false) : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {Detach(attachment);} + std::string AlgorithmName() const {return m_signer.AlgorithmName();} + void IsolatedInitialize(const NameValuePairs ¶meters); size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); @@ -361,6 +370,8 @@ public: enum Flags {SIGNATURE_AT_BEGIN=1, PUT_MESSAGE=2, PUT_SIGNATURE=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT}; SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS); + std::string AlgorithmName() const {return m_verifier.AlgorithmName();} + bool GetLastResult() const {return m_verified;} protected: -- cgit v1.2.1