summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-19 14:51:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-19 14:51:40 +0000
commit29c1c6412bb7ea7e96b5692c0e254b11edb25355 (patch)
tree3ec08fc9dffae245cf17fd27232384ac69d9ef83 /src/modules/m_spanningtree.cpp
parent1ff6400b247990ccc1a56d40dc5df33a765ae99a (diff)
Encryption debug
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2570 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 568dbf310..49493b423 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -578,6 +578,7 @@ class TreeSocket : public InspSocket
return;
ctx = new AES();
+ log(DEBUG,"Initialized AES key %s",key.c_str());
// key must be 16, 24, 32 etc bytes (multiple of 8)
keylength = key.length();
if (!(keylength == 16 || keylength == 24 || keylength == 32))
@@ -1164,6 +1165,7 @@ class TreeSocket : public InspSocket
{
char out[1024];
char result[1024];
+ log(DEBUG,"Original string '%s'",ret.c_str());
int nbytes = from64tobits(out, ret.c_str(), 1024);
log(DEBUG,"m_spanningtree: decrypt %d bytes",nbytes);
ctx->Decrypt(out, result, nbytes, 0);
@@ -1181,14 +1183,18 @@ class TreeSocket : public InspSocket
int WriteLine(std::string line)
{
log(DEBUG,"OUT: %s",line.c_str());
- if (ctx)
+ if (this->ctx)
{
+ log(DEBUG,"AES context");
char result[1024];
char result64[1024];
- while (line.length() % this->keylength != 0)
+ if (this->keylength)
{
- // pad it to be a multiple of the key length
- line = line + "\0";
+ while (line.length() % this->keylength != 0)
+ {
+ // pad it to be a multiple of the key length
+ line = line + "\0";
+ }
}
ctx->Encrypt(line.c_str(), result, line.length(),0);
to64frombits((unsigned char*)result64,