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

Side by Side Diff: content/child/webcrypto/openssl/rsa_pss_openssl.cc

Issue 671663002: Standardize usage of virtual/override/final in content/ (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
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 "content/child/webcrypto/openssl/rsa_key_openssl.h" 5 #include "content/child/webcrypto/openssl/rsa_key_openssl.h"
6 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h" 6 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h"
7 #include "content/child/webcrypto/status.h" 7 #include "content/child/webcrypto/status.h"
8 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 8 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 namespace webcrypto { 12 namespace webcrypto {
13 13
14 namespace { 14 namespace {
15 15
16 class RsaPssImplementation : public RsaHashedAlgorithm { 16 class RsaPssImplementation : public RsaHashedAlgorithm {
17 public: 17 public:
18 RsaPssImplementation() 18 RsaPssImplementation()
19 : RsaHashedAlgorithm(blink::WebCryptoKeyUsageVerify, 19 : RsaHashedAlgorithm(blink::WebCryptoKeyUsageVerify,
20 blink::WebCryptoKeyUsageSign) {} 20 blink::WebCryptoKeyUsageSign) {}
21 21
22 virtual const char* GetJwkAlgorithm( 22 const char* GetJwkAlgorithm(
23 const blink::WebCryptoAlgorithmId hash) const override { 23 const blink::WebCryptoAlgorithmId hash) const override {
24 switch (hash) { 24 switch (hash) {
25 case blink::WebCryptoAlgorithmIdSha1: 25 case blink::WebCryptoAlgorithmIdSha1:
26 return "PS1"; 26 return "PS1";
27 case blink::WebCryptoAlgorithmIdSha256: 27 case blink::WebCryptoAlgorithmIdSha256:
28 return "PS256"; 28 return "PS256";
29 case blink::WebCryptoAlgorithmIdSha384: 29 case blink::WebCryptoAlgorithmIdSha384:
30 return "PS384"; 30 return "PS384";
31 case blink::WebCryptoAlgorithmIdSha512: 31 case blink::WebCryptoAlgorithmIdSha512:
32 return "PS512"; 32 return "PS512";
33 default: 33 default:
34 return NULL; 34 return NULL;
35 } 35 }
36 } 36 }
37 37
38 virtual Status Sign(const blink::WebCryptoAlgorithm& algorithm, 38 Status Sign(const blink::WebCryptoAlgorithm& algorithm,
39 const blink::WebCryptoKey& key, 39 const blink::WebCryptoKey& key,
40 const CryptoData& data, 40 const CryptoData& data,
41 std::vector<uint8_t>* buffer) const override { 41 std::vector<uint8_t>* buffer) const override {
42 return RsaSign( 42 return RsaSign(
43 key, algorithm.rsaPssParams()->saltLengthBytes(), data, buffer); 43 key, algorithm.rsaPssParams()->saltLengthBytes(), data, buffer);
44 } 44 }
45 45
46 virtual Status Verify(const blink::WebCryptoAlgorithm& algorithm, 46 Status Verify(const blink::WebCryptoAlgorithm& algorithm,
47 const blink::WebCryptoKey& key, 47 const blink::WebCryptoKey& key,
48 const CryptoData& signature, 48 const CryptoData& signature,
49 const CryptoData& data, 49 const CryptoData& data,
50 bool* signature_match) const override { 50 bool* signature_match) const override {
51 return RsaVerify(key, 51 return RsaVerify(key,
52 algorithm.rsaPssParams()->saltLengthBytes(), 52 algorithm.rsaPssParams()->saltLengthBytes(),
53 signature, 53 signature,
54 data, 54 data,
55 signature_match); 55 signature_match);
56 } 56 }
57 }; 57 };
58 58
59 } // namespace 59 } // namespace
60 60
61 AlgorithmImplementation* CreatePlatformRsaPssImplementation() { 61 AlgorithmImplementation* CreatePlatformRsaPssImplementation() {
62 return new RsaPssImplementation; 62 return new RsaPssImplementation;
63 } 63 }
64 64
65 } // namespace webcrypto 65 } // namespace webcrypto
66 66
67 } // namespace content 67 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/openssl/rsa_oaep_openssl.cc ('k') | content/child/webcrypto/openssl/rsa_ssa_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698