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

Side by Side Diff: third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 2141843002: Copy array buffer data used by WebCrypto in the order expected by draft specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary refactors 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 #include "core/dom/DOMTypedArray.h" 39 #include "core/dom/DOMTypedArray.h"
40 #include "public/platform/WebCryptoAlgorithmParams.h" 40 #include "public/platform/WebCryptoAlgorithmParams.h"
41 #include "public/platform/WebString.h" 41 #include "public/platform/WebString.h"
42 #include "wtf/MathExtras.h" 42 #include "wtf/MathExtras.h"
43 #include "wtf/PtrUtil.h" 43 #include "wtf/PtrUtil.h"
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 #include "wtf/text/StringBuilder.h" 45 #include "wtf/text/StringBuilder.h"
46 #include <algorithm> 46 #include <algorithm>
47 #include <memory> 47 #include <memory>
48 48
49 // FIXME: Change the interface for constructing WebCryptoAlgorithmParams
haraken 2016/07/18 22:41:57 TODO(your name)
eroman 2016/07/18 23:15:25 Done.
50 // to allow transferring byte parameters (whereas currently it makes a
51 // copy).
52
49 namespace blink { 53 namespace blink {
50 54
51 namespace { 55 namespace {
52 56
53 typedef ArrayBufferOrArrayBufferView BufferSource; 57 typedef ArrayBufferOrArrayBufferView BufferSource;
54 58
55 struct AlgorithmNameMapping { 59 struct AlgorithmNameMapping {
56 // Must be an upper case ASCII string. 60 // Must be an upper case ASCII string.
57 const char* const algorithmName; 61 const char* const algorithmName;
58 // Must be strlen(algorithmName). 62 // Must be strlen(algorithmName).
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 stack.add(message2); 267 stack.add(message2);
264 return stack.toString(); 268 return stack.toString();
265 } 269 }
266 270
267 private: 271 private:
268 // This inline size is large enough to avoid having to grow the Vector in 272 // This inline size is large enough to avoid having to grow the Vector in
269 // the majority of cases (up to 1 nested algorithm identifier). 273 // the majority of cases (up to 1 nested algorithm identifier).
270 Vector<const char*, 10> m_messages; 274 Vector<const char*, 10> m_messages;
271 }; 275 };
272 276
277 static Vector<uint8_t> copyBytes(const DOMArrayPiece& source)
278 {
279 Vector<uint8_t> result;
280 result.append(reinterpret_cast<const uint8_t*>(source.data()), source.byteLe ngth());
281 return result;
282 }
283
273 // Defined by the WebCrypto spec as: 284 // Defined by the WebCrypto spec as:
274 // 285 //
275 // typedef (ArrayBuffer or ArrayBufferView) BufferSource; 286 // typedef (ArrayBuffer or ArrayBufferView) BufferSource;
276 // 287 //
277 bool getOptionalBufferSource(const Dictionary& raw, const char* propertyName, bo ol& hasProperty, BufferSource& buffer, const ErrorContext& context, AlgorithmErr or* error) 288 bool getOptionalBufferSource(const Dictionary& raw, const char* propertyName, bo ol& hasProperty, Vector<uint8_t>& bytes, const ErrorContext& context, AlgorithmE rror* error)
278 { 289 {
279 hasProperty = false; 290 hasProperty = false;
280 v8::Local<v8::Value> v8Value; 291 v8::Local<v8::Value> v8Value;
281 if (!raw.get(propertyName, v8Value)) 292 if (!raw.get(propertyName, v8Value))
282 return true; 293 return true;
283 hasProperty = true; 294 hasProperty = true;
284 295
285 if (v8Value->IsArrayBufferView()) { 296 if (v8Value->IsArrayBufferView()) {
286 buffer.setArrayBufferView(V8ArrayBufferView::toImpl(v8::Local<v8::Object >::Cast(v8Value))); 297 bytes = copyBytes(V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast( v8Value)));
287 return true; 298 return true;
288 } 299 }
289 300
290 if (v8Value->IsArrayBuffer()) { 301 if (v8Value->IsArrayBuffer()) {
291 buffer.setArrayBuffer(V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast( v8Value))); 302 bytes = copyBytes(V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(v8Va lue)));
292 return true; 303 return true;
293 } 304 }
294 305
295 if (hasProperty) { 306 if (hasProperty) {
296 setTypeError(context.toString(propertyName, "Not a BufferSource"), error ); 307 setTypeError(context.toString(propertyName, "Not a BufferSource"), error );
297 return false; 308 return false;
298 } 309 }
299 return true; 310 return true;
300 } 311 }
301 312
302 bool getBufferSource(const Dictionary& raw, const char* propertyName, BufferSour ce& buffer, const ErrorContext& context, AlgorithmError* error) 313 bool getBufferSource(const Dictionary& raw, const char* propertyName, Vector<uin t8_t>& bytes, const ErrorContext& context, AlgorithmError* error)
303 { 314 {
304 bool hasProperty; 315 bool hasProperty;
305 bool ok = getOptionalBufferSource(raw, propertyName, hasProperty, buffer, co ntext, error); 316 bool ok = getOptionalBufferSource(raw, propertyName, hasProperty, bytes, con text, error);
306 if (!hasProperty) { 317 if (!hasProperty) {
307 setTypeError(context.toString(propertyName, "Missing required property") , error); 318 setTypeError(context.toString(propertyName, "Missing required property") , error);
308 return false; 319 return false;
309 } 320 }
310 return ok; 321 return ok;
311 } 322 }
312 323
313 bool getUint8Array(const Dictionary& raw, const char* propertyName, DOMUint8Arra y*& array, const ErrorContext& context, AlgorithmError* error) 324 bool getUint8Array(const Dictionary& raw, const char* propertyName, Vector<uint8 _t>& bytes, const ErrorContext& context, AlgorithmError* error)
314 { 325 {
326 DOMUint8Array* array = nullptr;
315 if (!DictionaryHelper::get(raw, propertyName, array) || !array) { 327 if (!DictionaryHelper::get(raw, propertyName, array) || !array) {
316 setTypeError(context.toString(propertyName, "Missing or not a Uint8Array "), error); 328 setTypeError(context.toString(propertyName, "Missing or not a Uint8Array "), error);
317 return false; 329 return false;
318 } 330 }
331 bytes = copyBytes(array);
319 return true; 332 return true;
320 } 333 }
321 334
322 // Defined by the WebCrypto spec as: 335 // Defined by the WebCrypto spec as:
323 // 336 //
324 // typedef Uint8Array BigInteger; 337 // typedef Uint8Array BigInteger;
325 bool getBigInteger(const Dictionary& raw, const char* propertyName, DOMUint8Arra y*& array, const ErrorContext& context, AlgorithmError* error) 338 bool getBigInteger(const Dictionary& raw, const char* propertyName, Vector<uint8 _t>& bytes, const ErrorContext& context, AlgorithmError* error)
326 { 339 {
327 if (!getUint8Array(raw, propertyName, array, context, error)) 340 if (!getUint8Array(raw, propertyName, bytes, context, error))
328 return false; 341 return false;
329 342
330 if (!array->byteLength()) { 343 if (bytes.isEmpty()) {
331 // Empty BigIntegers represent 0 according to the spec 344 // Empty BigIntegers represent 0 according to the spec
332 array = DOMUint8Array::create(1); 345 bytes.fill(0, 1);
333 } 346 }
334 347
335 return true; 348 return true;
336 } 349 }
337 350
338 // Gets an integer according to WebIDL's [EnforceRange]. 351 // Gets an integer according to WebIDL's [EnforceRange].
339 bool getOptionalInteger(const Dictionary& raw, const char* propertyName, bool& h asProperty, double& value, double minValue, double maxValue, const ErrorContext& context, AlgorithmError* error) 352 bool getOptionalInteger(const Dictionary& raw, const char* propertyName, bool& h asProperty, double& value, double minValue, double maxValue, const ErrorContext& context, AlgorithmError* error)
340 { 353 {
341 double number; 354 double number;
342 bool ok = DictionaryHelper::get(raw, propertyName, number, hasProperty); 355 bool ok = DictionaryHelper::get(raw, propertyName, number, hasProperty);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return true; 457 return true;
445 } 458 }
446 459
447 // Defined by the WebCrypto spec as: 460 // Defined by the WebCrypto spec as:
448 // 461 //
449 // dictionary AesCbcParams : Algorithm { 462 // dictionary AesCbcParams : Algorithm {
450 // required BufferSource iv; 463 // required BufferSource iv;
451 // }; 464 // };
452 bool parseAesCbcParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error) 465 bool parseAesCbcParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error)
453 { 466 {
454 BufferSource ivBufferSource; 467 Vector<uint8_t> iv;
455 if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) 468 if (!getBufferSource(raw, "iv", iv, context, error))
456 return false; 469 return false;
457 470
458 DOMArrayPiece iv(ivBufferSource); 471 params = wrapUnique(new WebCryptoAesCbcParams(iv.data(), iv.size()));
459
460 params = wrapUnique(new WebCryptoAesCbcParams(iv.bytes(), iv.byteLength()));
461 return true; 472 return true;
462 } 473 }
463 474
464 // Defined by the WebCrypto spec as: 475 // Defined by the WebCrypto spec as:
465 // 476 //
466 // dictionary AesKeyGenParams : Algorithm { 477 // dictionary AesKeyGenParams : Algorithm {
467 // [EnforceRange] required unsigned short length; 478 // [EnforceRange] required unsigned short length;
468 // }; 479 // };
469 bool parseAesKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgori thmParams>& params, const ErrorContext& context, AlgorithmError* error) 480 bool parseAesKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgori thmParams>& params, const ErrorContext& context, AlgorithmError* error)
470 { 481 {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 // 569 //
559 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { 570 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams {
560 // required HashAlgorithmIdentifier hash; 571 // required HashAlgorithmIdentifier hash;
561 // }; 572 // };
562 bool parseRsaHashedKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCrypto AlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) 573 bool parseRsaHashedKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCrypto AlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error)
563 { 574 {
564 uint32_t modulusLength; 575 uint32_t modulusLength;
565 if (!getUint32(raw, "modulusLength", modulusLength, context, error)) 576 if (!getUint32(raw, "modulusLength", modulusLength, context, error))
566 return false; 577 return false;
567 578
568 DOMUint8Array* publicExponent = nullptr; 579 Vector<uint8_t> publicExponent;
569 if (!getBigInteger(raw, "publicExponent", publicExponent, context, error)) 580 if (!getBigInteger(raw, "publicExponent", publicExponent, context, error))
570 return false; 581 return false;
571 582
572 WebCryptoAlgorithm hash; 583 WebCryptoAlgorithm hash;
573 if (!parseHash(raw, hash, context, error)) 584 if (!parseHash(raw, hash, context, error))
574 return false; 585 return false;
575 586
576 params = wrapUnique(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent ->byteLength())); 587 params = wrapUnique(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, publicExponent.data(), publicExponent.size()));
577 return true; 588 return true;
578 } 589 }
579 590
580 // Defined by the WebCrypto spec as: 591 // Defined by the WebCrypto spec as:
581 // 592 //
582 // dictionary AesCtrParams : Algorithm { 593 // dictionary AesCtrParams : Algorithm {
583 // required BufferSource counter; 594 // required BufferSource counter;
584 // [EnforceRange] required octet length; 595 // [EnforceRange] required octet length;
585 // }; 596 // };
586 bool parseAesCtrParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error) 597 bool parseAesCtrParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error)
587 { 598 {
588 BufferSource counterBufferSource; 599 Vector<uint8_t> counter;
589 if (!getBufferSource(raw, "counter", counterBufferSource, context, error)) 600 if (!getBufferSource(raw, "counter", counter, context, error))
590 return false; 601 return false;
591 602
592 DOMArrayPiece counter(counterBufferSource);
593 uint8_t length; 603 uint8_t length;
594 if (!getUint8(raw, "length", length, context, error)) 604 if (!getUint8(raw, "length", length, context, error))
595 return false; 605 return false;
596 606
597 params = wrapUnique(new WebCryptoAesCtrParams(length, counter.bytes(), count er.byteLength())); 607 params = wrapUnique(new WebCryptoAesCtrParams(length, counter.data(), counte r.size()));
598 return true; 608 return true;
599 } 609 }
600 610
601 // Defined by the WebCrypto spec as: 611 // Defined by the WebCrypto spec as:
602 // 612 //
603 // dictionary AesGcmParams : Algorithm { 613 // dictionary AesGcmParams : Algorithm {
604 // required BufferSource iv; 614 // required BufferSource iv;
605 // BufferSource additionalData; 615 // BufferSource additionalData;
606 // [EnforceRange] octet tagLength; 616 // [EnforceRange] octet tagLength;
607 // } 617 // }
608 bool parseAesGcmParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error) 618 bool parseAesGcmParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error)
609 { 619 {
610 BufferSource ivBufferSource; 620 Vector<uint8_t> iv;
611 if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) 621 if (!getBufferSource(raw, "iv", iv, context, error))
612 return false; 622 return false;
613 623
614 bool hasAdditionalData; 624 bool hasAdditionalData;
615 BufferSource additionalDataBufferSource; 625 Vector<uint8_t> additionalData;
616 if (!getOptionalBufferSource(raw, "additionalData", hasAdditionalData, addit ionalDataBufferSource, context, error)) 626 if (!getOptionalBufferSource(raw, "additionalData", hasAdditionalData, addit ionalData, context, error))
617 return false; 627 return false;
618 628
619 uint8_t tagLength = 0; 629 uint8_t tagLength = 0;
620 bool hasTagLength; 630 bool hasTagLength;
621 if (!getOptionalUint8(raw, "tagLength", hasTagLength, tagLength, context, er ror)) 631 if (!getOptionalUint8(raw, "tagLength", hasTagLength, tagLength, context, er ror))
622 return false; 632 return false;
623 633
624 DOMArrayPiece iv(ivBufferSource); 634 params = wrapUnique(new WebCryptoAesGcmParams(iv.data(), iv.size(), hasAddit ionalData, additionalData.data(), additionalData.size(), hasTagLength, tagLength ));
625 DOMArrayPiece additionalData(additionalDataBufferSource, DOMArrayPiece::Allo wNullPointToNullWithZeroSize);
626
627 params = wrapUnique(new WebCryptoAesGcmParams(iv.bytes(), iv.byteLength(), h asAdditionalData, additionalData.bytes(), additionalData.byteLength(), hasTagLen gth, tagLength));
628 return true; 635 return true;
629 } 636 }
630 637
631 // Defined by the WebCrypto spec as: 638 // Defined by the WebCrypto spec as:
632 // 639 //
633 // dictionary RsaOaepParams : Algorithm { 640 // dictionary RsaOaepParams : Algorithm {
634 // BufferSource label; 641 // BufferSource label;
635 // }; 642 // };
636 bool parseRsaOaepParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorith mParams>& params, const ErrorContext& context, AlgorithmError* error) 643 bool parseRsaOaepParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorith mParams>& params, const ErrorContext& context, AlgorithmError* error)
637 { 644 {
638 bool hasLabel; 645 bool hasLabel;
639 BufferSource labelBufferSource; 646 Vector<uint8_t> label;
640 if (!getOptionalBufferSource(raw, "label", hasLabel, labelBufferSource, cont ext, error)) 647 if (!getOptionalBufferSource(raw, "label", hasLabel, label, context, error))
641 return false; 648 return false;
642 649
643 DOMArrayPiece label(labelBufferSource, DOMArrayPiece::AllowNullPointToNullWi thZeroSize); 650 params = wrapUnique(new WebCryptoRsaOaepParams(hasLabel, label.data(), label .size()));
644 params = wrapUnique(new WebCryptoRsaOaepParams(hasLabel, label.bytes(), labe l.byteLength()));
645 return true; 651 return true;
646 } 652 }
647 653
648 // Defined by the WebCrypto spec as: 654 // Defined by the WebCrypto spec as:
649 // 655 //
650 // dictionary RsaPssParams : Algorithm { 656 // dictionary RsaPssParams : Algorithm {
651 // [EnforceRange] required unsigned long saltLength; 657 // [EnforceRange] required unsigned long saltLength;
652 // }; 658 // };
653 bool parseRsaPssParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error) 659 bool parseRsaPssParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error)
654 { 660 {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 769
764 // Defined by the WebCrypto spec as: 770 // Defined by the WebCrypto spec as:
765 // 771 //
766 // dictionary Pbkdf2Params : Algorithm { 772 // dictionary Pbkdf2Params : Algorithm {
767 // required BufferSource salt; 773 // required BufferSource salt;
768 // [EnforceRange] required unsigned long iterations; 774 // [EnforceRange] required unsigned long iterations;
769 // required HashAlgorithmIdentifier hash; 775 // required HashAlgorithmIdentifier hash;
770 // }; 776 // };
771 bool parsePbkdf2Params(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error) 777 bool parsePbkdf2Params(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithm Params>& params, const ErrorContext& context, AlgorithmError* error)
772 { 778 {
773 BufferSource saltBufferSource; 779 Vector<uint8_t> salt;
774 if (!getBufferSource(raw, "salt", saltBufferSource, context, error)) 780 if (!getBufferSource(raw, "salt", salt, context, error))
775 return false; 781 return false;
776 782
777 DOMArrayPiece salt(saltBufferSource);
778
779 uint32_t iterations; 783 uint32_t iterations;
780 if (!getUint32(raw, "iterations", iterations, context, error)) 784 if (!getUint32(raw, "iterations", iterations, context, error))
781 return false; 785 return false;
782 786
783 WebCryptoAlgorithm hash; 787 WebCryptoAlgorithm hash;
784 if (!parseHash(raw, hash, context, error)) 788 if (!parseHash(raw, hash, context, error))
785 return false; 789 return false;
786 params = wrapUnique(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteL ength(), iterations)); 790 params = wrapUnique(new WebCryptoPbkdf2Params(hash, salt.data(), salt.size() , iterations));
787 return true; 791 return true;
788 } 792 }
789 793
790 // Defined by the WebCrypto spec as: 794 // Defined by the WebCrypto spec as:
791 // 795 //
792 // dictionary AesDerivedKeyParams : Algorithm { 796 // dictionary AesDerivedKeyParams : Algorithm {
793 // [EnforceRange] required unsigned short length; 797 // [EnforceRange] required unsigned short length;
794 // }; 798 // };
795 bool parseAesDerivedKeyParams(const Dictionary& raw, std::unique_ptr<WebCryptoAl gorithmParams>& params, const ErrorContext& context, AlgorithmError* error) 799 bool parseAesDerivedKeyParams(const Dictionary& raw, std::unique_ptr<WebCryptoAl gorithmParams>& params, const ErrorContext& context, AlgorithmError* error)
796 { 800 {
(...skipping 15 matching lines...) Expand all
812 // dictionary HkdfParams : Algorithm { 816 // dictionary HkdfParams : Algorithm {
813 // required HashAlgorithmIdentifier hash; 817 // required HashAlgorithmIdentifier hash;
814 // required BufferSource salt; 818 // required BufferSource salt;
815 // required BufferSource info; 819 // required BufferSource info;
816 // }; 820 // };
817 bool parseHkdfParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmPa rams>& params, const ErrorContext& context, AlgorithmError* error) 821 bool parseHkdfParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmPa rams>& params, const ErrorContext& context, AlgorithmError* error)
818 { 822 {
819 WebCryptoAlgorithm hash; 823 WebCryptoAlgorithm hash;
820 if (!parseHash(raw, hash, context, error)) 824 if (!parseHash(raw, hash, context, error))
821 return false; 825 return false;
822 BufferSource saltBufferSource; 826 Vector<uint8_t> salt;
823 if (!getBufferSource(raw, "salt", saltBufferSource, context, error)) 827 if (!getBufferSource(raw, "salt", salt, context, error))
824 return false; 828 return false;
825 BufferSource infoBufferSource; 829 Vector<uint8_t> info;
826 if (!getBufferSource(raw, "info", infoBufferSource, context, error)) 830 if (!getBufferSource(raw, "info", info, context, error))
827 return false; 831 return false;
828 832
829 DOMArrayPiece salt(saltBufferSource); 833 params = wrapUnique(new WebCryptoHkdfParams(hash, salt.data(), salt.size(), info.data(), info.size()));
830 DOMArrayPiece info(infoBufferSource);
831
832 params = wrapUnique(new WebCryptoHkdfParams(hash, salt.bytes(), salt.byteLen gth(), info.bytes(), info.byteLength()));
833 return true; 834 return true;
834 } 835 }
835 836
836 bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType ty pe, std::unique_ptr<WebCryptoAlgorithmParams>& params, ErrorContext& context, Al gorithmError* error) 837 bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType ty pe, std::unique_ptr<WebCryptoAlgorithmParams>& params, ErrorContext& context, Al gorithmError* error)
837 { 838 {
838 switch (type) { 839 switch (type) {
839 case WebCryptoAlgorithmParamsTypeNone: 840 case WebCryptoAlgorithmParamsTypeNone:
840 return true; 841 return true;
841 case WebCryptoAlgorithmParamsTypeAesCbcParams: 842 case WebCryptoAlgorithmParamsTypeAesCbcParams:
842 context.add("AesCbcParams"); 843 context.add("AesCbcParams");
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 980 }
980 981
981 } // namespace 982 } // namespace
982 983
983 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error) 984 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error)
984 { 985 {
985 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); 986 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error);
986 } 987 }
987 988
988 } // namespace blink 989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698