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

Side by Side Diff: content/child/webcrypto/structured_clone.cc

Issue 670773003: Cleanup: rename usage_mask --> usages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/webcrypto/structured_clone.h" 5 #include "content/child/webcrypto/structured_clone.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/child/webcrypto/algorithm_dispatch.h" 8 #include "content/child/webcrypto/algorithm_dispatch.h"
9 #include "content/child/webcrypto/platform_crypto.h" 9 #include "content/child/webcrypto/platform_crypto.h"
10 #include "content/child/webcrypto/status.h" 10 #include "content/child/webcrypto/status.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Note that this function is called from the target Blink thread. 102 // Note that this function is called from the target Blink thread.
103 bool SerializeKeyForClone(const blink::WebCryptoKey& key, 103 bool SerializeKeyForClone(const blink::WebCryptoKey& key,
104 blink::WebVector<uint8_t>* key_data) { 104 blink::WebVector<uint8_t>* key_data) {
105 return PlatformSerializeKeyForClone(key, key_data); 105 return PlatformSerializeKeyForClone(key, key_data);
106 } 106 }
107 107
108 // Note that this function is called from the target Blink thread. 108 // Note that this function is called from the target Blink thread.
109 bool DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm, 109 bool DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
110 blink::WebCryptoKeyType type, 110 blink::WebCryptoKeyType type,
111 bool extractable, 111 bool extractable,
112 blink::WebCryptoKeyUsageMask usage_mask, 112 blink::WebCryptoKeyUsageMask usages,
113 const CryptoData& key_data, 113 const CryptoData& key_data,
114 blink::WebCryptoKey* key) { 114 blink::WebCryptoKey* key) {
115 // TODO(eroman): This should not call into the platform crypto layer. 115 // TODO(eroman): This should not call into the platform crypto layer.
116 // Otherwise it runs the risk of stalling while the NSS/OpenSSL global locks 116 // Otherwise it runs the risk of stalling while the NSS/OpenSSL global locks
117 // are held. 117 // are held.
118 // 118 //
119 // An alternate approach is to defer the key import until the key is used. 119 // An alternate approach is to defer the key import until the key is used.
120 // However this means that any deserialization errors would have to be 120 // However this means that any deserialization errors would have to be
121 // surfaced as WebCrypto errors, leading to slightly different behaviors. For 121 // surfaced as WebCrypto errors, leading to slightly different behaviors. For
122 // instance you could clone a key which fails to be deserialized. 122 // instance you could clone a key which fails to be deserialized.
123 Status status = ImportKey(GetCloneFormatForKeyType(type), 123 Status status = ImportKey(GetCloneFormatForKeyType(type),
124 key_data, 124 key_data,
125 KeyAlgorithmToImportAlgorithm(algorithm), 125 KeyAlgorithmToImportAlgorithm(algorithm),
126 extractable, 126 extractable,
127 usage_mask, 127 usages,
128 key); 128 key);
129 if (status.IsError()) 129 if (status.IsError())
130 return false; 130 return false;
131 return ValidateDeserializedKey(*key, algorithm, type); 131 return ValidateDeserializedKey(*key, algorithm, type);
132 } 132 }
133 133
134 } // namespace webcrypto 134 } // namespace webcrypto
135 135
136 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/structured_clone.h ('k') | content/child/webcrypto/test/aes_cbc_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698