diff options
author | Christian Pointner <equinox@anytun.org> | 2009-01-15 01:00:19 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-01-15 01:00:19 +0000 |
commit | bb9f6547ad858b11fb29c7f1e23eddb1573bff1c (patch) | |
tree | 39eb1d0f0bc4e20dadd03518b0af5a689a639031 /src/authAlgo.cpp | |
parent | ported authAlgo from uanytun to anytun (diff) |
ported uanytun key derivation to anytun
no key store until now (ld_kdr gets ignored)
no multi kd until now (WritersLock instead of ReadersLock @ generate)
finally removed creepy mpi class
Diffstat (limited to 'src/authAlgo.cpp')
-rw-r--r-- | src/authAlgo.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/authAlgo.cpp b/src/authAlgo.cpp index 669308b..a0b9193 100644 --- a/src/authAlgo.cpp +++ b/src/authAlgo.cpp @@ -38,11 +38,11 @@ #include <cstring> //****** NullAuthAlgo ****** -void NullAuthAlgo::generate(KeyDerivation& kd, EncryptedPacket& packet) +void NullAuthAlgo::generate(KeyDerivation& kd, kd_dir dir, EncryptedPacket& packet) { } -bool NullAuthAlgo::checkTag(KeyDerivation& kd, EncryptedPacket& packet) +bool NullAuthAlgo::checkTag(KeyDerivation& kd, kd_dir dir, EncryptedPacket& packet) { return true; } @@ -74,13 +74,13 @@ Sha1AuthAlgo::~Sha1AuthAlgo() #endif } -void Sha1AuthAlgo::generate(KeyDerivation& kd, EncryptedPacket& packet) +void Sha1AuthAlgo::generate(KeyDerivation& kd, kd_dir dir, EncryptedPacket& packet) { packet.addAuthTag(); if(!packet.getAuthTagLength()) return; - bool result = kd.generate(LABEL_SATP_MSG_AUTH, packet.getSeqNr(), key_); + bool result = kd.generate(dir, LABEL_SATP_MSG_AUTH, packet.getSeqNr(), key_); if(result) { // a new key got generated #ifndef USE_SSL_CRYPTO gcry_error_t err = gcry_md_setkey(handle_, key_.getBuf(), key_.getLength()); @@ -118,13 +118,13 @@ void Sha1AuthAlgo::generate(KeyDerivation& kd, EncryptedPacket& packet) std::memcpy(&tag[packet.getAuthTagLength() - length], &hmac[DIGEST_LENGTH - length], length); } -bool Sha1AuthAlgo::checkTag(KeyDerivation& kd, EncryptedPacket& packet) +bool Sha1AuthAlgo::checkTag(KeyDerivation& kd, kd_dir dir, EncryptedPacket& packet) { packet.withAuthTag(true); if(!packet.getAuthTagLength()) return true; - bool result = kd.generate(LABEL_SATP_MSG_AUTH, packet.getSeqNr(), key_); + bool result = kd.generate(dir, LABEL_SATP_MSG_AUTH, packet.getSeqNr(), key_); if(result) { // a new key got generated #ifndef USE_SSL_CRYPTO gcry_error_t err = gcry_md_setkey(handle_, key_.getBuf(), key_.getLength()); |