Add replay detection to RTSP and control streams

Replays can do very little harm in these contexts, but let's detect and prevent them anyways.

Fixes #165
Closes #170
This commit is contained in:
Cameron Gutman committed 2026-11-01 14:07:45 -06:00
1 parent 5d3c0ecca0
commit c7dff22963
7 files changed
+139 -17

No files matched your search

+3 -2
View File
@@ -38,7 +38,7 @@ static bool receivedFullFrame;
void initializeVideoStream(void) {
initializeVideoDepacketizer(StreamConfig.packetSize);
RtpvInitializeQueue(&rtpQueue);
decryptionCtx = PltCreateCryptoContext();
decryptionCtx = PltCreateCryptoContext(0);
receivedDataFromPeer = false;
firstDataTimeMs = 0;
receivedFullFrame = false;
@@ -210,7 +210,8 @@ static void VideoReceiveThreadProc(void* context) {
continue;
}
if (!PltDecryptMessage(decryptionCtx, ALGORITHM_AES_GCM, 0,
// Replay detection is handled by the check above and in the RtpFecQueue
if (!PltDecryptMessage(decryptionCtx, ALGORITHM_AES_GCM, CIPHER_FLAG_NO_REPLAY_CHECK, 0, 0,
(unsigned char*)StreamConfig.remoteInputAesKey, sizeof(StreamConfig.remoteInputAesKey),
encHeader->iv, sizeof(encHeader->iv),
encHeader->tag, sizeof(encHeader->tag),