mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
added lots of debugging info. Fixed stupid bug supplying wrong AES key. Distant chat works!
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6325 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5657ab9796
commit
1e5a7a057c
5 changed files with 19 additions and 10 deletions
|
@ -2948,6 +2948,8 @@ void p3ChatService::receiveTurtleData( RsTurtleGenericTunnelItem *gitem,const st
|
||||||
|
|
||||||
std::cerr << " Using IV: " << std::hex << *(uint64_t*)item->data_bytes << std::dec << std::endl;
|
std::cerr << " Using IV: " << std::hex << *(uint64_t*)item->data_bytes << std::dec << std::endl;
|
||||||
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
|
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
|
||||||
|
std::cerr << " key : " ; printBinaryData(aes_key,16) ; std::cerr << std::endl;
|
||||||
|
std::cerr << " data : " ; printBinaryData(item->data_bytes,item->data_size) ; std::cerr << std::endl;
|
||||||
|
|
||||||
if(!RsAES::aes_decrypt_8_16((uint8_t*)item->data_bytes+8,item->data_size-8,aes_key,(uint8_t*)item->data_bytes,decrypted_data,decrypted_size))
|
if(!RsAES::aes_decrypt_8_16((uint8_t*)item->data_bytes+8,item->data_size-8,aes_key,(uint8_t*)item->data_bytes,decrypted_data,decrypted_size))
|
||||||
{
|
{
|
||||||
|
@ -3005,7 +3007,7 @@ void p3ChatService::sendTurtleData(RsChatItem *item)
|
||||||
}
|
}
|
||||||
it->second.last_contact = time(NULL) ;
|
it->second.last_contact = time(NULL) ;
|
||||||
virtual_peer_id = it->second.virtual_peer_id ;
|
virtual_peer_id = it->second.virtual_peer_id ;
|
||||||
memcpy(aes_key,it->second.aes_key,8) ;
|
memcpy(aes_key,it->second.aes_key,DISTANT_CHAT_AES_KEY_SIZE) ;
|
||||||
}
|
}
|
||||||
std::cerr << "p3ChatService::sendTurtleData(): tunnel found. Encrypting data." << std::endl;
|
std::cerr << "p3ChatService::sendTurtleData(): tunnel found. Encrypting data." << std::endl;
|
||||||
|
|
||||||
|
@ -3017,6 +3019,7 @@ void p3ChatService::sendTurtleData(RsChatItem *item)
|
||||||
uint64_t IV = RSRandom::random_u64() ; // make a random 8 bytes IV
|
uint64_t IV = RSRandom::random_u64() ; // make a random 8 bytes IV
|
||||||
|
|
||||||
std::cerr << " Using IV: " << std::hex << IV << std::dec << std::endl;
|
std::cerr << " Using IV: " << std::hex << IV << std::dec << std::endl;
|
||||||
|
std::cerr << " Using Key: " ; printBinaryData(aes_key,16) ; std::cerr << std::endl;
|
||||||
|
|
||||||
if(!RsAES::aes_crypt_8_16(buff,rssize,aes_key,(uint8_t*)&IV,encrypted_data,encrypted_size))
|
if(!RsAES::aes_crypt_8_16(buff,rssize,aes_key,(uint8_t*)&IV,encrypted_data,encrypted_size))
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,8 +9,8 @@ OPS_TOP_DIR = ../../../../openpgpsdk/src
|
||||||
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
TESTOBJ = dirtest.o sha1_test.o aes_test.o
|
TESTOBJ = dirtest.o sha1_test.o aes_test.o dchat_decrypt.o
|
||||||
TESTS = dirtest sha1_test aes_test
|
TESTS = dirtest sha1_test aes_test dchat_decrypt
|
||||||
|
|
||||||
all: tests
|
all: tests
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ dirtest: dirtest.o
|
||||||
$(CC) $(CFLAGS) -o dirtest dirtest.o $(LIBS)
|
$(CC) $(CFLAGS) -o dirtest dirtest.o $(LIBS)
|
||||||
dirtest: aes_test.o
|
dirtest: aes_test.o
|
||||||
$(CC) $(CFLAGS) -o aes_test aes_test.o $(LIBS)
|
$(CC) $(CFLAGS) -o aes_test aes_test.o $(LIBS)
|
||||||
|
dchat_decrypt: dchat_decrypt.o
|
||||||
|
$(CC) $(CFLAGS) -o dchat_decrypt dchat_decrypt.o $(LIBS)
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
include $(RS_TOP_DIR)/tests/scripts/rules.mk
|
include $(RS_TOP_DIR)/tests/scripts/rules.mk
|
||||||
|
|
|
@ -76,6 +76,9 @@ int main(int argc,char *argv[])
|
||||||
for(int i=0;i<16;++i)
|
for(int i=0;i<16;++i)
|
||||||
key_data[i] = lrand48() & 0xff ;
|
key_data[i] = lrand48() & 0xff ;
|
||||||
|
|
||||||
|
std::cerr << "Key: " ; printHex(key_data,16);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
for(int i=5;i<source_string.length();++i)
|
for(int i=5;i<source_string.length();++i)
|
||||||
{
|
{
|
||||||
for(int j=0;j<8;++j)
|
for(int j=0;j<8;++j)
|
||||||
|
|
|
@ -71,7 +71,7 @@ static NewsFeed *instance = NULL;
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
NewsFeed::NewsFeed(QWidget *parent)
|
NewsFeed::NewsFeed(QWidget *parent)
|
||||||
: MainPage (parent)
|
: RsAutoUpdatePage(1000,parent)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
@ -83,9 +83,9 @@ NewsFeed::NewsFeed(QWidget *parent)
|
||||||
connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
|
connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
|
||||||
connect(feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
connect(feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
// QTimer *timer = new QTimer(this);
|
||||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
|
// timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
|
||||||
timer->start(1000);
|
// timer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewsFeed::~NewsFeed()
|
NewsFeed::~NewsFeed()
|
||||||
|
@ -95,7 +95,7 @@ NewsFeed::~NewsFeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewsFeed::updateFeed()
|
void NewsFeed::updateDisplay()
|
||||||
{
|
{
|
||||||
if (!rsNotify)
|
if (!rsNotify)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "ui_NewsFeed.h"
|
#include "ui_NewsFeed.h"
|
||||||
|
|
||||||
#include "gui/feeds/FeedHolder.h"
|
#include "gui/feeds/FeedHolder.h"
|
||||||
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
class RsFeedItem;
|
class RsFeedItem;
|
||||||
|
|
||||||
class ForumNewItem;
|
class ForumNewItem;
|
||||||
|
@ -33,7 +34,7 @@ class ChanMsgItem;
|
||||||
class ChatMsgItem;
|
class ChatMsgItem;
|
||||||
class FeedNotify;
|
class FeedNotify;
|
||||||
|
|
||||||
class NewsFeed : public MainPage, public FeedHolder, private Ui::NewsFeed
|
class NewsFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::NewsFeed
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ public:
|
||||||
static void testFeeds(uint notifyFlags);
|
static void testFeeds(uint notifyFlags);
|
||||||
static void testFeed(FeedNotify *feedNotify);
|
static void testFeed(FeedNotify *feedNotify);
|
||||||
|
|
||||||
|
virtual void updateDisplay();
|
||||||
signals:
|
signals:
|
||||||
void newsFeedChanged(int count);
|
void newsFeedChanged(int count);
|
||||||
|
|
||||||
|
@ -59,7 +61,6 @@ private slots:
|
||||||
// void toggleChanMsgItems(bool on);
|
// void toggleChanMsgItems(bool on);
|
||||||
void feedoptions();
|
void feedoptions();
|
||||||
|
|
||||||
void updateFeed();
|
|
||||||
void removeAll();
|
void removeAll();
|
||||||
void itemDestroyed(QObject*);
|
void itemDestroyed(QObject*);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue