mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -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 << " 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))
|
||||
{
|
||||
|
@ -3005,7 +3007,7 @@ void p3ChatService::sendTurtleData(RsChatItem *item)
|
|||
}
|
||||
it->second.last_contact = time(NULL) ;
|
||||
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;
|
||||
|
||||
|
@ -3017,6 +3019,7 @@ void p3ChatService::sendTurtleData(RsChatItem *item)
|
|||
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 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))
|
||||
{
|
||||
|
|
|
@ -9,8 +9,8 @@ OPS_TOP_DIR = ../../../../openpgpsdk/src
|
|||
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
||||
###############################################################
|
||||
|
||||
TESTOBJ = dirtest.o sha1_test.o aes_test.o
|
||||
TESTS = dirtest sha1_test aes_test
|
||||
TESTOBJ = dirtest.o sha1_test.o aes_test.o dchat_decrypt.o
|
||||
TESTS = dirtest sha1_test aes_test dchat_decrypt
|
||||
|
||||
all: tests
|
||||
|
||||
|
@ -20,6 +20,8 @@ dirtest: dirtest.o
|
|||
$(CC) $(CFLAGS) -o dirtest dirtest.o $(LIBS)
|
||||
dirtest: aes_test.o
|
||||
$(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
|
||||
|
|
|
@ -76,6 +76,9 @@ int main(int argc,char *argv[])
|
|||
for(int i=0;i<16;++i)
|
||||
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 j=0;j<8;++j)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue