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

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

Issue 233733004: [webcrypto] Make operations run on worker threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix argument ordering bug 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 // This method synchronously computes a digest for the given data, returning 80
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);
86 // This method returns a digestor object that can be used to synchronously 81 // This method returns a digestor object that can be used to synchronously
87 // compute a digest one chunk at a time. Thus, the consume does not need to 82 // compute a digest one chunk at a time. Thus, the consume does not need to
88 // hold onto a large buffer with all the data to digest. Chunks can be given 83 // hold onto a large buffer with all the data to digest. Chunks can be given
89 // one at a time and the digest will be computed piecemeal. The allocated 84 // one at a time and the digest will be computed piecemeal. The allocated
90 // WebCrytpoDigestor that is returned by createDigestor must be freed by the 85 // WebCrytpoDigestor that is returned by createDigestor must be freed by the
91 // caller. 86 // caller.
92 virtual blink::WebCryptoDigestor* createDigestor( 87 virtual blink::WebCryptoDigestor* createDigestor(
93 blink::WebCryptoAlgorithmId algorithm_id); 88 blink::WebCryptoAlgorithmId algorithm_id);
94 89
95 virtual bool deserializeKeyForClone( 90 virtual bool deserializeKeyForClone(
96 const blink::WebCryptoKeyAlgorithm& algorithm, 91 const blink::WebCryptoKeyAlgorithm& algorithm,
97 blink::WebCryptoKeyType type, 92 blink::WebCryptoKeyType type,
98 bool extractable, 93 bool extractable,
99 blink::WebCryptoKeyUsageMask usages, 94 blink::WebCryptoKeyUsageMask usages,
100 const unsigned char* key_data, 95 const unsigned char* key_data,
101 unsigned key_data_size, 96 unsigned key_data_size,
102 blink::WebCryptoKey& key); 97 blink::WebCryptoKey& key);
103 98
104 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, 99 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key,
105 blink::WebVector<unsigned char>& key_data); 100 blink::WebVector<unsigned char>& key_data);
106 101
107 private: 102 private:
108 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); 103 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl);
109 }; 104 };
110 105
111 } // namespace content 106 } // namespace content
112 107
113 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 108 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698