OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |