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..fdc7d6b66dd6097eb854274ea9120dddc72a0fa1 100644 |
| --- a/content/renderer/webcrypto_impl.cc |
| +++ b/content/renderer/webcrypto_impl.cc |
| @@ -4,24 +4,46 @@ |
| #include "content/renderer/webcrypto_impl.h" |
| +// TODO(bryaneyler): Also include these in OpenSSL build. |
|
Ryan Sleevi
2013/08/02 23:29:27
nit: Add a BUG # for each TODO - could just be a m
Bryan Eyler
2013/08/03 00:16:45
Done.
|
| +#if defined(USE_NSS) |
| +#include "content/renderer/webcrypto_digest.h" |
| +#endif |
| + |
| +#include "base/memory/scoped_ptr.h" |
| #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
| namespace content { |
| -WebKit::WebCryptoOperation* WebCryptoImpl::digest( |
| - const WebKit::WebCryptoAlgorithm& algorithm) { |
| +void WebCryptoImpl::digest( |
| + const WebKit::WebCryptoAlgorithm& algorithm, |
| + WebKit::WebCryptoOperationResult& result) { |
| +// TODO(bryaneyler): Also include these in OpenSSL build. |
|
Ryan Sleevi
2013/08/02 23:29:27
same
Bryan Eyler
2013/08/03 00:16:45
Done.
|
| +#if defined(USE_NSS) |
| switch (algorithm.id()) { |
| case WebKit::WebCryptoAlgorithmIdSha1: |
| case WebKit::WebCryptoAlgorithmIdSha224: |
| case WebKit::WebCryptoAlgorithmIdSha256: |
| case WebKit::WebCryptoAlgorithmIdSha384: |
| - case WebKit::WebCryptoAlgorithmIdSha512: |
| - // TODO(eroman): Implement. |
| - return NULL; |
| + case WebKit::WebCryptoAlgorithmIdSha512: { |
| + scoped_ptr<WebCryptoDigest> operation( |
| + new WebCryptoDigest(result)); |
| + |
| + if (!operation->Initialize(algorithm)) { |
| + result.initializationFailed(); |
| + } else { |
| + result.initializationSucceeded(operation.release()); |
| + } |
| + return; |
| + } |
| default: |
| // Not a digest algorithm. |
| - return NULL; |
| + result.initializationFailed(); |
| + return; |
| } |
| +#else |
| + // No way to process. |
| + result.initializationFailed(); |
| +#endif |
| } |
| } // namespace content |