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..695dbdd199ffe166501579f8e7b54c30a76853b9 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. |
| +#if defined(USE_NSS) |
| +#include "content/renderer/webcrypto_sha_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. |
| +#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<WebCryptoSHADigest> operation( |
| + new WebCryptoSHADigest(algorithm.id(), result)); |
|
Ryan Sleevi
2013/07/31 18:19:19
If you're using the HASH model from NSS (or the EV
Bryan Eyler
2013/08/02 00:49:05
Should this just be WebCryptoDigest then?
eroman
2013/08/02 01:42:58
Yes please
Bryan Eyler
2013/08/02 21:08:08
Done.
|
| + |
| + if(!operation->Initialize()) { |
|
Ryan Sleevi
2013/07/31 18:19:19
style: if (!operation->Initialize()) {
Bryan Eyler
2013/08/02 00:49:05
Done.
|
| + 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 |