Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: media/webm/webm_cluster_parser.cc

Issue 10917308: Remove the checksum/HMAC code from the decryptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix proxy_decryptor_unittest. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mp4/track_run_iterator.cc ('k') | media/webm/webm_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_cluster_parser.cc
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index cb7501e23d2acef634ab3987961e5f183a5aba01..a6867bc07d9783c863325f9f84dd89705defcf2a 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -203,46 +203,42 @@ bool WebMClusterParser::OnBlock(int track_num, int timecode,
base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds(
(cluster_timecode_ + timecode) * timecode_multiplier_);
- // Every encrypted Block has an HMAC and IV prepended to it. Current encrypted
- // WebM request for comments specification is here
+ // Every encrypted Block has a signal byte and IV prepended to it. Current
+ // encrypted WebM request for comments specification is here
// http://wiki.webmproject.org/encryption/webm-encryption-rfc
bool is_track_encrypted =
track_num == video_.track_num() && !video_encryption_key_id_.empty();
- // If stream is encrypted skip past the HMAC. Encrypted buffers must include
- // the signal byte, the IV (if frame is encrypted) and
- // the frame because the decryptor will verify this data before decryption.
- // The HMAC and IV will be copied into DecryptConfig.
- int offset = (is_track_encrypted) ? kWebMHmacSize : 0;
-
// The first bit of the flags is set when the block contains only keyframes.
// http://www.matroska.org/technical/specs/index.html
bool is_keyframe = (flags & 0x80) != 0;
scoped_refptr<StreamParserBuffer> buffer =
- StreamParserBuffer::CopyFrom(data + offset, size - offset, is_keyframe);
+ StreamParserBuffer::CopyFrom(data, size, is_keyframe);
if (is_track_encrypted) {
- uint8 signal_byte = data[kWebMHmacSize];
+ uint8 signal_byte = data[0];
int data_offset = sizeof(signal_byte);
// Setting the DecryptConfig object of the buffer while leaving the
// initialization vector empty will tell the decryptor that the frame is
- // unencrypted but integrity should still be checked.
+ // unencrypted.
std::string counter_block;
if (signal_byte & kWebMFlagEncryptedFrame) {
uint64 network_iv;
- memcpy(&network_iv, data + kWebMHmacSize + data_offset,
- sizeof(network_iv));
+ memcpy(&network_iv, data + data_offset, sizeof(network_iv));
const uint64 iv = base::NetToHost64(network_iv);
counter_block = GenerateCounterBlock(iv);
data_offset += sizeof(iv);
}
+ // TODO(fgalligan): Revisit if DecryptConfig needs to be set on unencrypted
+ // frames after the CDM API is finalized.
+ // Unencrypted frames of potentially encrypted streams currently set
+ // DecryptConfig.
buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig(
video_encryption_key_id_,
counter_block,
- std::string(reinterpret_cast<const char*>(data), kWebMHmacSize),
data_offset,
std::vector<SubsampleEntry>())));
}
« no previous file with comments | « media/mp4/track_run_iterator.cc ('k') | media/webm/webm_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698