implement AlgorithmName() for hash and signature filters

pull/2/head
weidai 2006-12-14 10:58:31 +00:00
parent 66b8585f9e
commit 0f5ff1a063
1 changed files with 14 additions and 3 deletions

View File

@ -108,9 +108,12 @@ private:
bool ShouldPropagateMessageEnd() const {return m_transparent;} bool ShouldPropagateMessageEnd() const {return m_transparent;}
bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;} bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;}
struct MessageRange {unsigned int message; lword position; lword size;}; struct MessageRange
friend inline bool operator<(const MessageRange &a, const MessageRange &b) {
{return a.message < b.message || (a.message == b.message && a.position < b.position);} 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; bool m_transparent;
lword m_currentMessageBytes, m_totalBytes; lword m_currentMessageBytes, m_totalBytes;
@ -282,6 +285,8 @@ public:
HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false, int truncatedDigestSize=-1) HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false, int truncatedDigestSize=-1)
: m_hashModule(hm), m_putMessage(putMessage), m_truncatedDigestSize(truncatedDigestSize) {Detach(attachment);} : m_hashModule(hm), m_putMessage(putMessage), m_truncatedDigestSize(truncatedDigestSize) {Detach(attachment);}
std::string AlgorithmName() const {return m_hashModule.AlgorithmName();}
void IsolatedInitialize(const NameValuePairs &parameters); void IsolatedInitialize(const NameValuePairs &parameters);
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); 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}; 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); HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS);
std::string AlgorithmName() const {return m_hashModule.AlgorithmName();}
bool GetLastResult() const {return m_verified;} bool GetLastResult() const {return m_verified;}
protected: protected:
@ -336,6 +343,8 @@ public:
SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false) 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);} : 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 &parameters); void IsolatedInitialize(const NameValuePairs &parameters);
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); 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}; 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); 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;} bool GetLastResult() const {return m_verified;}
protected: protected: