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/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 Loading... | |
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 blink::WebCryptoDigestor* CreateDigestor(blink::WebCryptoAlgorithm algorithm) { | |
523 switch (algorithm.id()) { | |
524 case blink::WebCryptoAlgorithmIdSha1: | |
525 case blink::WebCryptoAlgorithmIdSha256: | |
526 case blink::WebCryptoAlgorithmIdSha384: | |
527 case blink::WebCryptoAlgorithmIdSha512: | |
528 return platform::CreateDigestor(algorithm.id()); | |
529 default: | |
530 return 0; | |
eroman
2014/03/25 23:26:23
return NULL in chromium land
jww
2014/03/26 00:42:31
Done.
| |
531 } | |
532 } | |
533 | |
522 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, | 534 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, |
523 bool extractable, | 535 bool extractable, |
524 blink::WebCryptoKeyUsageMask usage_mask, | 536 blink::WebCryptoKeyUsageMask usage_mask, |
525 blink::WebCryptoKey* key) { | 537 blink::WebCryptoKey* key) { |
526 unsigned int keylen_bytes = 0; | 538 unsigned int keylen_bytes = 0; |
527 | 539 |
528 // Get the secret key length in bytes from generation parameters. | 540 // Get the secret key length in bytes from generation parameters. |
529 // This resolves any defaults. | 541 // This resolves any defaults. |
530 switch (algorithm.id()) { | 542 switch (algorithm.id()) { |
531 case blink::WebCryptoAlgorithmIdAesCbc: | 543 case blink::WebCryptoAlgorithmIdAesCbc: |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 key); | 819 key); |
808 if (status.IsError()) | 820 if (status.IsError()) |
809 return status; | 821 return status; |
810 | 822 |
811 return ValidateDeserializedKey(*key, algorithm, type); | 823 return ValidateDeserializedKey(*key, algorithm, type); |
812 } | 824 } |
813 | 825 |
814 } // namespace webcrypto | 826 } // namespace webcrypto |
815 | 827 |
816 } // namespace content | 828 } // namespace content |
OLD | NEW |