| 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 "components/webcrypto/algorithms/test_helpers.h" | 5 #include "components/webcrypto/algorithms/test_helpers.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 blink::WebCryptoAlgorithm CreateRsaHashedKeyGenAlgorithm( | 108 blink::WebCryptoAlgorithm CreateRsaHashedKeyGenAlgorithm( |
| 109 blink::WebCryptoAlgorithmId algorithm_id, | 109 blink::WebCryptoAlgorithmId algorithm_id, |
| 110 const blink::WebCryptoAlgorithmId hash_id, | 110 const blink::WebCryptoAlgorithmId hash_id, |
| 111 unsigned int modulus_length, | 111 unsigned int modulus_length, |
| 112 const std::vector<uint8_t>& public_exponent) { | 112 const std::vector<uint8_t>& public_exponent) { |
| 113 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id)); | 113 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id)); |
| 114 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( | 114 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
| 115 algorithm_id, | 115 algorithm_id, |
| 116 new blink::WebCryptoRsaHashedKeyGenParams( | 116 new blink::WebCryptoRsaHashedKeyGenParams( |
| 117 CreateAlgorithm(hash_id), modulus_length, public_exponent.data(), | 117 CreateAlgorithm(hash_id), modulus_length, public_exponent)); |
| 118 static_cast<unsigned int>(public_exponent.size()))); | |
| 119 } | 118 } |
| 120 | 119 |
| 121 std::vector<uint8_t> Corrupted(const std::vector<uint8_t>& input) { | 120 std::vector<uint8_t> Corrupted(const std::vector<uint8_t>& input) { |
| 122 std::vector<uint8_t> corrupted_data(input); | 121 std::vector<uint8_t> corrupted_data(input); |
| 123 if (corrupted_data.empty()) | 122 if (corrupted_data.empty()) |
| 124 corrupted_data.push_back(0); | 123 corrupted_data.push_back(0); |
| 125 corrupted_data[corrupted_data.size() / 2] ^= 0x01; | 124 corrupted_data[corrupted_data.size() / 2] ^= 0x01; |
| 126 return corrupted_data; | 125 return corrupted_data; |
| 127 } | 126 } |
| 128 | 127 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } | 689 } |
| 691 | 690 |
| 692 blink::WebCryptoAlgorithm CreateEcImportAlgorithm( | 691 blink::WebCryptoAlgorithm CreateEcImportAlgorithm( |
| 693 blink::WebCryptoAlgorithmId id, | 692 blink::WebCryptoAlgorithmId id, |
| 694 blink::WebCryptoNamedCurve named_curve) { | 693 blink::WebCryptoNamedCurve named_curve) { |
| 695 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( | 694 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
| 696 id, new blink::WebCryptoEcKeyImportParams(named_curve)); | 695 id, new blink::WebCryptoEcKeyImportParams(named_curve)); |
| 697 } | 696 } |
| 698 | 697 |
| 699 } // namespace webcrypto | 698 } // namespace webcrypto |
| OLD | NEW |