summaryrefslogtreecommitdiffstats
path: root/media/webm
diff options
context:
space:
mode:
authorfgalligan@chromium.org <fgalligan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-18 09:00:36 +0000
committerfgalligan@chromium.org <fgalligan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-18 09:00:36 +0000
commitf7a69d1d3dd0cf1cce5dbb6483d78476614344d6 (patch)
treeda4de22bdbeccdd42d8b14c6ffe054a26686a2ac /media/webm
parent6dd33d9c6ff2c9dbca544c0abb25d9c2977556a5 (diff)
downloadchromium_src-f7a69d1d3dd0cf1cce5dbb6483d78476614344d6.zip
chromium_src-f7a69d1d3dd0cf1cce5dbb6483d78476614344d6.tar.gz
chromium_src-f7a69d1d3dd0cf1cce5dbb6483d78476614344d6.tar.bz2
We are removing checksum/HMAC in WebM spec for encrypted content.
xhwang's CL http://codereview.chromium.org/10918276 has been merged into this one. 10918276 CL updates the CDM interface, ClearKeyCdm, CdmWrapper and PPAPI code to reflect this change. - Remove checksum from DecryptConfig. - Remove HMAC from AesDecryptor. - Update AesDecryptorTest as all decrypts will not fail but the data checks will. - Remove FakeCheckSum from ffmpeg_video_decoder_unittest. - Remove HMAC from WebMClusterParser. - Remove checksum from ppapi_plugin_instance. BUG=150014 TEST=All media_unittests pass. TBR=dmichael Review URL: https://chromiumcodereview.appspot.com/10917308 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/webm')
-rw-r--r--media/webm/webm_cluster_parser.cc24
-rw-r--r--media/webm/webm_constants.h4
2 files changed, 11 insertions, 17 deletions
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index cb7501e..a6867bc0 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>())));
}
diff --git a/media/webm/webm_constants.h b/media/webm/webm_constants.h
index 7d6f3ed..463b15a 100644
--- a/media/webm/webm_constants.h
+++ b/media/webm/webm_constants.h
@@ -199,11 +199,9 @@ const int64 kWebMUnknownSize = GG_LONGLONG(0x00FFFFFFFFFFFFFF);
const uint8 kWebMFlagKeyframe = 0x80;
-// The size is from the WebM encrypted specification. Current encrypted WebM
-// request for comments specification is here
+// Current encrypted WebM request for comments specification is here
// http://wiki.webmproject.org/encryption/webm-encryption-rfc
const uint8 kWebMFlagEncryptedFrame = 0x1;
-const int kWebMHmacSize = 12;
} // namespace media