OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/renderer/webcrypto_impl.h" | 5 #include "content/renderer/webcrypto_impl.h" |
6 | 6 |
7 // TODO(bryaneyler): Also include these in OpenSSL build. | |
8 #if defined(USE_NSS) | |
9 #include "content/renderer/webcrypto_sha_digest.h" | |
10 #endif | |
11 | |
7 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
8 | 13 |
9 namespace content { | 14 namespace content { |
10 | 15 |
11 WebKit::WebCryptoOperation* WebCryptoImpl::digest( | 16 WebKit::WebCryptoOperation* WebCryptoImpl::digest( |
12 const WebKit::WebCryptoAlgorithm& algorithm) { | 17 const WebKit::WebCryptoAlgorithm& algorithm) { |
18 // Deprecated. | |
19 return NULL; | |
20 } | |
21 | |
22 void WebCryptoImpl::digest2( | |
23 const WebKit::WebCryptoAlgorithm& algorithm, | |
24 WebKit::WebCryptoOperationResult* result) { | |
25 // TODO(bryaneyler): Also include these in OpenSSL build. | |
26 #if defined(USE_NSS) | |
13 switch (algorithm.id()) { | 27 switch (algorithm.id()) { |
14 case WebKit::WebCryptoAlgorithmIdSha1: | 28 case WebKit::WebCryptoAlgorithmIdSha1: { |
eroman
2013/07/24 01:33:50
This is a really weird place for an opening bracke
Bryan Eyler
2013/07/31 00:28:44
Thanks; legacy from some testing I was doing to ge
| |
15 case WebKit::WebCryptoAlgorithmIdSha224: | 29 case WebKit::WebCryptoAlgorithmIdSha224: |
16 case WebKit::WebCryptoAlgorithmIdSha256: | 30 case WebKit::WebCryptoAlgorithmIdSha256: |
17 case WebKit::WebCryptoAlgorithmIdSha384: | 31 case WebKit::WebCryptoAlgorithmIdSha384: |
18 case WebKit::WebCryptoAlgorithmIdSha512: | 32 case WebKit::WebCryptoAlgorithmIdSha512: |
19 // TODO(eroman): Implement. | 33 WebCryptoSHADigest* operation = |
20 return NULL; | 34 new WebCryptoSHADigest(algorithm.id(), result); |
35 | |
36 if(!operation->Initialize()) { | |
37 result->initializationFailed(); | |
eroman
2013/07/24 01:33:50
This is a leak of |operation|.
A few alternatives
Bryan Eyler
2013/07/31 00:28:44
Done.
| |
38 } else { | |
39 result->initializationSucceeded(operation); | |
40 } | |
41 return; | |
42 } | |
21 default: | 43 default: |
22 // Not a digest algorithm. | 44 // Not a digest algorithm. |
23 return NULL; | 45 //result->initializationSucceeded(new DummyOperation(result)); |
eroman
2013/07/24 01:33:50
Delete this commented-out code
Bryan Eyler
2013/07/31 00:28:44
Done.
| |
46 result->initializationFailed(); | |
47 return; | |
24 } | 48 } |
49 #else | |
50 // No way to process. | |
51 //result->initializationSucceeded(new DummyOperation(result)); | |
eroman
2013/07/24 01:33:50
Delete this commented out code
Bryan Eyler
2013/07/31 00:28:44
Done.
| |
52 result->initializationFailed(); | |
53 #endif | |
25 } | 54 } |
26 | 55 |
27 } // namespace content | 56 } // namespace content |
OLD | NEW |