summaryrefslogtreecommitdiff
path: root/src/authAlgo.h
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-15 13:44:22 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-15 13:44:22 +0000
commit3ae9918192308c7d8ff691ca6a09b54aa14f68ff (patch)
treef36f81bf8f3dc6f238b8432aec1a264529ffd92b /src/authAlgo.h
parentcipher now stores kd direction (diff)
auth algo now stores direction as well
Diffstat (limited to 'src/authAlgo.h')
-rw-r--r--src/authAlgo.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/authAlgo.h b/src/authAlgo.h
index 3361ccf..809880d 100644
--- a/src/authAlgo.h
+++ b/src/authAlgo.h
@@ -48,20 +48,24 @@
class AuthAlgo
{
public:
- AuthAlgo() {};
+ AuthAlgo() : dir_(KD_INBOUND) {};
+ AuthAlgo(kd_dir_t d) : dir_(d) {};
virtual ~AuthAlgo() {};
/**
* generate the mac
* @param packet the packet to be authenticated
*/
- virtual void generate(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet) = 0;
+ virtual void generate(KeyDerivation& kd, EncryptedPacket& packet) = 0;
/**
* check the mac
* @param packet the packet to be authenticated
*/
- virtual bool checkTag(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet) = 0;
+ virtual bool checkTag(KeyDerivation& kd, EncryptedPacket& packet) = 0;
+
+protected:
+ kd_dir_t dir_;
};
//****** NullAuthAlgo ******
@@ -69,8 +73,8 @@ public:
class NullAuthAlgo : public AuthAlgo
{
public:
- void generate(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet);
- bool checkTag(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet);
+ void generate(KeyDerivation& kd, EncryptedPacket& packet);
+ bool checkTag(KeyDerivation& kd, EncryptedPacket& packet);
};
#ifndef NOCRYPT
@@ -80,11 +84,11 @@ public:
class Sha1AuthAlgo : public AuthAlgo
{
public:
- Sha1AuthAlgo();
+ Sha1AuthAlgo(kd_dir_t d);
~Sha1AuthAlgo();
- void generate(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet);
- bool checkTag(KeyDerivation& kd, kd_dir_t dir, EncryptedPacket& packet);
+ void generate(KeyDerivation& kd, EncryptedPacket& packet);
+ bool checkTag(KeyDerivation& kd, EncryptedPacket& packet);
static const u_int32_t DIGEST_LENGTH = 20;