mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-10-26 05:49:59 +00:00
Perform control stream encryption in-place
This commit is contained in:
1 parent
aeba988e0a
commit
342b106bbb
1 file changed
+1
-3
+1
-3
@@ -703,7 +703,6 @@ static bool sendMessageEnet(short ptype, short paylen, const void* payload, uint
|
|||||||
if (encryptedControlStream) {
|
if (encryptedControlStream) {
|
||||||
PNVCTL_ENCRYPTED_PACKET_HEADER encPacket;
|
PNVCTL_ENCRYPTED_PACKET_HEADER encPacket;
|
||||||
PNVCTL_ENET_PACKET_HEADER_V2 packet;
|
PNVCTL_ENET_PACKET_HEADER_V2 packet;
|
||||||
char tempBuffer[256];
|
|
||||||
|
|
||||||
enetPacket = enet_packet_create(NULL,
|
enetPacket = enet_packet_create(NULL,
|
||||||
sizeof(*encPacket) + AES_GCM_TAG_LENGTH + sizeof(*packet) + paylen,
|
sizeof(*encPacket) + AES_GCM_TAG_LENGTH + sizeof(*packet) + paylen,
|
||||||
@@ -722,8 +721,7 @@ static bool sendMessageEnet(short ptype, short paylen, const void* payload, uint
|
|||||||
encPacket->seq = currentEnetSequenceNumber++;
|
encPacket->seq = currentEnetSequenceNumber++;
|
||||||
|
|
||||||
// Construct the plaintext data for encryption
|
// Construct the plaintext data for encryption
|
||||||
LC_ASSERT(sizeof(*packet) + paylen < sizeof(tempBuffer));
|
packet = (PNVCTL_ENET_PACKET_HEADER_V2)(((unsigned char*)(encPacket + 1)) + AES_GCM_TAG_LENGTH);
|
||||||
packet = (PNVCTL_ENET_PACKET_HEADER_V2)tempBuffer;
|
|
||||||
packet->type = ptype;
|
packet->type = ptype;
|
||||||
packet->payloadLength = paylen;
|
packet->payloadLength = paylen;
|
||||||
memcpy(&packet[1], payload, paylen);
|
memcpy(&packet[1], payload, paylen);
|
||||||
|
|||||||
Reference in new issue
Block a user