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

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: remove unused checks 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // JsonWebKey dictionary, throw a TypeError. 448 // JsonWebKey dictionary, throw a TypeError.
449 // 449 //
450 // (2) Let keyData be the result of getting a copy of the bytes held by 450 // (2) Let keyData be the result of getting a copy of the bytes held by
451 // the keyData parameter passed to the importKey method. 451 // the keyData parameter passed to the importKey method.
452 case WebCryptoKeyFormatRaw: 452 case WebCryptoKeyFormatRaw:
453 case WebCryptoKeyFormatPkcs8: 453 case WebCryptoKeyFormatPkcs8:
454 case WebCryptoKeyFormatSpki: 454 case WebCryptoKeyFormatSpki:
455 if (rawKeyData.isArrayBuffer()) { 455 if (rawKeyData.isArrayBuffer()) {
456 keyData = copyBytes(rawKeyData.getAsArrayBuffer()); 456 keyData = copyBytes(rawKeyData.getAsArrayBuffer());
457 } else if (rawKeyData.isArrayBufferView()) { 457 } else if (rawKeyData.isArrayBufferView()) {
458 keyData = copyBytes(rawKeyData.getAsArrayBufferView()); 458 keyData = copyBytes(rawKeyData.getAsArrayBufferView().view());
459 } else { 459 } else {
460 result->completeWithError( 460 result->completeWithError(
461 WebCryptoErrorTypeType, 461 WebCryptoErrorTypeType,
462 "Key data must be a BufferSource for non-JWK formats"); 462 "Key data must be a BufferSource for non-JWK formats");
463 return promise; 463 return promise;
464 } 464 }
465 break; 465 break;
466 // 14.3.9.2: If format is equal to the string "jwk": 466 // 14.3.9.2: If format is equal to the string "jwk":
467 // 467 //
468 // (1) If the keyData parameter passed to the importKey method is not a 468 // (1) If the keyData parameter passed to the importKey method is not a
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 normalizedAlgorithm, baseKey->key()); 772 normalizedAlgorithm, baseKey->key());
773 histogramAlgorithm(scriptState->getExecutionContext(), 773 histogramAlgorithm(scriptState->getExecutionContext(),
774 normalizedDerivedKeyAlgorithm); 774 normalizedDerivedKeyAlgorithm);
775 Platform::current()->crypto()->deriveKey( 775 Platform::current()->crypto()->deriveKey(
776 normalizedAlgorithm, baseKey->key(), normalizedDerivedKeyAlgorithm, 776 normalizedAlgorithm, baseKey->key(), normalizedDerivedKeyAlgorithm,
777 keyLengthAlgorithm, extractable, keyUsages, result->result()); 777 keyLengthAlgorithm, extractable, keyUsages, result->result());
778 return promise; 778 return promise;
779 } 779 }
780 780
781 } // namespace blink 781 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698