| Index: content/renderer/webcrypto_impl.cc
|
| diff --git a/content/renderer/webcrypto_impl.cc b/content/renderer/webcrypto_impl.cc
|
| index 80c551240eeb141a4c5b305f9485e5df2c241b6e..8cefd104e89fed018fd10fab9805966c7fb61369 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. Issue 267888.
|
| +#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. Issue 267888.
|
| +#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
|
|
|