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

Unified Diff: content/renderer/webcrypto_sha_digest.h

Issue 19757011: WebCrypto: Implement digest() using NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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_sha_digest.h
diff --git a/content/renderer/webcrypto_sha_digest.h b/content/renderer/webcrypto_sha_digest.h
new file mode 100644
index 0000000000000000000000000000000000000000..78d74c8b5c56e8cd34ca770e4ad4cfcacdaec4f5
--- /dev/null
+++ b/content/renderer/webcrypto_sha_digest.h
@@ -0,0 +1,44 @@
+// 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_SHA_DIGEST_H_
+#define CONTENT_RENDERER_WEBCRYPTO_SHA_DIGEST_H_
+
+#include "base/compiler_specific.h"
+
+#if defined(USE_NSS)
+#include <pk11pub.h>
+#endif
Ryan Sleevi 2013/07/31 18:19:19 nit: Put this header *below* the other headers Se
Bryan Eyler 2013/08/02 00:49:05 Changed to forward declaration. It's not a very p
+
+#include "third_party/WebKit/public/platform/WebCrypto.h"
+#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
+
+namespace content {
+
+class WebCryptoSHADigest : public WebKit::WebCryptoOperation {
+ public:
+ explicit WebCryptoSHADigest(const WebKit::WebCryptoAlgorithmId algorithm_id,
+ WebKit::WebCryptoOperationResult& result);
+ virtual ~WebCryptoSHADigest();
+
+ bool Initialize();
+
+ virtual void process(const unsigned char* bytes, size_t size) OVERRIDE;
+ virtual void abort() OVERRIDE;
+ virtual void finish() OVERRIDE;
+
+ private:
+ WebKit::WebCryptoOperationResult& result_;
eroman 2013/07/31 02:23:50 This needs to be a copy, otherwise it can end up b
Bryan Eyler 2013/08/02 00:49:05 Done.
+
+#if defined(USE_NSS)
+ PK11Context* context_;
+ SECOidTag hash_algorithm_;
+#endif
+
+ unsigned int hash_result_length_;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_WEBCRYPTO_SHA_DIGEST_H_

Powered by Google App Engine
This is Rietveld 408576698