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

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

Issue 630743005: Replace OVERRIDE and FINAL with override and final in content/child/[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « content/child/webcrypto/nss/rsa_key_nss.h ('k') | content/child/webcrypto/nss/rsa_ssa_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <keyhi.h> 6 #include <keyhi.h>
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 #include <secerr.h> 8 #include <secerr.h>
9 #include <sechash.h> 9 #include <sechash.h>
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 RsaOaepImplementation() 164 RsaOaepImplementation()
165 : RsaHashedAlgorithm( 165 : RsaHashedAlgorithm(
166 CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP, 166 CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP,
167 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageWrapKey, 167 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageWrapKey,
168 blink::WebCryptoKeyUsageDecrypt | 168 blink::WebCryptoKeyUsageDecrypt |
169 blink::WebCryptoKeyUsageUnwrapKey) {} 169 blink::WebCryptoKeyUsageUnwrapKey) {}
170 170
171 virtual Status VerifyKeyUsagesBeforeGenerateKeyPair( 171 virtual Status VerifyKeyUsagesBeforeGenerateKeyPair(
172 blink::WebCryptoKeyUsageMask combined_usage_mask, 172 blink::WebCryptoKeyUsageMask combined_usage_mask,
173 blink::WebCryptoKeyUsageMask* public_usage_mask, 173 blink::WebCryptoKeyUsageMask* public_usage_mask,
174 blink::WebCryptoKeyUsageMask* private_usage_mask) const OVERRIDE { 174 blink::WebCryptoKeyUsageMask* private_usage_mask) const override {
175 Status status = NssSupportsRsaOaep(); 175 Status status = NssSupportsRsaOaep();
176 if (status.IsError()) 176 if (status.IsError())
177 return status; 177 return status;
178 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair( 178 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair(
179 combined_usage_mask, public_usage_mask, private_usage_mask); 179 combined_usage_mask, public_usage_mask, private_usage_mask);
180 } 180 }
181 181
182 virtual Status VerifyKeyUsagesBeforeImportKey( 182 virtual Status VerifyKeyUsagesBeforeImportKey(
183 blink::WebCryptoKeyFormat format, 183 blink::WebCryptoKeyFormat format,
184 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE { 184 blink::WebCryptoKeyUsageMask usage_mask) const override {
185 Status status = NssSupportsRsaOaep(); 185 Status status = NssSupportsRsaOaep();
186 if (status.IsError()) 186 if (status.IsError())
187 return status; 187 return status;
188 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format, 188 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format,
189 usage_mask); 189 usage_mask);
190 } 190 }
191 191
192 virtual const char* GetJwkAlgorithm( 192 virtual const char* GetJwkAlgorithm(
193 const blink::WebCryptoAlgorithmId hash) const OVERRIDE { 193 const blink::WebCryptoAlgorithmId hash) const override {
194 switch (hash) { 194 switch (hash) {
195 case blink::WebCryptoAlgorithmIdSha1: 195 case blink::WebCryptoAlgorithmIdSha1:
196 return "RSA-OAEP"; 196 return "RSA-OAEP";
197 case blink::WebCryptoAlgorithmIdSha256: 197 case blink::WebCryptoAlgorithmIdSha256:
198 return "RSA-OAEP-256"; 198 return "RSA-OAEP-256";
199 case blink::WebCryptoAlgorithmIdSha384: 199 case blink::WebCryptoAlgorithmIdSha384:
200 return "RSA-OAEP-384"; 200 return "RSA-OAEP-384";
201 case blink::WebCryptoAlgorithmIdSha512: 201 case blink::WebCryptoAlgorithmIdSha512:
202 return "RSA-OAEP-512"; 202 return "RSA-OAEP-512";
203 default: 203 default:
204 return NULL; 204 return NULL;
205 } 205 }
206 } 206 }
207 207
208 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, 208 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm,
209 const blink::WebCryptoKey& key, 209 const blink::WebCryptoKey& key,
210 const CryptoData& data, 210 const CryptoData& data,
211 std::vector<uint8_t>* buffer) const OVERRIDE { 211 std::vector<uint8_t>* buffer) const override {
212 if (key.type() != blink::WebCryptoKeyTypePublic) 212 if (key.type() != blink::WebCryptoKeyTypePublic)
213 return Status::ErrorUnexpectedKeyType(); 213 return Status::ErrorUnexpectedKeyType();
214 214
215 return EncryptRsaOaep( 215 return EncryptRsaOaep(
216 PublicKeyNss::Cast(key)->key(), 216 PublicKeyNss::Cast(key)->key(),
217 key.algorithm().rsaHashedParams()->hash(), 217 key.algorithm().rsaHashedParams()->hash(),
218 CryptoData(algorithm.rsaOaepParams()->optionalLabel()), 218 CryptoData(algorithm.rsaOaepParams()->optionalLabel()),
219 data, 219 data,
220 buffer); 220 buffer);
221 } 221 }
222 222
223 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, 223 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm,
224 const blink::WebCryptoKey& key, 224 const blink::WebCryptoKey& key,
225 const CryptoData& data, 225 const CryptoData& data,
226 std::vector<uint8_t>* buffer) const OVERRIDE { 226 std::vector<uint8_t>* buffer) const override {
227 if (key.type() != blink::WebCryptoKeyTypePrivate) 227 if (key.type() != blink::WebCryptoKeyTypePrivate)
228 return Status::ErrorUnexpectedKeyType(); 228 return Status::ErrorUnexpectedKeyType();
229 229
230 return DecryptRsaOaep( 230 return DecryptRsaOaep(
231 PrivateKeyNss::Cast(key)->key(), 231 PrivateKeyNss::Cast(key)->key(),
232 key.algorithm().rsaHashedParams()->hash(), 232 key.algorithm().rsaHashedParams()->hash(),
233 CryptoData(algorithm.rsaOaepParams()->optionalLabel()), 233 CryptoData(algorithm.rsaOaepParams()->optionalLabel()),
234 data, 234 data,
235 buffer); 235 buffer);
236 } 236 }
237 }; 237 };
238 238
239 } // namespace 239 } // namespace
240 240
241 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() { 241 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() {
242 return new RsaOaepImplementation; 242 return new RsaOaepImplementation;
243 } 243 }
244 244
245 } // namespace webcrypto 245 } // namespace webcrypto
246 246
247 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/nss/rsa_key_nss.h ('k') | content/child/webcrypto/nss/rsa_ssa_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698