From cf18c2f73465f82a43a61c58d6bac8505f7cf07a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 19 Feb 2008 21:37:22 +0000 Subject: further cleanups --- authAlgo.h | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'authAlgo.h') diff --git a/authAlgo.h b/authAlgo.h index e3a81be..bf72e32 100644 --- a/authAlgo.h +++ b/authAlgo.h @@ -44,22 +44,32 @@ public: AuthAlgo() {}; virtual ~AuthAlgo() {}; - virtual AuthTag calc(const Buffer& buf) { return AuthTag(0); }; - virtual void setKey(Buffer key) {}; + /** + * set the key for the auth algo + * @param key key for hmac calculation + */ + virtual void setKey(Buffer key) = 0; + + /** + * calculate the sha1 hmac + * @param buf buffer for message digest + * @return sha1 hmac + */ + virtual AuthTag calc(const Buffer& buf) = 0; }; +//****** NullAuthAlgo ****** + class NullAuthAlgo : public AuthAlgo { public: - NullAuthAlgo() {}; AuthTag calc(const Buffer& buf); void setKey(Buffer key) {}; }; -/** - * HMAC SHA1 Auth Tag Generator Class - */ +//****** Sha1AuthAlgo ****** +//* HMAC SHA1 Auth Tag Generator Class class Sha1AuthAlgo : public AuthAlgo { @@ -67,21 +77,10 @@ public: Sha1AuthAlgo(); ~Sha1AuthAlgo(); - /** - * set the key for the auth algo - * @param key key for hmac calculation - */ void setKey(Buffer key); - - /** - * calculate the sha1 hmac - * @param buf buffer for message digest - * @return sha1 hmac - */ AuthTag calc(const Buffer& buf); + protected: - static const char* MIN_GCRYPT_VERSION; - static const u_int32_t GCRYPT_SEC_MEM = 32768; // 32k secure memory gcry_md_hd_t ctx_; Mutex mutex_; }; -- cgit v1.2.3