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 <vector> | 5 #include <vector> |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 buffer); | 61 buffer); |
62 } | 62 } |
63 | 63 |
64 class AesKwImplementation : public AesAlgorithm { | 64 class AesKwImplementation : public AesAlgorithm { |
65 public: | 65 public: |
66 AesKwImplementation() | 66 AesKwImplementation() |
67 : AesAlgorithm( | 67 : AesAlgorithm( |
68 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey, | 68 blink::WebCryptoKeyUsageWrapKey | blink::WebCryptoKeyUsageUnwrapKey, |
69 "KW") {} | 69 "KW") {} |
70 | 70 |
71 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, | 71 Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, |
72 const blink::WebCryptoKey& key, | 72 const blink::WebCryptoKey& key, |
73 const CryptoData& data, | 73 const CryptoData& data, |
74 std::vector<uint8_t>* buffer) const override { | 74 std::vector<uint8_t>* buffer) const override { |
75 return AesKwEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer); | 75 return AesKwEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer); |
76 } | 76 } |
77 | 77 |
78 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, | 78 Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, |
79 const blink::WebCryptoKey& key, | 79 const blink::WebCryptoKey& key, |
80 const CryptoData& data, | 80 const CryptoData& data, |
81 std::vector<uint8_t>* buffer) const override { | 81 std::vector<uint8_t>* buffer) const override { |
82 return AesKwEncryptDecrypt(DECRYPT, algorithm, key, data, buffer); | 82 return AesKwEncryptDecrypt(DECRYPT, algorithm, key, data, buffer); |
83 } | 83 } |
84 }; | 84 }; |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 AlgorithmImplementation* CreatePlatformAesKwImplementation() { | 88 AlgorithmImplementation* CreatePlatformAesKwImplementation() { |
89 return new AesKwImplementation; | 89 return new AesKwImplementation; |
90 } | 90 } |
91 | 91 |
92 } // namespace webcrypto | 92 } // namespace webcrypto |
93 | 93 |
94 } // namespace content | 94 } // namespace content |
OLD | NEW |