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

Unified Diff: content/renderer/webcrypto_digest.h

Issue 19757011: WebCrypto: Implement digest() using NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove overrides, add documentation to digest interface, and small fix to hash result length retrieā€¦ 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
Index: content/renderer/webcrypto_digest.h
diff --git a/content/renderer/webcrypto_digest.h b/content/renderer/webcrypto_digest.h
new file mode 100644
index 0000000000000000000000000000000000000000..b0142a5e5fb18abb22636d0037696bbd8b5e06d0
--- /dev/null
+++ b/content/renderer/webcrypto_digest.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_
+#define CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_
+
+#include "base/compiler_specific.h"
+
+#include "third_party/WebKit/public/platform/WebCrypto.h"
+#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
+
+#if defined(USE_NSS)
+typedef struct HASHContextStr HASHContext;
+#endif
+
+namespace content {
+
+class WebCryptoDigest : public WebKit::WebCryptoOperation {
+ public:
+ explicit WebCryptoDigest(const WebKit::WebCryptoOperationResult& result);
+ virtual ~WebCryptoDigest();
+
+ bool Initialize(const WebKit::WebCryptoAlgorithm& algorithm);
+
+ // Feeds data to the digest operation.
+ // - |bytes| may be 0 if |size| is 0
+ // - |bytes| is valid only until process() returns
+ // - process() will not be called after abort() or finish()
+ virtual void process(const unsigned char* bytes, size_t size);
jamesr 2013/08/09 20:04:55 add a documenting what these override. for example
Bryan Eyler 2013/08/13 18:22:21 Done.
+ // Cancels the in-process digest operation.
+ virtual void abort();
+ // Indicates that there is no more data to receive.
+ virtual void finish();
+
+ private:
+ WebKit::WebCryptoOperationResult result_;
+
+#if defined(USE_NSS)
+ HASHContext* context_;
+#endif
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_

Powered by Google App Engine
This is Rietveld 408576698