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 <openssl/aes.h> | 5 #include <openssl/aes.h> |
6 #include <openssl/evp.h> | 6 #include <openssl/evp.h> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 vector_as_array(buffer) + input_size_part1); | 258 vector_as_array(buffer) + input_size_part1); |
259 } | 259 } |
260 | 260 |
261 class AesCtrImplementation : public AesAlgorithm { | 261 class AesCtrImplementation : public AesAlgorithm { |
262 public: | 262 public: |
263 AesCtrImplementation() : AesAlgorithm("CTR") {} | 263 AesCtrImplementation() : AesAlgorithm("CTR") {} |
264 | 264 |
265 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, | 265 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, |
266 const blink::WebCryptoKey& key, | 266 const blink::WebCryptoKey& key, |
267 const CryptoData& data, | 267 const CryptoData& data, |
268 std::vector<uint8_t>* buffer) const OVERRIDE { | 268 std::vector<uint8_t>* buffer) const override { |
269 return AesCtrEncryptDecrypt(algorithm, key, data, buffer); | 269 return AesCtrEncryptDecrypt(algorithm, key, data, buffer); |
270 } | 270 } |
271 | 271 |
272 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, | 272 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, |
273 const blink::WebCryptoKey& key, | 273 const blink::WebCryptoKey& key, |
274 const CryptoData& data, | 274 const CryptoData& data, |
275 std::vector<uint8_t>* buffer) const OVERRIDE { | 275 std::vector<uint8_t>* buffer) const override { |
276 return AesCtrEncryptDecrypt(algorithm, key, data, buffer); | 276 return AesCtrEncryptDecrypt(algorithm, key, data, buffer); |
277 } | 277 } |
278 }; | 278 }; |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 | 281 |
282 AlgorithmImplementation* CreatePlatformAesCtrImplementation() { | 282 AlgorithmImplementation* CreatePlatformAesCtrImplementation() { |
283 return new AesCtrImplementation; | 283 return new AesCtrImplementation; |
284 } | 284 } |
285 | 285 |
286 } // namespace webcrypto | 286 } // namespace webcrypto |
287 | 287 |
288 } // namespace content | 288 } // namespace content |
OLD | NEW |