Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1672)

Unified Diff: content/renderer/webcrypto_impl.cc

Issue 19757011: WebCrypto: Implement digest() using NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split out crypto functionality from abstract result class from Blink. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/webcrypto_impl.h ('k') | content/renderer/webcrypto_impl_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webcrypto_impl.cc
diff --git a/content/renderer/webcrypto_impl.cc b/content/renderer/webcrypto_impl.cc
index 80c551240eeb141a4c5b305f9485e5df2c241b6e..ad37457ece6a474927f71c578d8daa5c864a89d5 100644
--- a/content/renderer/webcrypto_impl.cc
+++ b/content/renderer/webcrypto_impl.cc
@@ -4,23 +4,20 @@
#include "content/renderer/webcrypto_impl.h"
-#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
+#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
namespace content {
-WebKit::WebCryptoOperation* WebCryptoImpl::digest(
- const WebKit::WebCryptoAlgorithm& algorithm) {
- switch (algorithm.id()) {
- case WebKit::WebCryptoAlgorithmIdSha1:
- case WebKit::WebCryptoAlgorithmIdSha224:
- case WebKit::WebCryptoAlgorithmIdSha256:
- case WebKit::WebCryptoAlgorithmIdSha384:
- case WebKit::WebCryptoAlgorithmIdSha512:
- // TODO(eroman): Implement.
- return NULL;
- default:
- // Not a digest algorithm.
- return NULL;
+void WebCryptoImpl::digest(
+ const WebKit::WebCryptoAlgorithm& algorithm,
+ const unsigned char* data,
+ size_t data_size,
+ WebKit::WebCryptoResult result) {
+ WebKit::WebArrayBuffer buffer;
+ if (!digestInternal(algorithm, data, data_size, &buffer)) {
+ result.completeWithError();
+ } else {
+ result.completeWithBuffer(buffer);
}
}
« no previous file with comments | « content/renderer/webcrypto_impl.h ('k') | content/renderer/webcrypto_impl_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698