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

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

Powered by Google App Engine
This is Rietveld 408576698