Compare commits
No commits in common. "c7375ad44b1be54aeac6a34fe3a2291a3b2efaa7" and "56b645db4701194bb0c0d6714cbfb0c4a86f4e02" have entirely different histories.
c7375ad44b
...
56b645db47
@ -48,7 +48,6 @@ int encrypt(packet *packet, unsigned char *outBuf, UINT16 *len, unsigned char *k
|
||||
unsigned char *m = packet->Data;
|
||||
|
||||
// additional text
|
||||
packet->DataType = __bswap_16(packet->DataType);
|
||||
int adlen = sizeof(packet->DataType);
|
||||
unsigned char *ad = (unsigned char *)&packet->DataType;
|
||||
|
||||
@ -67,6 +66,8 @@ int encrypt(packet *packet, unsigned char *outBuf, UINT16 *len, unsigned char *k
|
||||
}
|
||||
|
||||
// type 0 1
|
||||
// Swap after adding it as additional data
|
||||
packet->DataType = __bswap_16(packet->DataType);
|
||||
int loc = 0;
|
||||
memcpy(&outBuf[loc], &packet->DataType, sizeof(UINT16));
|
||||
loc += sizeof(UINT16);
|
||||
@ -101,7 +102,6 @@ int decrypt(packetEx *packet, unsigned char *inBuf, UINT16 len, unsigned char *k
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEBUG_PRINT("line %d\n", __LINE__);
|
||||
memcpy(&packet->DataType, &inBuf[loc], sizeof(UINT16));
|
||||
loc += sizeof(UINT16);
|
||||
@ -110,6 +110,7 @@ int decrypt(packetEx *packet, unsigned char *inBuf, UINT16 len, unsigned char *k
|
||||
memcpy(&packet->Size, &inBuf[loc], sizeof(UINT16));
|
||||
loc += sizeof(UINT16);
|
||||
|
||||
packet->DataType = __bswap_16(packet->DataType);
|
||||
packet->Size = __bswap_16(packet->Size);
|
||||
packet->Id = __bswap_32(packet->Id);
|
||||
|
||||
@ -142,9 +143,6 @@ int decrypt(packetEx *packet, unsigned char *inBuf, UINT16 len, unsigned char *k
|
||||
DEBUG_PRINT("line %d mlen:%d clen:%d\n", __LINE__, mlen, clen);
|
||||
int ret = romulus_m_decrypt(m, &mlen, 0, c, clen, ad, adlen, npub, key);
|
||||
DEBUG_PRINT("line %d packet:%d, mlen %d\n", __LINE__, packet->Size, mlen);
|
||||
|
||||
// swap after decrypt, we sign the big endian bytes
|
||||
packet->DataType = __bswap_16(packet->DataType);
|
||||
if (ret == 0)
|
||||
{
|
||||
DEBUG_PRINT("line %d\n", __LINE__);
|
||||
|
Loading…
x
Reference in New Issue
Block a user