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

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

Issue 10822013: Code clean-up in AesDecryptor and test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « no previous file | media/crypto/aes_decryptor.cc » ('j') | media/crypto/aes_decryptor.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_
6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // The key used to perform the integrity check. Currently the HMAC key is 83 // The key used to perform the integrity check. Currently the HMAC key is
84 // defined by the WebM encrypted specification. Current encrypted WebM 84 // defined by the WebM encrypted specification. Current encrypted WebM
85 // request for comments specification is here 85 // request for comments specification is here
86 // http://wiki.webmproject.org/encryption/webm-encryption-rfc 86 // http://wiki.webmproject.org/encryption/webm-encryption-rfc
87 std::string hmac_key_; 87 std::string hmac_key_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(DecryptionKey); 89 DISALLOW_COPY_AND_ASSIGN(DecryptionKey);
90 }; 90 };
91 91
92 // Sets |key| for |key_id|. The AesDecryptor takes the ownership of the |key|.
93 void SetKey(const std::string& key_id, scoped_ptr<DecryptionKey> key);
94
95 // Gets a DecryptionKey associated with |key_id|. The AesDecryptor still owns
96 // the key. Returns NULL if no key is associated with |key_id|.
97 DecryptionKey* GetKey(const std::string& key_id) const;
98
92 // KeyMap owns the DecryptionKey* and must delete them when they are 99 // KeyMap owns the DecryptionKey* and must delete them when they are
93 // not needed any more. 100 // not needed any more.
94 typedef base::hash_map<std::string, DecryptionKey*> KeyMap; 101 typedef base::hash_map<std::string, DecryptionKey*> KeyMap;
95 102
96 // Since only Decrypt() is called off the renderer thread, we only need to 103 // Since only Decrypt() is called off the renderer thread, we only need to
97 // protect |key_map_|, the only member variable that is shared between 104 // protect |key_map_|, the only member variable that is shared between
98 // Decrypt() and other methods. 105 // Decrypt() and other methods.
99 KeyMap key_map_; // Protected by the |key_map_lock_|. 106 KeyMap key_map_; // Protected by the |key_map_lock_|.
100 base::Lock key_map_lock_; // Protects the |key_map_|. 107 mutable base::Lock key_map_lock_; // Protects the |key_map_|.
101 108
102 // Make session ID unique per renderer by making it static. 109 // Make session ID unique per renderer by making it static.
103 // TODO(xhwang): Make session ID more strictly defined if needed: 110 // TODO(xhwang): Make session ID more strictly defined if needed:
104 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0 111 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0
105 static uint32 next_session_id_; 112 static uint32 next_session_id_;
106 113
107 DecryptorClient* const client_; 114 DecryptorClient* const client_;
108 115
109 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); 116 DISALLOW_COPY_AND_ASSIGN(AesDecryptor);
110 }; 117 };
111 118
112 } // namespace media 119 } // namespace media
113 120
114 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ 121 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « no previous file | media/crypto/aes_decryptor.cc » ('j') | media/crypto/aes_decryptor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698