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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // JsonWebKey dictionary, throw a TypeError. 450 // JsonWebKey dictionary, throw a TypeError.
451 // 451 //
452 // (2) Let keyData be the result of getting a copy of the bytes held by 452 // (2) Let keyData be the result of getting a copy of the bytes held by
453 // the keyData parameter passed to the importKey method. 453 // the keyData parameter passed to the importKey method.
454 case kWebCryptoKeyFormatRaw: 454 case kWebCryptoKeyFormatRaw:
455 case kWebCryptoKeyFormatPkcs8: 455 case kWebCryptoKeyFormatPkcs8:
456 case kWebCryptoKeyFormatSpki: 456 case kWebCryptoKeyFormatSpki:
457 if (raw_key_data.isArrayBuffer()) { 457 if (raw_key_data.isArrayBuffer()) {
458 key_data = CopyBytes(raw_key_data.getAsArrayBuffer()); 458 key_data = CopyBytes(raw_key_data.getAsArrayBuffer());
459 } else if (raw_key_data.isArrayBufferView()) { 459 } else if (raw_key_data.isArrayBufferView()) {
460 key_data = CopyBytes(raw_key_data.getAsArrayBufferView()); 460 key_data = CopyBytes(raw_key_data.getAsArrayBufferView().View());
461 } else { 461 } else {
462 result->CompleteWithError( 462 result->CompleteWithError(
463 kWebCryptoErrorTypeType, 463 kWebCryptoErrorTypeType,
464 "Key data must be a BufferSource for non-JWK formats"); 464 "Key data must be a BufferSource for non-JWK formats");
465 return promise; 465 return promise;
466 } 466 }
467 break; 467 break;
468 // 14.3.9.2: If format is equal to the string "jwk": 468 // 14.3.9.2: If format is equal to the string "jwk":
469 // 469 //
470 // (1) If the keyData parameter passed to the importKey method is not a 470 // (1) If the keyData parameter passed to the importKey method is not a
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 normalized_algorithm, base_key->Key()); 776 normalized_algorithm, base_key->Key());
777 HistogramAlgorithm(script_state->GetExecutionContext(), 777 HistogramAlgorithm(script_state->GetExecutionContext(),
778 normalized_derived_key_algorithm); 778 normalized_derived_key_algorithm);
779 Platform::Current()->Crypto()->DeriveKey( 779 Platform::Current()->Crypto()->DeriveKey(
780 normalized_algorithm, base_key->Key(), normalized_derived_key_algorithm, 780 normalized_algorithm, base_key->Key(), normalized_derived_key_algorithm,
781 key_length_algorithm, extractable, key_usages, result->Result()); 781 key_length_algorithm, extractable, key_usages, result->Result());
782 return promise; 782 return promise;
783 } 783 }
784 784
785 } // namespace blink 785 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/crypto/Crypto.cpp ('k') | third_party/WebKit/Source/modules/encoding/TextDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698