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

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

Issue 200763005: Support for the new WebCrypto digest by chunks API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid of C++11 function call Created 6 years, 8 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/shared_crypto.h" 5 #include "content/child/webcrypto/shared_crypto.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/child/webcrypto/crypto_data.h" 8 #include "content/child/webcrypto/crypto_data.h"
9 #include "content/child/webcrypto/jwk.h" 9 #include "content/child/webcrypto/jwk.h"
10 #include "content/child/webcrypto/platform_crypto.h" 10 #include "content/child/webcrypto/platform_crypto.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 case blink::WebCryptoAlgorithmIdSha1: 528 case blink::WebCryptoAlgorithmIdSha1:
529 case blink::WebCryptoAlgorithmIdSha256: 529 case blink::WebCryptoAlgorithmIdSha256:
530 case blink::WebCryptoAlgorithmIdSha384: 530 case blink::WebCryptoAlgorithmIdSha384:
531 case blink::WebCryptoAlgorithmIdSha512: 531 case blink::WebCryptoAlgorithmIdSha512:
532 return platform::DigestSha(algorithm.id(), data, buffer); 532 return platform::DigestSha(algorithm.id(), data, buffer);
533 default: 533 default:
534 return Status::ErrorUnsupported(); 534 return Status::ErrorUnsupported();
535 } 535 }
536 } 536 }
537 537
538 scoped_ptr<blink::WebCryptoDigestor> CreateDigestor(
539 blink::WebCryptoAlgorithmId algorithm) {
540 return platform::CreateDigestor(algorithm);
541 }
542
538 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, 543 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
539 bool extractable, 544 bool extractable,
540 blink::WebCryptoKeyUsageMask usage_mask, 545 blink::WebCryptoKeyUsageMask usage_mask,
541 blink::WebCryptoKey* key) { 546 blink::WebCryptoKey* key) {
542 unsigned int keylen_bytes = 0; 547 unsigned int keylen_bytes = 0;
543 548
544 // Get the secret key length in bytes from generation parameters. 549 // Get the secret key length in bytes from generation parameters.
545 // This resolves any defaults. 550 // This resolves any defaults.
546 switch (algorithm.id()) { 551 switch (algorithm.id()) {
547 case blink::WebCryptoAlgorithmIdAesCbc: 552 case blink::WebCryptoAlgorithmIdAesCbc:
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 key); 828 key);
824 if (status.IsError()) 829 if (status.IsError())
825 return status; 830 return status;
826 831
827 return ValidateDeserializedKey(*key, algorithm, type); 832 return ValidateDeserializedKey(*key, algorithm, type);
828 } 833 }
829 834
830 } // namespace webcrypto 835 } // namespace webcrypto
831 836
832 } // namespace content 837 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/shared_crypto.h ('k') | content/child/webcrypto/shared_crypto_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698