Chromium Code Reviews| Index: content/renderer/webcrypto_impl.cc |
| diff --git a/content/renderer/webcrypto_impl.cc b/content/renderer/webcrypto_impl.cc |
| index 80c551240eeb141a4c5b305f9485e5df2c241b6e..606395b51236396e15a1dae0e0cee085feeea3ba 100644 |
| --- a/content/renderer/webcrypto_impl.cc |
| +++ b/content/renderer/webcrypto_impl.cc |
| @@ -4,24 +4,53 @@ |
| #include "content/renderer/webcrypto_impl.h" |
| +// TODO(bryaneyler): Also include these in OpenSSL build. |
| +#if defined(USE_NSS) |
| +#include "content/renderer/webcrypto_sha_digest.h" |
| +#endif |
| + |
| #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
| namespace content { |
| WebKit::WebCryptoOperation* WebCryptoImpl::digest( |
| const WebKit::WebCryptoAlgorithm& algorithm) { |
| + // Deprecated. |
| + return NULL; |
| +} |
| + |
| +void WebCryptoImpl::digest2( |
| + const WebKit::WebCryptoAlgorithm& algorithm, |
| + WebKit::WebCryptoOperationResult* result) { |
| +// TODO(bryaneyler): Also include these in OpenSSL build. |
| +#if defined(USE_NSS) |
| switch (algorithm.id()) { |
| - case WebKit::WebCryptoAlgorithmIdSha1: |
| + 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
|
| case WebKit::WebCryptoAlgorithmIdSha224: |
| case WebKit::WebCryptoAlgorithmIdSha256: |
| case WebKit::WebCryptoAlgorithmIdSha384: |
| case WebKit::WebCryptoAlgorithmIdSha512: |
| - // TODO(eroman): Implement. |
| - return NULL; |
| + WebCryptoSHADigest* operation = |
| + new WebCryptoSHADigest(algorithm.id(), result); |
| + |
| + if(!operation->Initialize()) { |
| + 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.
|
| + } else { |
| + result->initializationSucceeded(operation); |
| + } |
| + return; |
| + } |
| default: |
| // Not a digest algorithm. |
| - return NULL; |
| + //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.
|
| + result->initializationFailed(); |
| + return; |
| } |
| +#else |
| + // No way to process. |
| + //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.
|
| + result->initializationFailed(); |
| +#endif |
| } |
| } // namespace content |