Pass through input for full control stream encryption on GFE 3.22

This commit is contained in:
Cameron Gutman
2021-04-09 07:44:31 -05:00
parent a51cc972d3
commit 415d97aa4d
+14
View File
@@ -188,6 +188,7 @@ static void inputSendThreadProc(void* context) {
PPACKET_HOLDER holder; PPACKET_HOLDER holder;
char encryptedBuffer[MAX_INPUT_PACKET_SIZE]; char encryptedBuffer[MAX_INPUT_PACKET_SIZE];
uint32_t encryptedSize; uint32_t encryptedSize;
bool encryptedControlStream = APP_VERSION_AT_LEAST(7, 1, 431);
while (!PltIsThreadInterrupted(&inputSendThread)) { while (!PltIsThreadInterrupted(&inputSendThread)) {
int encryptedLengthPrefix; int encryptedLengthPrefix;
@@ -320,6 +321,18 @@ static void inputSendThreadProc(void* context) {
} }
} }
// On GFE 3.22, the entire control stream is encrypted (and support for separate RI encrypted)
// has been removed. We send the plaintext packet through and the control stream code will do
// the encryption.
if (encryptedControlStream) {
err = (SOCK_RET)sendInputPacketOnControlStream((unsigned char*)&holder->packet, holder->packetLength);
if (err < 0) {
Limelog("Input: sendInputPacketOnControlStream() failed: %d\n", (int) err);
ListenerCallbacks.connectionTerminated(err);
return;
}
}
else {
// Encrypt the message into the output buffer while leaving room for the length // Encrypt the message into the output buffer while leaving room for the length
encryptedSize = sizeof(encryptedBuffer) - 4; encryptedSize = sizeof(encryptedBuffer) - 4;
err = encryptData((const unsigned char*)&holder->packet, holder->packetLength, err = encryptData((const unsigned char*)&holder->packet, holder->packetLength,
@@ -366,6 +379,7 @@ static void inputSendThreadProc(void* context) {
} }
} }
} }
}
// This function tells GFE that we support haptics and it should send rumble events to us // This function tells GFE that we support haptics and it should send rumble events to us
static int sendEnableHaptics(void) { static int sendEnableHaptics(void) {