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

Side by Side Diff: media/crypto/aes_decryptor.cc

Issue 10822026: Implement "Key Presence" step in "Encrypted Block Encounted" algorithm in EME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix broken ChunkDemuxerTest due to null MessageLoop::Current() Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/crypto/aes_decryptor.h" 5 #include "media/crypto/aes_decryptor.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "crypto/encryptor.h" 10 #include "crypto/encryptor.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 DecryptionKey* key = NULL; 275 DecryptionKey* key = NULL;
276 { 276 {
277 base::AutoLock auto_lock(key_map_lock_); 277 base::AutoLock auto_lock(key_map_lock_);
278 KeyMap::const_iterator found = key_map_.find(key_id); 278 KeyMap::const_iterator found = key_map_.find(key_id);
279 if (found != key_map_.end()) 279 if (found != key_map_.end())
280 key = found->second; 280 key = found->second;
281 } 281 }
282 282
283 if (!key) { 283 if (!key) {
284 // TODO(fgalligan): Fire a need_key event here and add a test.
285 DVLOG(1) << "Could not find a matching key for given key ID."; 284 DVLOG(1) << "Could not find a matching key for given key ID.";
286 decrypt_cb.Run(kError, NULL); 285 decrypt_cb.Run(kNoKey, NULL);
287 return; 286 return;
288 } 287 }
289 288
290 int checksum_size = encrypted->GetDecryptConfig()->checksum().size(); 289 int checksum_size = encrypted->GetDecryptConfig()->checksum().size();
291 // According to the WebM encrypted specification, it is an open question 290 // According to the WebM encrypted specification, it is an open question
292 // what should happen when a frame fails the integrity check. 291 // what should happen when a frame fails the integrity check.
293 // http://wiki.webmproject.org/encryption/webm-encryption-rfc 292 // http://wiki.webmproject.org/encryption/webm-encryption-rfc
294 if (checksum_size > 0 && 293 if (checksum_size > 0 &&
295 !key->hmac_key().empty() && 294 !key->hmac_key().empty() &&
296 !CheckData(*encrypted, key->hmac_key())) { 295 !CheckData(*encrypted, key->hmac_key())) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 345
347 hmac_key_ = DeriveKey(secret_, kWebmHmacSeed, kWebmSha1DigestSize); 346 hmac_key_ = DeriveKey(secret_, kWebmHmacSeed, kWebmSha1DigestSize);
348 if (hmac_key_.empty()) { 347 if (hmac_key_.empty()) {
349 return false; 348 return false;
350 } 349 }
351 350
352 return true; 351 return true;
353 } 352 }
354 353
355 } // namespace media 354 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698