Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: content/child/webcrypto/nss/aes_cbc_nss.cc

Issue 404733005: Replace uses of uint8 with uint8_t. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <cryptohi.h> 5 #include <cryptohi.h>
6 6
7 #include "content/child/webcrypto/crypto_data.h" 7 #include "content/child/webcrypto/crypto_data.h"
8 #include "content/child/webcrypto/nss/aes_key_nss.h" 8 #include "content/child/webcrypto/nss/aes_key_nss.h"
9 #include "content/child/webcrypto/nss/key_nss.h" 9 #include "content/child/webcrypto/nss/key_nss.h"
10 #include "content/child/webcrypto/nss/util_nss.h" 10 #include "content/child/webcrypto/nss/util_nss.h"
11 #include "content/child/webcrypto/status.h" 11 #include "content/child/webcrypto/status.h"
12 #include "content/child/webcrypto/webcrypto_util.h" 12 #include "content/child/webcrypto/webcrypto_util.h"
13 #include "crypto/scoped_nss_types.h" 13 #include "crypto/scoped_nss_types.h"
14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 namespace webcrypto { 18 namespace webcrypto {
19 19
20 namespace { 20 namespace {
21 21
22 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode, 22 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode,
23 const blink::WebCryptoAlgorithm& algorithm, 23 const blink::WebCryptoAlgorithm& algorithm,
24 const blink::WebCryptoKey& key, 24 const blink::WebCryptoKey& key,
25 const CryptoData& data, 25 const CryptoData& data,
26 std::vector<uint8>* buffer) { 26 std::vector<uint8_t>* buffer) {
27 const blink::WebCryptoAesCbcParams* params = algorithm.aesCbcParams(); 27 const blink::WebCryptoAesCbcParams* params = algorithm.aesCbcParams();
28 if (!params) 28 if (!params)
29 return Status::ErrorUnexpected(); 29 return Status::ErrorUnexpected();
30 30
31 CryptoData iv(params->iv().data(), params->iv().size()); 31 CryptoData iv(params->iv().data(), params->iv().size());
32 if (iv.byte_length() != 16) 32 if (iv.byte_length() != 16)
33 return Status::ErrorIncorrectSizeAesCbcIv(); 33 return Status::ErrorIncorrectSizeAesCbcIv();
34 34
35 PK11SymKey* sym_key = SymKeyNss::Cast(key)->key(); 35 PK11SymKey* sym_key = SymKeyNss::Cast(key)->key();
36 36
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return Status::Success(); 96 return Status::Success();
97 } 97 }
98 98
99 class AesCbcImplementation : public AesAlgorithm { 99 class AesCbcImplementation : public AesAlgorithm {
100 public: 100 public:
101 AesCbcImplementation() : AesAlgorithm(CKM_AES_CBC, "CBC") {} 101 AesCbcImplementation() : AesAlgorithm(CKM_AES_CBC, "CBC") {}
102 102
103 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, 103 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm,
104 const blink::WebCryptoKey& key, 104 const blink::WebCryptoKey& key,
105 const CryptoData& data, 105 const CryptoData& data,
106 std::vector<uint8>* buffer) const OVERRIDE { 106 std::vector<uint8_t>* buffer) const OVERRIDE {
107 return AesCbcEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer); 107 return AesCbcEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer);
108 } 108 }
109 109
110 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, 110 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm,
111 const blink::WebCryptoKey& key, 111 const blink::WebCryptoKey& key,
112 const CryptoData& data, 112 const CryptoData& data,
113 std::vector<uint8>* buffer) const OVERRIDE { 113 std::vector<uint8_t>* buffer) const OVERRIDE {
114 return AesCbcEncryptDecrypt(DECRYPT, algorithm, key, data, buffer); 114 return AesCbcEncryptDecrypt(DECRYPT, algorithm, key, data, buffer);
115 } 115 }
116 }; 116 };
117 117
118 } // namespace 118 } // namespace
119 119
120 AlgorithmImplementation* CreatePlatformAesCbcImplementation() { 120 AlgorithmImplementation* CreatePlatformAesCbcImplementation() {
121 return new AesCbcImplementation; 121 return new AesCbcImplementation;
122 } 122 }
123 123
124 } // namespace webcrypto 124 } // namespace webcrypto
125 125
126 } // namespace content 126 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698