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

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: Updated return param of FinishWithWebArrayAndStatus 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/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/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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 case blink::WebCryptoAlgorithmIdSha1: 512 case blink::WebCryptoAlgorithmIdSha1:
513 case blink::WebCryptoAlgorithmIdSha256: 513 case blink::WebCryptoAlgorithmIdSha256:
514 case blink::WebCryptoAlgorithmIdSha384: 514 case blink::WebCryptoAlgorithmIdSha384:
515 case blink::WebCryptoAlgorithmIdSha512: 515 case blink::WebCryptoAlgorithmIdSha512:
516 return platform::DigestSha(algorithm.id(), data, buffer); 516 return platform::DigestSha(algorithm.id(), data, buffer);
517 default: 517 default:
518 return Status::ErrorUnsupported(); 518 return Status::ErrorUnsupported();
519 } 519 }
520 } 520 }
521 521
522 scoped_ptr<blink::WebCryptoDigestor> CreateDigestor(
523 blink::WebCryptoAlgorithmId algorithm) {
524 return platform::CreateDigestor(algorithm);
525 }
526
522 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, 527 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
523 bool extractable, 528 bool extractable,
524 blink::WebCryptoKeyUsageMask usage_mask, 529 blink::WebCryptoKeyUsageMask usage_mask,
525 blink::WebCryptoKey* key) { 530 blink::WebCryptoKey* key) {
526 unsigned int keylen_bytes = 0; 531 unsigned int keylen_bytes = 0;
527 532
528 // Get the secret key length in bytes from generation parameters. 533 // Get the secret key length in bytes from generation parameters.
529 // This resolves any defaults. 534 // This resolves any defaults.
530 switch (algorithm.id()) { 535 switch (algorithm.id()) {
531 case blink::WebCryptoAlgorithmIdAesCbc: 536 case blink::WebCryptoAlgorithmIdAesCbc:
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 key); 812 key);
808 if (status.IsError()) 813 if (status.IsError())
809 return status; 814 return status;
810 815
811 return ValidateDeserializedKey(*key, algorithm, type); 816 return ValidateDeserializedKey(*key, algorithm, type);
812 } 817 }
813 818
814 } // namespace webcrypto 819 } // namespace webcrypto
815 820
816 } // namespace content 821 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698