Skip to content

Commit

Permalink
Send the frame number in the encrypted video header
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Jan 25, 2024
1 parent bc78a82 commit ddf4448
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace stream {
}

std::uint8_t iv[12]; // 12-byte IV is ideal for AES-GCM
std::uint32_t unused;
std::uint32_t frameNumber;
std::uint8_t tag[16];
};

Expand Down Expand Up @@ -1419,7 +1419,7 @@ namespace stream {

// Encrypt the target buffer in place
auto *prefix = (video_packet_enc_prefix_t *) shards.prefix(x);
prefix->unused = 0;
prefix->frameNumber = packet->frame_index();
std::copy(std::begin(iv), std::end(iv), prefix->iv);
session->video.cipher->encrypt(std::string_view { (char *) inspect, (size_t) blocksize }, prefix->tag, &iv);
}
Expand Down

0 comments on commit ddf4448

Please sign in to comment.