From 823af1bc3a10e1df0b3d86856dfcd652d5d6b881 Mon Sep 17 00:00:00 2001 From: Erwin Nindl Date: Tue, 11 Dec 2007 14:23:53 +0000 Subject: recever gets seq and sid now --- anytun.cpp | 6 +++--- packet.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/anytun.cpp b/anytun.cpp index d2500ec..d6e0dbf 100644 --- a/anytun.cpp +++ b/anytun.cpp @@ -106,7 +106,7 @@ void encryptPacket(Packet & pack, Cypher & c, ConnectionParam & conn, void* p) c.setSalt(tmp_salt); cLog.msg(Log::PRIO_NOTICE) << "Send Package: seq: " << conn.seq_nr_ - << "sID: " << param->opt.getSenderId(); + << ", sID: " << param->opt.getSenderId(); //cLog.msg(Log::PRIO_NOTICE) << "Package dump: " << pack.getHexDump(); c.cypher(pack, conn.seq_nr_, param->opt.getSenderId()); @@ -117,6 +117,8 @@ bool decryptPacket(Packet & pack, Cypher & c, ConnectionParam & conn) u_int16_t sid = pack.getSenderId(); u_int16_t seq = pack.getSeqNr(); + pack.removeHeader(); + // decypher the packet //Buffer tmp_key(16), tmp_salt(14); // conn.kd_.generate(label_satp_encryption, seq, tmp_key, tmp_key.getLength()); @@ -125,7 +127,6 @@ bool decryptPacket(Packet & pack, Cypher & c, ConnectionParam & conn) Buffer tmp_key(key, sizeof(key)); Buffer tmp_salt(salt, sizeof(salt)); - c.setKey(tmp_key); c.setSalt(tmp_salt); c.cypher(pack, seq, sid); @@ -281,7 +282,6 @@ void* receiver(void* p) //Replay Protection //if (!checkPacketSeqNr(pack,conn)) // continue; - pack.removeHeader(); if (!decryptPacket(pack, c, conn)) continue; diff --git a/packet.cpp b/packet.cpp index 156e02a..d592e1e 100644 --- a/packet.cpp +++ b/packet.cpp @@ -29,6 +29,7 @@ */ #include +#include #include #include // for std::memcpy -- cgit v1.2.3