diff options
-rw-r--r-- | anytun.cpp | 6 | ||||
-rw-r--r-- | keyDerivation.cpp | 5 | ||||
-rw-r--r-- | keyDerivation.h | 1 | ||||
-rw-r--r-- | syncBuffer.h | 15 |
4 files changed, 16 insertions, 11 deletions
@@ -80,12 +80,12 @@ uint8_t salt[] = { void createConnection(const std::string & remote_host , u_int16_t remote_port, ConnectionList & cl, u_int16_t seqSize) { - SeqWindow seq(seqSize); + SeqWindow * seq= new SeqWindow(seqSize); seq_nr_t seq_nr_=0; - KeyDerivation kd; + KeyDerivation * kd = new KeyDerivation; // kd.init(Buffer(key, sizeof(key)), Buffer(salt, sizeof(salt))); cLog.msg(Log::PRIO_NOTICE) << "added connection remote host " << remote_host << ":" << remote_port; - ConnectionParam connparam ( kd, seq, seq_nr_, remote_host, remote_port); + ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_host, remote_port); cl.addConnection(connparam,std::string("default")); } diff --git a/keyDerivation.cpp b/keyDerivation.cpp index c9db305..afe20f6 100644 --- a/keyDerivation.cpp +++ b/keyDerivation.cpp @@ -149,3 +149,8 @@ void KeyDerivation::clear() Lock lock(mutex_); gcry_cipher_close( cipher_ ); } + +u_int32_t KeyDerivation::bufferGetLength() const +{ + return salt_.getLength(); +} diff --git a/keyDerivation.h b/keyDerivation.h index 2bcd3f5..d8b9017 100644 --- a/keyDerivation.h +++ b/keyDerivation.h @@ -58,6 +58,7 @@ public: void setLogKDRate(const u_int8_t ld_rate); void generate(satp_prf_label label, seq_nr_t seq_nr, Buffer& key, u_int32_t length); void clear(); + u_int32_t bufferGetLength() const; private: KeyDerivation(const KeyDerivation & src); diff --git a/syncBuffer.h b/syncBuffer.h index f56c70b..1bae2a3 100644 --- a/syncBuffer.h +++ b/syncBuffer.h @@ -40,20 +40,19 @@ class SyncBuffer : public Buffer { public: - SyncBuffer() : Buffer(){ std::cout << " SyncBuffer() -> Length: " << length_ << std::endl;}; - SyncBuffer(u_int32_t length) : Buffer(length){ std::cout << "SyncBuffer(u_int32_t length) Length: " << length_ << std::endl; }; - SyncBuffer(Buffer b): Buffer(b) {std::cout << " SyncBuffer(Buffer b) " << length_ << std::endl;}; - SyncBuffer(u_int8_t* data, u_int32_t length): Buffer(data,length) { std::cout << "SyncBuffer(u_int8_t* data, u_int32_t length)-> Length: "<< length_ << std::endl;}; - SyncBuffer(const SyncBuffer & src) : Buffer(src) {std::cout << " SyncBuffer(const SyncBuffer & src)-> Length: "<< length_ << std::endl;}; + SyncBuffer() : Buffer(){}; + SyncBuffer(u_int32_t length) : Buffer(length){}; + SyncBuffer(Buffer b): Buffer(b) {}; + SyncBuffer(u_int8_t* data, u_int32_t length): Buffer(data,length) {}; + SyncBuffer(const SyncBuffer & src) : Buffer(src) {}; private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { - std::cout << "Length: " << length_ << std::endl; ar & length_; - //for(u_int32_t i = 0; i < length_; i++) - // ar & (*this)[i]; + for(u_int32_t i = 0; i < length_; i++) + ar & (*this)[i]; } }; |