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

Side by Side Diff: trunk/src/content/child/webcrypto/webcrypto_impl.h

Issue 252213003: Revert 266798 "[webcrypto] Make operations run on a background t..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "third_party/WebKit/public/platform/WebCrypto.h" 10 #include "third_party/WebKit/public/platform/WebCrypto.h"
11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
12 #include "third_party/WebKit/public/platform/WebVector.h" 12 #include "third_party/WebKit/public/platform/WebVector.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // Wrapper around the Blink WebCrypto asynchronous interface, which forwards to 16 // Wrapper around the blink WebCrypto asynchronous interface, which forwards to
17 // the synchronous platfrom (NSS or OpenSSL) implementation. 17 // the synchronous platfrom (NSS or OpenSSL) implementation.
18 // 18 //
19 // TODO(eroman): Post the synchronous work to a background thread. 19 // TODO(eroman): Post the synchronous work to a background thread.
20 class WebCryptoImpl : public blink::WebCrypto { 20 class WebCryptoImpl : public blink::WebCrypto {
21 public: 21 public:
22 WebCryptoImpl(); 22 WebCryptoImpl();
23 virtual ~WebCryptoImpl(); 23 virtual ~WebCryptoImpl();
24 24
25 virtual void encrypt(const blink::WebCryptoAlgorithm& algorithm, 25 virtual void encrypt(const blink::WebCryptoAlgorithm& algorithm,
26 const blink::WebCryptoKey& key, 26 const blink::WebCryptoKey& key,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual void unwrapKey( 70 virtual void unwrapKey(
71 blink::WebCryptoKeyFormat format, 71 blink::WebCryptoKeyFormat format,
72 const unsigned char* wrapped_key, 72 const unsigned char* wrapped_key,
73 unsigned wrapped_key_size, 73 unsigned wrapped_key_size,
74 const blink::WebCryptoKey& wrapping_key, 74 const blink::WebCryptoKey& wrapping_key,
75 const blink::WebCryptoAlgorithm& unwrap_algorithm, 75 const blink::WebCryptoAlgorithm& unwrap_algorithm,
76 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, 76 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm,
77 bool extractable, 77 bool extractable,
78 blink::WebCryptoKeyUsageMask usages, 78 blink::WebCryptoKeyUsageMask usages,
79 blink::WebCryptoResult result); 79 blink::WebCryptoResult result);
80 80 // This method synchronously computes a digest for the given data, returning
81 // |true| if successful and |false| otherwise.
82 virtual bool digestSynchronous(const blink::WebCryptoAlgorithmId algorithm_id,
83 const unsigned char* data,
84 unsigned int data_size,
85 blink::WebArrayBuffer& result);
81 // This method returns a digestor object that can be used to synchronously 86 // This method returns a digestor object that can be used to synchronously
82 // compute a digest one chunk at a time. Thus, the consume does not need to 87 // compute a digest one chunk at a time. Thus, the consume does not need to
83 // hold onto a large buffer with all the data to digest. Chunks can be given 88 // hold onto a large buffer with all the data to digest. Chunks can be given
84 // one at a time and the digest will be computed piecemeal. The allocated 89 // one at a time and the digest will be computed piecemeal. The allocated
85 // WebCrytpoDigestor that is returned by createDigestor must be freed by the 90 // WebCrytpoDigestor that is returned by createDigestor must be freed by the
86 // caller. 91 // caller.
87 virtual blink::WebCryptoDigestor* createDigestor( 92 virtual blink::WebCryptoDigestor* createDigestor(
88 blink::WebCryptoAlgorithmId algorithm_id); 93 blink::WebCryptoAlgorithmId algorithm_id);
89 94
90 virtual bool deserializeKeyForClone( 95 virtual bool deserializeKeyForClone(
91 const blink::WebCryptoKeyAlgorithm& algorithm, 96 const blink::WebCryptoKeyAlgorithm& algorithm,
92 blink::WebCryptoKeyType type, 97 blink::WebCryptoKeyType type,
93 bool extractable, 98 bool extractable,
94 blink::WebCryptoKeyUsageMask usages, 99 blink::WebCryptoKeyUsageMask usages,
95 const unsigned char* key_data, 100 const unsigned char* key_data,
96 unsigned key_data_size, 101 unsigned key_data_size,
97 blink::WebCryptoKey& key); 102 blink::WebCryptoKey& key);
98 103
99 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, 104 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key,
100 blink::WebVector<unsigned char>& key_data); 105 blink::WebVector<unsigned char>& key_data);
101 106
102 private: 107 private:
103 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); 108 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl);
104 }; 109 };
105 110
106 } // namespace content 111 } // namespace content
107 112
108 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 113 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_
OLDNEW
« no previous file with comments | « trunk/src/content/child/webcrypto/status.h ('k') | trunk/src/content/child/webcrypto/webcrypto_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698