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

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

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: checkpoint 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
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 #include "components/webcrypto/webcrypto_impl.h" 5 #include "components/webcrypto/webcrypto_impl.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 protected: 169 protected:
170 // Since there is no virtual destructor, must not delete directly as a 170 // Since there is no virtual destructor, must not delete directly as a
171 // BaseState. 171 // BaseState.
172 ~BaseState() {} 172 ~BaseState() {}
173 }; 173 };
174 174
175 struct EncryptState : public BaseState { 175 struct EncryptState : public BaseState {
176 EncryptState(const blink::WebCryptoAlgorithm& algorithm, 176 EncryptState(const blink::WebCryptoAlgorithm& algorithm,
177 const blink::WebCryptoKey& key, 177 const blink::WebCryptoKey& key,
178 const unsigned char* data, 178 blink::WebVector<unsigned char> data,
179 unsigned int data_size,
180 const blink::WebCryptoResult& result) 179 const blink::WebCryptoResult& result)
181 : BaseState(result), 180 : BaseState(result),
182 algorithm(algorithm), 181 algorithm(algorithm),
183 key(key), 182 key(key),
184 data(data, data + data_size) {} 183 data(std::move(data)) {}
185 184
186 const blink::WebCryptoAlgorithm algorithm; 185 const blink::WebCryptoAlgorithm algorithm;
187 const blink::WebCryptoKey key; 186 const blink::WebCryptoKey key;
188 const std::vector<uint8_t> data; 187 const blink::WebVector<unsigned char> data;
189 188
190 std::vector<uint8_t> buffer; 189 std::vector<uint8_t> buffer;
191 }; 190 };
192 191
193 typedef EncryptState DecryptState; 192 typedef EncryptState DecryptState;
194 typedef EncryptState DigestState; 193 typedef EncryptState DigestState;
195 194
196 struct GenerateKeyState : public BaseState { 195 struct GenerateKeyState : public BaseState {
197 GenerateKeyState(const blink::WebCryptoAlgorithm& algorithm, 196 GenerateKeyState(const blink::WebCryptoAlgorithm& algorithm,
198 bool extractable, 197 bool extractable,
199 blink::WebCryptoKeyUsageMask usages, 198 blink::WebCryptoKeyUsageMask usages,
200 const blink::WebCryptoResult& result) 199 const blink::WebCryptoResult& result)
201 : BaseState(result), 200 : BaseState(result),
202 algorithm(algorithm), 201 algorithm(algorithm),
203 extractable(extractable), 202 extractable(extractable),
204 usages(usages) {} 203 usages(usages) {}
205 204
206 const blink::WebCryptoAlgorithm algorithm; 205 const blink::WebCryptoAlgorithm algorithm;
207 const bool extractable; 206 const bool extractable;
208 const blink::WebCryptoKeyUsageMask usages; 207 const blink::WebCryptoKeyUsageMask usages;
209 208
210 webcrypto::GenerateKeyResult generate_key_result; 209 webcrypto::GenerateKeyResult generate_key_result;
211 }; 210 };
212 211
213 struct ImportKeyState : public BaseState { 212 struct ImportKeyState : public BaseState {
214 ImportKeyState(blink::WebCryptoKeyFormat format, 213 ImportKeyState(blink::WebCryptoKeyFormat format,
215 const unsigned char* key_data, 214 blink::WebVector<unsigned char> key_data,
216 unsigned int key_data_size,
217 const blink::WebCryptoAlgorithm& algorithm, 215 const blink::WebCryptoAlgorithm& algorithm,
218 bool extractable, 216 bool extractable,
219 blink::WebCryptoKeyUsageMask usages, 217 blink::WebCryptoKeyUsageMask usages,
220 const blink::WebCryptoResult& result) 218 const blink::WebCryptoResult& result)
221 : BaseState(result), 219 : BaseState(result),
222 format(format), 220 format(format),
223 key_data(key_data, key_data + key_data_size), 221 key_data(std::move(key_data)),
224 algorithm(algorithm), 222 algorithm(algorithm),
225 extractable(extractable), 223 extractable(extractable),
226 usages(usages) {} 224 usages(usages) {}
227 225
228 const blink::WebCryptoKeyFormat format; 226 const blink::WebCryptoKeyFormat format;
229 const std::vector<uint8_t> key_data; 227 const blink::WebVector<unsigned char> key_data;
230 const blink::WebCryptoAlgorithm algorithm; 228 const blink::WebCryptoAlgorithm algorithm;
231 const bool extractable; 229 const bool extractable;
232 const blink::WebCryptoKeyUsageMask usages; 230 const blink::WebCryptoKeyUsageMask usages;
233 231
234 blink::WebCryptoKey key; 232 blink::WebCryptoKey key;
235 }; 233 };
236 234
237 struct ExportKeyState : public BaseState { 235 struct ExportKeyState : public BaseState {
238 ExportKeyState(blink::WebCryptoKeyFormat format, 236 ExportKeyState(blink::WebCryptoKeyFormat format,
239 const blink::WebCryptoKey& key, 237 const blink::WebCryptoKey& key,
240 const blink::WebCryptoResult& result) 238 const blink::WebCryptoResult& result)
241 : BaseState(result), format(format), key(key) {} 239 : BaseState(result), format(format), key(key) {}
242 240
243 const blink::WebCryptoKeyFormat format; 241 const blink::WebCryptoKeyFormat format;
244 const blink::WebCryptoKey key; 242 const blink::WebCryptoKey key;
245 243
246 std::vector<uint8_t> buffer; 244 std::vector<uint8_t> buffer;
247 }; 245 };
248 246
249 typedef EncryptState SignState; 247 typedef EncryptState SignState;
250 248
251 struct VerifySignatureState : public BaseState { 249 struct VerifySignatureState : public BaseState {
252 VerifySignatureState(const blink::WebCryptoAlgorithm& algorithm, 250 VerifySignatureState(const blink::WebCryptoAlgorithm& algorithm,
253 const blink::WebCryptoKey& key, 251 const blink::WebCryptoKey& key,
254 const unsigned char* signature, 252 blink::WebVector<unsigned char> signature,
255 unsigned int signature_size, 253 blink::WebVector<unsigned char> data,
256 const unsigned char* data,
257 unsigned int data_size,
258 const blink::WebCryptoResult& result) 254 const blink::WebCryptoResult& result)
259 : BaseState(result), 255 : BaseState(result),
260 algorithm(algorithm), 256 algorithm(algorithm),
261 key(key), 257 key(key),
262 signature(signature, signature + signature_size), 258 signature(std::move(signature)),
263 data(data, data + data_size), 259 data(std::move(data)),
264 verify_result(false) {} 260 verify_result(false) {}
265 261
266 const blink::WebCryptoAlgorithm algorithm; 262 const blink::WebCryptoAlgorithm algorithm;
267 const blink::WebCryptoKey key; 263 const blink::WebCryptoKey key;
268 const std::vector<uint8_t> signature; 264 blink::WebVector<unsigned char> signature;
269 const std::vector<uint8_t> data; 265 blink::WebVector<unsigned char> data;
270 266
271 bool verify_result; 267 bool verify_result;
272 }; 268 };
273 269
274 struct WrapKeyState : public BaseState { 270 struct WrapKeyState : public BaseState {
275 WrapKeyState(blink::WebCryptoKeyFormat format, 271 WrapKeyState(blink::WebCryptoKeyFormat format,
276 const blink::WebCryptoKey& key, 272 const blink::WebCryptoKey& key,
277 const blink::WebCryptoKey& wrapping_key, 273 const blink::WebCryptoKey& wrapping_key,
278 const blink::WebCryptoAlgorithm& wrap_algorithm, 274 const blink::WebCryptoAlgorithm& wrap_algorithm,
279 const blink::WebCryptoResult& result) 275 const blink::WebCryptoResult& result)
280 : BaseState(result), 276 : BaseState(result),
281 format(format), 277 format(format),
282 key(key), 278 key(key),
283 wrapping_key(wrapping_key), 279 wrapping_key(wrapping_key),
284 wrap_algorithm(wrap_algorithm) {} 280 wrap_algorithm(wrap_algorithm) {}
285 281
286 const blink::WebCryptoKeyFormat format; 282 const blink::WebCryptoKeyFormat format;
287 const blink::WebCryptoKey key; 283 const blink::WebCryptoKey key;
288 const blink::WebCryptoKey wrapping_key; 284 const blink::WebCryptoKey wrapping_key;
289 const blink::WebCryptoAlgorithm wrap_algorithm; 285 const blink::WebCryptoAlgorithm wrap_algorithm;
290 286
291 std::vector<uint8_t> buffer; 287 std::vector<uint8_t> buffer;
292 }; 288 };
293 289
294 struct UnwrapKeyState : public BaseState { 290 struct UnwrapKeyState : public BaseState {
295 UnwrapKeyState(blink::WebCryptoKeyFormat format, 291 UnwrapKeyState(blink::WebCryptoKeyFormat format,
296 const unsigned char* wrapped_key, 292 blink::WebVector<unsigned char> wrapped_key,
297 unsigned wrapped_key_size,
298 const blink::WebCryptoKey& wrapping_key, 293 const blink::WebCryptoKey& wrapping_key,
299 const blink::WebCryptoAlgorithm& unwrap_algorithm, 294 const blink::WebCryptoAlgorithm& unwrap_algorithm,
300 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, 295 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm,
301 bool extractable, 296 bool extractable,
302 blink::WebCryptoKeyUsageMask usages, 297 blink::WebCryptoKeyUsageMask usages,
303 const blink::WebCryptoResult& result) 298 const blink::WebCryptoResult& result)
304 : BaseState(result), 299 : BaseState(result),
305 format(format), 300 format(format),
306 wrapped_key(wrapped_key, wrapped_key + wrapped_key_size), 301 wrapped_key(std::move(wrapped_key)),
307 wrapping_key(wrapping_key), 302 wrapping_key(wrapping_key),
308 unwrap_algorithm(unwrap_algorithm), 303 unwrap_algorithm(unwrap_algorithm),
309 unwrapped_key_algorithm(unwrapped_key_algorithm), 304 unwrapped_key_algorithm(unwrapped_key_algorithm),
310 extractable(extractable), 305 extractable(extractable),
311 usages(usages) {} 306 usages(usages) {}
312 307
313 const blink::WebCryptoKeyFormat format; 308 const blink::WebCryptoKeyFormat format;
314 const std::vector<uint8_t> wrapped_key; 309 blink::WebVector<unsigned char> wrapped_key;
315 const blink::WebCryptoKey wrapping_key; 310 const blink::WebCryptoKey wrapping_key;
316 const blink::WebCryptoAlgorithm unwrap_algorithm; 311 const blink::WebCryptoAlgorithm unwrap_algorithm;
317 const blink::WebCryptoAlgorithm unwrapped_key_algorithm; 312 const blink::WebCryptoAlgorithm unwrapped_key_algorithm;
318 const bool extractable; 313 const bool extractable;
319 const blink::WebCryptoKeyUsageMask usages; 314 const blink::WebCryptoKeyUsageMask usages;
320 315
321 blink::WebCryptoKey unwrapped_key; 316 blink::WebCryptoKey unwrapped_key;
322 }; 317 };
323 318
324 struct DeriveBitsState : public BaseState { 319 struct DeriveBitsState : public BaseState {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } // namespace 580 } // namespace
586 581
587 WebCryptoImpl::WebCryptoImpl() { 582 WebCryptoImpl::WebCryptoImpl() {
588 } 583 }
589 584
590 WebCryptoImpl::~WebCryptoImpl() { 585 WebCryptoImpl::~WebCryptoImpl() {
591 } 586 }
592 587
593 void WebCryptoImpl::encrypt(const blink::WebCryptoAlgorithm& algorithm, 588 void WebCryptoImpl::encrypt(const blink::WebCryptoAlgorithm& algorithm,
594 const blink::WebCryptoKey& key, 589 const blink::WebCryptoKey& key,
595 const unsigned char* data, 590 blink::WebVector<unsigned char> data,
596 unsigned int data_size,
597 blink::WebCryptoResult result) { 591 blink::WebCryptoResult result) {
598 DCHECK(!algorithm.isNull()); 592 DCHECK(!algorithm.isNull());
599 593
600 std::unique_ptr<EncryptState> state( 594 std::unique_ptr<EncryptState> state(
601 new EncryptState(algorithm, key, data, data_size, result)); 595 new EncryptState(algorithm, key, std::move(data), result));
602 if (!CryptoThreadPool::PostTask( 596 if (!CryptoThreadPool::PostTask(
603 FROM_HERE, base::Bind(DoEncrypt, base::Passed(&state)))) { 597 FROM_HERE, base::Bind(DoEncrypt, base::Passed(&state)))) {
604 CompleteWithThreadPoolError(&result); 598 CompleteWithThreadPoolError(&result);
605 } 599 }
606 } 600 }
607 601
608 void WebCryptoImpl::decrypt(const blink::WebCryptoAlgorithm& algorithm, 602 void WebCryptoImpl::decrypt(const blink::WebCryptoAlgorithm& algorithm,
609 const blink::WebCryptoKey& key, 603 const blink::WebCryptoKey& key,
610 const unsigned char* data, 604 blink::WebVector<unsigned char> data,
611 unsigned int data_size,
612 blink::WebCryptoResult result) { 605 blink::WebCryptoResult result) {
613 DCHECK(!algorithm.isNull()); 606 DCHECK(!algorithm.isNull());
614 607
615 std::unique_ptr<DecryptState> state( 608 std::unique_ptr<DecryptState> state(
616 new DecryptState(algorithm, key, data, data_size, result)); 609 new DecryptState(algorithm, key, std::move(data), result));
617 if (!CryptoThreadPool::PostTask( 610 if (!CryptoThreadPool::PostTask(
618 FROM_HERE, base::Bind(DoDecrypt, base::Passed(&state)))) { 611 FROM_HERE, base::Bind(DoDecrypt, base::Passed(&state)))) {
619 CompleteWithThreadPoolError(&result); 612 CompleteWithThreadPoolError(&result);
620 } 613 }
621 } 614 }
622 615
623 void WebCryptoImpl::digest(const blink::WebCryptoAlgorithm& algorithm, 616 void WebCryptoImpl::digest(const blink::WebCryptoAlgorithm& algorithm,
624 const unsigned char* data, 617 blink::WebVector<unsigned char> data,
625 unsigned int data_size,
626 blink::WebCryptoResult result) { 618 blink::WebCryptoResult result) {
627 DCHECK(!algorithm.isNull()); 619 DCHECK(!algorithm.isNull());
628 620
629 std::unique_ptr<DigestState> state(new DigestState( 621 std::unique_ptr<DigestState> state(new DigestState(
630 algorithm, blink::WebCryptoKey::createNull(), data, data_size, result)); 622 algorithm, blink::WebCryptoKey::createNull(), std::move(data), result));
631 if (!CryptoThreadPool::PostTask(FROM_HERE, 623 if (!CryptoThreadPool::PostTask(FROM_HERE,
632 base::Bind(DoDigest, base::Passed(&state)))) { 624 base::Bind(DoDigest, base::Passed(&state)))) {
633 CompleteWithThreadPoolError(&result); 625 CompleteWithThreadPoolError(&result);
634 } 626 }
635 } 627 }
636 628
637 void WebCryptoImpl::generateKey(const blink::WebCryptoAlgorithm& algorithm, 629 void WebCryptoImpl::generateKey(const blink::WebCryptoAlgorithm& algorithm,
638 bool extractable, 630 bool extractable,
639 blink::WebCryptoKeyUsageMask usages, 631 blink::WebCryptoKeyUsageMask usages,
640 blink::WebCryptoResult result) { 632 blink::WebCryptoResult result) {
641 DCHECK(!algorithm.isNull()); 633 DCHECK(!algorithm.isNull());
642 634
643 std::unique_ptr<GenerateKeyState> state( 635 std::unique_ptr<GenerateKeyState> state(
644 new GenerateKeyState(algorithm, extractable, usages, result)); 636 new GenerateKeyState(algorithm, extractable, usages, result));
645 if (!CryptoThreadPool::PostTask( 637 if (!CryptoThreadPool::PostTask(
646 FROM_HERE, base::Bind(DoGenerateKey, base::Passed(&state)))) { 638 FROM_HERE, base::Bind(DoGenerateKey, base::Passed(&state)))) {
647 CompleteWithThreadPoolError(&result); 639 CompleteWithThreadPoolError(&result);
648 } 640 }
649 } 641 }
650 642
651 void WebCryptoImpl::importKey(blink::WebCryptoKeyFormat format, 643 void WebCryptoImpl::importKey(blink::WebCryptoKeyFormat format,
652 const unsigned char* key_data, 644 blink::WebVector<unsigned char> key_data,
653 unsigned int key_data_size,
654 const blink::WebCryptoAlgorithm& algorithm, 645 const blink::WebCryptoAlgorithm& algorithm,
655 bool extractable, 646 bool extractable,
656 blink::WebCryptoKeyUsageMask usages, 647 blink::WebCryptoKeyUsageMask usages,
657 blink::WebCryptoResult result) { 648 blink::WebCryptoResult result) {
658 std::unique_ptr<ImportKeyState> state(new ImportKeyState( 649 std::unique_ptr<ImportKeyState> state(new ImportKeyState(
659 format, key_data, key_data_size, algorithm, extractable, usages, result)); 650 format, std::move(key_data), algorithm, extractable, usages, result));
660 if (!CryptoThreadPool::PostTask( 651 if (!CryptoThreadPool::PostTask(
661 FROM_HERE, base::Bind(DoImportKey, base::Passed(&state)))) { 652 FROM_HERE, base::Bind(DoImportKey, base::Passed(&state)))) {
662 CompleteWithThreadPoolError(&result); 653 CompleteWithThreadPoolError(&result);
663 } 654 }
664 } 655 }
665 656
666 void WebCryptoImpl::exportKey(blink::WebCryptoKeyFormat format, 657 void WebCryptoImpl::exportKey(blink::WebCryptoKeyFormat format,
667 const blink::WebCryptoKey& key, 658 const blink::WebCryptoKey& key,
668 blink::WebCryptoResult result) { 659 blink::WebCryptoResult result) {
669 std::unique_ptr<ExportKeyState> state( 660 std::unique_ptr<ExportKeyState> state(
670 new ExportKeyState(format, key, result)); 661 new ExportKeyState(format, key, result));
671 if (!CryptoThreadPool::PostTask( 662 if (!CryptoThreadPool::PostTask(
672 FROM_HERE, base::Bind(DoExportKey, base::Passed(&state)))) { 663 FROM_HERE, base::Bind(DoExportKey, base::Passed(&state)))) {
673 CompleteWithThreadPoolError(&result); 664 CompleteWithThreadPoolError(&result);
674 } 665 }
675 } 666 }
676 667
677 void WebCryptoImpl::sign(const blink::WebCryptoAlgorithm& algorithm, 668 void WebCryptoImpl::sign(const blink::WebCryptoAlgorithm& algorithm,
678 const blink::WebCryptoKey& key, 669 const blink::WebCryptoKey& key,
679 const unsigned char* data, 670 blink::WebVector<unsigned char> data,
680 unsigned int data_size,
681 blink::WebCryptoResult result) { 671 blink::WebCryptoResult result) {
682 std::unique_ptr<SignState> state( 672 std::unique_ptr<SignState> state(
683 new SignState(algorithm, key, data, data_size, result)); 673 new SignState(algorithm, key, std::move(data), result));
684 if (!CryptoThreadPool::PostTask(FROM_HERE, 674 if (!CryptoThreadPool::PostTask(FROM_HERE,
685 base::Bind(DoSign, base::Passed(&state)))) { 675 base::Bind(DoSign, base::Passed(&state)))) {
686 CompleteWithThreadPoolError(&result); 676 CompleteWithThreadPoolError(&result);
687 } 677 }
688 } 678 }
689 679
690 void WebCryptoImpl::verifySignature(const blink::WebCryptoAlgorithm& algorithm, 680 void WebCryptoImpl::verifySignature(const blink::WebCryptoAlgorithm& algorithm,
691 const blink::WebCryptoKey& key, 681 const blink::WebCryptoKey& key,
692 const unsigned char* signature, 682 blink::WebVector<unsigned char> signature,
693 unsigned int signature_size, 683 blink::WebVector<unsigned char> data,
694 const unsigned char* data,
695 unsigned int data_size,
696 blink::WebCryptoResult result) { 684 blink::WebCryptoResult result) {
697 std::unique_ptr<VerifySignatureState> state(new VerifySignatureState( 685 std::unique_ptr<VerifySignatureState> state(new VerifySignatureState(
698 algorithm, key, signature, signature_size, data, data_size, result)); 686 algorithm, key, std::move(signature), std::move(data), result));
699 if (!CryptoThreadPool::PostTask(FROM_HERE, 687 if (!CryptoThreadPool::PostTask(FROM_HERE,
700 base::Bind(DoVerify, base::Passed(&state)))) { 688 base::Bind(DoVerify, base::Passed(&state)))) {
701 CompleteWithThreadPoolError(&result); 689 CompleteWithThreadPoolError(&result);
702 } 690 }
703 } 691 }
704 692
705 void WebCryptoImpl::wrapKey(blink::WebCryptoKeyFormat format, 693 void WebCryptoImpl::wrapKey(blink::WebCryptoKeyFormat format,
706 const blink::WebCryptoKey& key, 694 const blink::WebCryptoKey& key,
707 const blink::WebCryptoKey& wrapping_key, 695 const blink::WebCryptoKey& wrapping_key,
708 const blink::WebCryptoAlgorithm& wrap_algorithm, 696 const blink::WebCryptoAlgorithm& wrap_algorithm,
709 blink::WebCryptoResult result) { 697 blink::WebCryptoResult result) {
710 std::unique_ptr<WrapKeyState> state( 698 std::unique_ptr<WrapKeyState> state(
711 new WrapKeyState(format, key, wrapping_key, wrap_algorithm, result)); 699 new WrapKeyState(format, key, wrapping_key, wrap_algorithm, result));
712 if (!CryptoThreadPool::PostTask( 700 if (!CryptoThreadPool::PostTask(
713 FROM_HERE, base::Bind(DoWrapKey, base::Passed(&state)))) { 701 FROM_HERE, base::Bind(DoWrapKey, base::Passed(&state)))) {
714 CompleteWithThreadPoolError(&result); 702 CompleteWithThreadPoolError(&result);
715 } 703 }
716 } 704 }
717 705
718 void WebCryptoImpl::unwrapKey( 706 void WebCryptoImpl::unwrapKey(
719 blink::WebCryptoKeyFormat format, 707 blink::WebCryptoKeyFormat format,
720 const unsigned char* wrapped_key, 708 blink::WebVector<unsigned char> wrapped_key,
721 unsigned wrapped_key_size,
722 const blink::WebCryptoKey& wrapping_key, 709 const blink::WebCryptoKey& wrapping_key,
723 const blink::WebCryptoAlgorithm& unwrap_algorithm, 710 const blink::WebCryptoAlgorithm& unwrap_algorithm,
724 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, 711 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm,
725 bool extractable, 712 bool extractable,
726 blink::WebCryptoKeyUsageMask usages, 713 blink::WebCryptoKeyUsageMask usages,
727 blink::WebCryptoResult result) { 714 blink::WebCryptoResult result) {
728 std::unique_ptr<UnwrapKeyState> state(new UnwrapKeyState( 715 std::unique_ptr<UnwrapKeyState> state(new UnwrapKeyState(
729 format, wrapped_key, wrapped_key_size, wrapping_key, unwrap_algorithm, 716 format, std::move(wrapped_key), wrapping_key, unwrap_algorithm,
730 unwrapped_key_algorithm, extractable, usages, result)); 717 unwrapped_key_algorithm, extractable, usages, result));
731 if (!CryptoThreadPool::PostTask( 718 if (!CryptoThreadPool::PostTask(
732 FROM_HERE, base::Bind(DoUnwrapKey, base::Passed(&state)))) { 719 FROM_HERE, base::Bind(DoUnwrapKey, base::Passed(&state)))) {
733 CompleteWithThreadPoolError(&result); 720 CompleteWithThreadPoolError(&result);
734 } 721 }
735 } 722 }
736 723
737 void WebCryptoImpl::deriveBits(const blink::WebCryptoAlgorithm& algorithm, 724 void WebCryptoImpl::deriveBits(const blink::WebCryptoAlgorithm& algorithm,
738 const blink::WebCryptoKey& base_key, 725 const blink::WebCryptoKey& base_key,
739 unsigned int length_bits, 726 unsigned int length_bits,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 webcrypto::CryptoData(key_data, key_data_size), &key); 768 webcrypto::CryptoData(key_data, key_data_size), &key);
782 } 769 }
783 770
784 bool WebCryptoImpl::serializeKeyForClone( 771 bool WebCryptoImpl::serializeKeyForClone(
785 const blink::WebCryptoKey& key, 772 const blink::WebCryptoKey& key,
786 blink::WebVector<unsigned char>& key_data) { 773 blink::WebVector<unsigned char>& key_data) {
787 return webcrypto::SerializeKeyForClone(key, &key_data); 774 return webcrypto::SerializeKeyForClone(key, &key_data);
788 } 775 }
789 776
790 } // namespace webcrypto 777 } // namespace webcrypto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698