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/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return Status::Success(); | 109 return Status::Success(); |
110 } | 110 } |
111 | 111 |
112 class AesCbcImplementation : public AesAlgorithm { | 112 class AesCbcImplementation : public AesAlgorithm { |
113 public: | 113 public: |
114 AesCbcImplementation() : AesAlgorithm("CBC") {} | 114 AesCbcImplementation() : AesAlgorithm("CBC") {} |
115 | 115 |
116 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, | 116 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, |
117 const blink::WebCryptoKey& key, | 117 const blink::WebCryptoKey& key, |
118 const CryptoData& data, | 118 const CryptoData& data, |
119 std::vector<uint8_t>* buffer) const OVERRIDE { | 119 std::vector<uint8_t>* buffer) const override { |
120 return AesCbcEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer); | 120 return AesCbcEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer); |
121 } | 121 } |
122 | 122 |
123 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, | 123 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, |
124 const blink::WebCryptoKey& key, | 124 const blink::WebCryptoKey& key, |
125 const CryptoData& data, | 125 const CryptoData& data, |
126 std::vector<uint8_t>* buffer) const OVERRIDE { | 126 std::vector<uint8_t>* buffer) const override { |
127 return AesCbcEncryptDecrypt(DECRYPT, algorithm, key, data, buffer); | 127 return AesCbcEncryptDecrypt(DECRYPT, algorithm, key, data, buffer); |
128 } | 128 } |
129 }; | 129 }; |
130 | 130 |
131 } // namespace | 131 } // namespace |
132 | 132 |
133 AlgorithmImplementation* CreatePlatformAesCbcImplementation() { | 133 AlgorithmImplementation* CreatePlatformAesCbcImplementation() { |
134 return new AesCbcImplementation; | 134 return new AesCbcImplementation; |
135 } | 135 } |
136 | 136 |
137 } // namespace webcrypto | 137 } // namespace webcrypto |
138 | 138 |
139 } // namespace content | 139 } // namespace content |
OLD | NEW |