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

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

Issue 200763005: Support for the new WebCrypto digest by chunks API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated to latest WebCrypto API changes Created 6 years, 9 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 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/webcrypto_impl.h" 5 #include "content/child/webcrypto/webcrypto_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
8 #include "content/child/webcrypto/crypto_data.h" 9 #include "content/child/webcrypto/crypto_data.h"
9 #include "content/child/webcrypto/shared_crypto.h" 10 #include "content/child/webcrypto/shared_crypto.h"
10 #include "content/child/webcrypto/status.h" 11 #include "content/child/webcrypto/status.h"
11 #include "content/child/webcrypto/webcrypto_util.h" 12 #include "content/child/webcrypto/webcrypto_util.h"
12 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" 13 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h"
13 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 using webcrypto::Status; 18 using webcrypto::Status;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const unsigned char* data, 242 const unsigned char* data,
242 unsigned int data_size, 243 unsigned int data_size,
243 blink::WebArrayBuffer& result) { 244 blink::WebArrayBuffer& result) {
244 blink::WebCryptoAlgorithm algorithm = 245 blink::WebCryptoAlgorithm algorithm =
245 blink::WebCryptoAlgorithm::adoptParamsAndCreate(algorithm_id, NULL); 246 blink::WebCryptoAlgorithm::adoptParamsAndCreate(algorithm_id, NULL);
246 return (webcrypto::Digest( 247 return (webcrypto::Digest(
247 algorithm, webcrypto::CryptoData(data, data_size), &result)) 248 algorithm, webcrypto::CryptoData(data, data_size), &result))
248 .IsSuccess(); 249 .IsSuccess();
249 } 250 }
250 251
252 blink::WebCryptoDigestor* WebCryptoImpl::createDigestor(
253 const blink::WebCryptoAlgorithmId algorithm_id) {
254 blink::WebCryptoAlgorithm algorithm =
255 blink::WebCryptoAlgorithm::adoptParamsAndCreate(algorithm_id, NULL);
eroman 2014/03/25 23:26:23 Let's get rid of this, and have the shared_crypto
jww 2014/03/26 00:42:31 Done.
256 return webcrypto::CreateDigestor(algorithm);
257 }
258
251 bool WebCryptoImpl::deserializeKeyForClone( 259 bool WebCryptoImpl::deserializeKeyForClone(
252 const blink::WebCryptoKeyAlgorithm& algorithm, 260 const blink::WebCryptoKeyAlgorithm& algorithm,
253 blink::WebCryptoKeyType type, 261 blink::WebCryptoKeyType type,
254 bool extractable, 262 bool extractable,
255 blink::WebCryptoKeyUsageMask usages, 263 blink::WebCryptoKeyUsageMask usages,
256 const unsigned char* key_data, 264 const unsigned char* key_data,
257 unsigned key_data_size, 265 unsigned key_data_size,
258 blink::WebCryptoKey& key) { 266 blink::WebCryptoKey& key) {
259 Status status = webcrypto::DeserializeKeyForClone( 267 Status status = webcrypto::DeserializeKeyForClone(
260 algorithm, 268 algorithm,
261 type, 269 type,
262 extractable, 270 extractable,
263 usages, 271 usages,
264 webcrypto::CryptoData(key_data, key_data_size), 272 webcrypto::CryptoData(key_data, key_data_size),
265 &key); 273 &key);
266 return status.IsSuccess(); 274 return status.IsSuccess();
267 } 275 }
268 276
269 bool WebCryptoImpl::serializeKeyForClone( 277 bool WebCryptoImpl::serializeKeyForClone(
270 const blink::WebCryptoKey& key, 278 const blink::WebCryptoKey& key,
271 blink::WebVector<unsigned char>& key_data) { 279 blink::WebVector<unsigned char>& key_data) {
272 Status status = webcrypto::SerializeKeyForClone(key, &key_data); 280 Status status = webcrypto::SerializeKeyForClone(key, &key_data);
273 return status.IsSuccess(); 281 return status.IsSuccess();
274 } 282 }
275 283
276 } // namespace content 284 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698