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

Side by Side Diff: components/webcrypto/webcrypto_impl.h

Issue 2160943003: Transfer WebCrypto databuffers across the Blink API using blink::WebVector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « components/webcrypto/algorithms/test_helpers.cc ('k') | components/webcrypto/webcrypto_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 5 #ifndef COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_
6 #define COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 6 #define COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.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 webcrypto { 14 namespace webcrypto {
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 OpenSSL implementation. 17 // the synchronous OpenSSL implementation.
18 // 18 //
19 // WebCryptoImpl is threadsafe. 19 // WebCryptoImpl is threadsafe.
20 // 20 //
21 // EnsureInit() must be called prior to using methods on WebCryptoImpl(). 21 // EnsureInit() must be called prior to using methods on WebCryptoImpl().
22 class WebCryptoImpl : public blink::WebCrypto { 22 class WebCryptoImpl : public blink::WebCrypto {
23 public: 23 public:
24 WebCryptoImpl(); 24 WebCryptoImpl();
25 25
26 ~WebCryptoImpl() override; 26 ~WebCryptoImpl() override;
27 27
28 void encrypt(const blink::WebCryptoAlgorithm& algorithm, 28 void encrypt(const blink::WebCryptoAlgorithm& algorithm,
29 const blink::WebCryptoKey& key, 29 const blink::WebCryptoKey& key,
30 const unsigned char* data, 30 blink::WebVector<unsigned char> data,
31 unsigned int data_size,
32 blink::WebCryptoResult result) override; 31 blink::WebCryptoResult result) override;
33 void decrypt(const blink::WebCryptoAlgorithm& algorithm, 32 void decrypt(const blink::WebCryptoAlgorithm& algorithm,
34 const blink::WebCryptoKey& key, 33 const blink::WebCryptoKey& key,
35 const unsigned char* data, 34 blink::WebVector<unsigned char> data,
36 unsigned int data_size,
37 blink::WebCryptoResult result) override; 35 blink::WebCryptoResult result) override;
38 void digest(const blink::WebCryptoAlgorithm& algorithm, 36 void digest(const blink::WebCryptoAlgorithm& algorithm,
39 const unsigned char* data, 37 blink::WebVector<unsigned char> data,
40 unsigned int data_size,
41 blink::WebCryptoResult result) override; 38 blink::WebCryptoResult result) override;
42 void generateKey(const blink::WebCryptoAlgorithm& algorithm, 39 void generateKey(const blink::WebCryptoAlgorithm& algorithm,
43 bool extractable, 40 bool extractable,
44 blink::WebCryptoKeyUsageMask usages, 41 blink::WebCryptoKeyUsageMask usages,
45 blink::WebCryptoResult result) override; 42 blink::WebCryptoResult result) override;
46 void importKey(blink::WebCryptoKeyFormat format, 43 void importKey(blink::WebCryptoKeyFormat format,
47 const unsigned char* key_data, 44 blink::WebVector<unsigned char> key_data,
48 unsigned int key_data_size,
49 const blink::WebCryptoAlgorithm& algorithm, 45 const blink::WebCryptoAlgorithm& algorithm,
50 bool extractable, 46 bool extractable,
51 blink::WebCryptoKeyUsageMask usages, 47 blink::WebCryptoKeyUsageMask usages,
52 blink::WebCryptoResult result) override; 48 blink::WebCryptoResult result) override;
53 void exportKey(blink::WebCryptoKeyFormat format, 49 void exportKey(blink::WebCryptoKeyFormat format,
54 const blink::WebCryptoKey& key, 50 const blink::WebCryptoKey& key,
55 blink::WebCryptoResult result) override; 51 blink::WebCryptoResult result) override;
56 void sign(const blink::WebCryptoAlgorithm& algorithm, 52 void sign(const blink::WebCryptoAlgorithm& algorithm,
57 const blink::WebCryptoKey& key, 53 const blink::WebCryptoKey& key,
58 const unsigned char* data, 54 blink::WebVector<unsigned char> data,
59 unsigned int data_size,
60 blink::WebCryptoResult result) override; 55 blink::WebCryptoResult result) override;
61 void verifySignature(const blink::WebCryptoAlgorithm& algorithm, 56 void verifySignature(const blink::WebCryptoAlgorithm& algorithm,
62 const blink::WebCryptoKey& key, 57 const blink::WebCryptoKey& key,
63 const unsigned char* signature, 58 blink::WebVector<unsigned char> signature,
64 unsigned int signature_size, 59 blink::WebVector<unsigned char> data,
65 const unsigned char* data,
66 unsigned int data_size,
67 blink::WebCryptoResult result) override; 60 blink::WebCryptoResult result) override;
68 void wrapKey(blink::WebCryptoKeyFormat format, 61 void wrapKey(blink::WebCryptoKeyFormat format,
69 const blink::WebCryptoKey& key, 62 const blink::WebCryptoKey& key,
70 const blink::WebCryptoKey& wrapping_key, 63 const blink::WebCryptoKey& wrapping_key,
71 const blink::WebCryptoAlgorithm& wrap_algorithm, 64 const blink::WebCryptoAlgorithm& wrap_algorithm,
72 blink::WebCryptoResult result) override; 65 blink::WebCryptoResult result) override;
73 void unwrapKey(blink::WebCryptoKeyFormat format, 66 void unwrapKey(blink::WebCryptoKeyFormat format,
74 const unsigned char* wrapped_key, 67 blink::WebVector<unsigned char> wrapped_key,
75 unsigned wrapped_key_size,
76 const blink::WebCryptoKey& wrapping_key, 68 const blink::WebCryptoKey& wrapping_key,
77 const blink::WebCryptoAlgorithm& unwrap_algorithm, 69 const blink::WebCryptoAlgorithm& unwrap_algorithm,
78 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, 70 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm,
79 bool extractable, 71 bool extractable,
80 blink::WebCryptoKeyUsageMask usages, 72 blink::WebCryptoKeyUsageMask usages,
81 blink::WebCryptoResult result) override; 73 blink::WebCryptoResult result) override;
82 74
83 void deriveBits(const blink::WebCryptoAlgorithm& algorithm, 75 void deriveBits(const blink::WebCryptoAlgorithm& algorithm,
84 const blink::WebCryptoKey& base_key, 76 const blink::WebCryptoKey& base_key,
85 unsigned int length_bits, 77 unsigned int length_bits,
(...skipping 25 matching lines...) Expand all
111 bool serializeKeyForClone(const blink::WebCryptoKey& key, 103 bool serializeKeyForClone(const blink::WebCryptoKey& key,
112 blink::WebVector<unsigned char>& key_data) override; 104 blink::WebVector<unsigned char>& key_data) override;
113 105
114 private: 106 private:
115 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); 107 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl);
116 }; 108 };
117 109
118 } // namespace webcrypto 110 } // namespace webcrypto
119 111
120 #endif // COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_ 112 #endif // COMPONENTS_WEBCRYPTO_WEBCRYPTO_IMPL_H_
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/test_helpers.cc ('k') | components/webcrypto/webcrypto_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698