Changeset 159966 in webkit
- Timestamp:
- Dec 2, 2013, 2:36:07 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159954 r159966 1 2013-12-02 Alexey Proskuryakov <ap@apple.com> 2 3 Support WebCrypto AES-KW 4 https://bugs.webkit.org/show_bug.cgi?id=125105 5 6 Reviewed by Sam Weinig. 7 8 * crypto/subtle/aes-kw-key-manipulation-expected.txt: Added. 9 * crypto/subtle/aes-kw-key-manipulation.html: Added. 10 * crypto/subtle/aes-kw-wrap-unwrap-aes-expected.txt: Added. 11 * crypto/subtle/aes-kw-wrap-unwrap-aes.html: Added. 12 1 13 2013-12-02 Rob Buis <rob.buis@samsung.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r159960 r159966 1 2013-12-02 Alexey Proskuryakov <ap@apple.com> 2 3 Support WebCrypto AES-KW 4 https://bugs.webkit.org/show_bug.cgi?id=125105 5 6 Reviewed by Sam Weinig. 7 8 Tests: crypto/subtle/aes-kw-key-manipulation.html 9 crypto/subtle/aes-kw-wrap-unwrap-aes.html 10 11 * WebCore.xcodeproj/project.pbxproj: Added new files. 12 13 * crypto/CryptoAlgorithmIdentifier.h: (WebCore::CryptoAlgorithmIdentifier): Added AES-KW. 14 It's not standardized yet, but there appears to be a consensus that it will be specified. 15 16 * bindings/js/JSCryptoAlgorithmDictionary.cpp: 17 (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): 18 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): 19 (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): 20 (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): 21 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): 22 (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): 23 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): 24 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): 25 (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): 26 (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): 27 Added AES-KW cases everywhere. 28 29 * bindings/js/JSCryptoKeySerializationJWK.cpp: 30 (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): 31 (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): 32 (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): 33 Support importing/exporting AES-KW keys in JWK. 34 35 * bindings/js/JSSubtleCryptoCustom.cpp: 36 (WebCore::JSSubtleCrypto::importKey): 37 (WebCore::JSSubtleCrypto::exportKey): 38 (WebCore::JSSubtleCrypto::wrapKey): 39 (WebCore::JSSubtleCrypto::unwrapKey): 40 Added some accidentally forgotten std::moves. 41 42 * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: Added. 43 * crypto/algorithms/CryptoAlgorithmAES_KW.h: Added. 44 * crypto/mac/CryptoAlgorithmAES_KWMac.cpp: Added. 45 46 * crypto/keys/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::CryptoKeyAES): Allow AES-KW 47 as valid algorithm for AES keys. 48 49 * crypto/mac/CryptoAlgorithmRegistryMac.cpp: 50 (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register AES-KW. 51 1 52 2013-12-02 Beth Dakin <bdakin@apple.com> 2 53 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r159949 r159966 5735 5735 E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */; }; 5736 5736 E1FE1377184D1E3300892F13 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE1376184D1E3300892F13 /* CryptoAlgorithmRsaOaepParams.h */; }; 5737 E1FE137A184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE1378184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp */; }; 5738 E1FE137B184D21BB00892F13 /* CryptoAlgorithmAES_KW.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE1379184D21BB00892F13 /* CryptoAlgorithmAES_KW.h */; }; 5739 E1FE137E184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE137C184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp */; }; 5737 5740 E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5738 5741 E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */; }; … … 12861 12864 E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoUtilities.h; sourceTree = "<group>"; }; 12862 12865 E1FE1376184D1E3300892F13 /* CryptoAlgorithmRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoAlgorithmRsaOaepParams.h; path = parameters/CryptoAlgorithmRsaOaepParams.h; sourceTree = "<group>"; }; 12866 E1FE1378184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_KW.cpp; sourceTree = "<group>"; }; 12867 E1FE1379184D21BB00892F13 /* CryptoAlgorithmAES_KW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAES_KW.h; sourceTree = "<group>"; }; 12868 E1FE137C184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoAlgorithmAES_KWMac.cpp; path = mac/CryptoAlgorithmAES_KWMac.cpp; sourceTree = "<group>"; }; 12863 12869 E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadGlobalData.h; sourceTree = "<group>"; }; 12864 12870 E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGlobalData.cpp; sourceTree = "<group>"; }; … … 20422 20428 E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */, 20423 20429 E125F843182425C900D84CD9 /* CryptoAlgorithmAES_CBCMac.cpp */, 20430 E1FE137C184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp */, 20424 20431 E125F8371822F1EB00D84CD9 /* CryptoAlgorithmHMACMac.cpp */, 20425 20432 E1BB84AC1822CA7400525043 /* CryptoAlgorithmRegistryMac.cpp */, … … 20438 20445 E125F83F1824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp */, 20439 20446 E125F8401824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h */, 20447 E1FE1378184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp */, 20448 E1FE1379184D21BB00892F13 /* CryptoAlgorithmAES_KW.h */, 20440 20449 E125F82F1822F11B00D84CD9 /* CryptoAlgorithmHMAC.cpp */, 20441 20450 E125F8301822F11B00D84CD9 /* CryptoAlgorithmHMAC.h */, … … 24327 24336 1A3586E015264C450022A659 /* RenderMultiColumnFlowThread.h in Headers */, 24328 24337 BCE32B9C1517C0B200F542EC /* RenderMultiColumnSet.h in Headers */, 24338 E1FE137B184D21BB00892F13 /* CryptoAlgorithmAES_KW.h in Headers */, 24329 24339 BC85F23D151915E000BC17BE /* RenderNamedFlowThread.h in Headers */, 24330 24340 BCEA4880097D93020094C9E4 /* RenderObject.h in Headers */, … … 25637 25647 512DD8FA0D91E6AF000F89EE /* ArchiveFactory.cpp in Sources */, 25638 25648 512DD8FB0D91E6AF000F89EE /* ArchiveResource.cpp in Sources */, 25649 E1FE137A184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp in Sources */, 25639 25650 512DD8F70D91E6AF000F89EE /* ArchiveResourceCollection.cpp in Sources */, 25640 25651 49B3760C15C6C6840059131D /* ArrayValue.cpp in Sources */, … … 28295 28306 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */, 28296 28307 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */, 28308 E1FE137E184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp in Sources */, 28297 28309 51059DDD1820B17600DFF9B1 /* IDBTransactionBackendOperations.cpp in Sources */, 28298 28310 F3820896147D35F90010BC06 /* WorkerConsoleAgent.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp
r159944 r159966 330 330 setDOMException(exec, NOT_SUPPORTED_ERR); 331 331 return nullptr; 332 case CryptoAlgorithmIdentifier::AES_KW: 333 return std::make_unique<CryptoAlgorithmParameters>(); 332 334 } 333 335 } … … 365 367 setDOMException(exec, NOT_SUPPORTED_ERR); 366 368 return nullptr; 369 case CryptoAlgorithmIdentifier::AES_KW: 370 return std::make_unique<CryptoAlgorithmParameters>(); 367 371 } 368 372 } … … 398 402 case CryptoAlgorithmIdentifier::HKDF_CTR: 399 403 case CryptoAlgorithmIdentifier::PBKDF2: 404 case CryptoAlgorithmIdentifier::AES_KW: 400 405 setDOMException(exec, NOT_SUPPORTED_ERR); 401 406 return nullptr; … … 433 438 case CryptoAlgorithmIdentifier::HKDF_CTR: 434 439 case CryptoAlgorithmIdentifier::PBKDF2: 440 case CryptoAlgorithmIdentifier::AES_KW: 435 441 setDOMException(exec, NOT_SUPPORTED_ERR); 436 442 return nullptr; … … 465 471 case CryptoAlgorithmIdentifier::HKDF_CTR: 466 472 case CryptoAlgorithmIdentifier::PBKDF2: 473 case CryptoAlgorithmIdentifier::AES_KW: 467 474 setDOMException(exec, NOT_SUPPORTED_ERR); 468 475 return nullptr; … … 501 508 setDOMException(exec, NOT_SUPPORTED_ERR); 502 509 return nullptr; 510 case CryptoAlgorithmIdentifier::AES_KW: 511 return createAesKeyGenParams(exec, value); 503 512 } 504 513 } … … 528 537 case CryptoAlgorithmIdentifier::HKDF_CTR: 529 538 case CryptoAlgorithmIdentifier::PBKDF2: 539 case CryptoAlgorithmIdentifier::AES_KW: 530 540 setDOMException(exec, NOT_SUPPORTED_ERR); 531 541 return nullptr; … … 557 567 case CryptoAlgorithmIdentifier::HKDF_CTR: 558 568 case CryptoAlgorithmIdentifier::PBKDF2: 569 case CryptoAlgorithmIdentifier::AES_KW: 559 570 setDOMException(exec, NOT_SUPPORTED_ERR); 560 571 return nullptr; … … 595 606 setDOMException(exec, NOT_SUPPORTED_ERR); 596 607 return nullptr; 608 case CryptoAlgorithmIdentifier::AES_KW: 609 return std::make_unique<CryptoAlgorithmParameters>(); 597 610 } 598 611 } … … 625 638 setDOMException(exec, NOT_SUPPORTED_ERR); 626 639 return nullptr; 640 case CryptoAlgorithmIdentifier::AES_KW: 641 return std::make_unique<CryptoAlgorithmParameters>(); 627 642 } 628 643 } -
trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp
r159944 r159966 203 203 algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::AES_CBC); 204 204 parameters = std::make_unique<CryptoAlgorithmParameters>(); 205 } else if (m_jwkAlgorithmName == "A128KW") { 206 algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::AES_KW); 207 parameters = std::make_unique<CryptoAlgorithmParameters>(); 208 } else if (m_jwkAlgorithmName == "A192KW") { 209 algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::AES_KW); 210 parameters = std::make_unique<CryptoAlgorithmParameters>(); 211 } else if (m_jwkAlgorithmName == "A256KW") { 212 algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::AES_KW); 213 parameters = std::make_unique<CryptoAlgorithmParameters>(); 205 214 } else { 206 215 throwTypeError(m_exec, "Unsupported JWK algorithm " + m_jwkAlgorithmName); … … 282 291 if (m_jwkAlgorithmName == "A256CBC") 283 292 return sizeInBits == 256; 293 if (m_jwkAlgorithmName == "A128KW") 294 return sizeInBits == 128; 295 if (m_jwkAlgorithmName == "A192KW") 296 return sizeInBits == 192; 297 if (m_jwkAlgorithmName == "A256KW") 298 return sizeInBits == 256; 284 299 if (m_jwkAlgorithmName == "RS256") 285 300 return sizeInBits >= 2048; … … 523 538 } 524 539 break; 540 case CryptoAlgorithmIdentifier::AES_KW: 541 switch (toCryptoKeyAES(key).key().size() * 8) { 542 case 128: 543 jwkAlgorithm = "A128KW"; 544 break; 545 case 192: 546 jwkAlgorithm = "A192KW"; 547 break; 548 case 256: 549 jwkAlgorithm = "A256KW"; 550 break; 551 } 552 break; 525 553 case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5: { 526 554 const CryptoKeyRSA& rsaKey = toCryptoKeyRSA(key); -
trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
r159644 r159966 557 557 }; 558 558 559 WebCore::importKey(exec, keyFormat, data, algorithm.release(), parameters.release(), extractable, keyUsages, s uccessCallback, failureCallback);559 WebCore::importKey(exec, keyFormat, data, algorithm.release(), parameters.release(), extractable, keyUsages, std::move(successCallback), std::move(failureCallback)); 560 560 if (exec->hadException()) 561 561 return jsUndefined(); … … 621 621 }; 622 622 623 WebCore::exportKey(exec, keyFormat, *key, s uccessCallback, failureCallback);623 WebCore::exportKey(exec, keyFormat, *key, std::move(successCallback), std::move(failureCallback)); 624 624 if (exec->hadException()) 625 625 return jsUndefined(); … … 688 688 689 689 ExceptionCode ec = 0; 690 WebCore::exportKey(exec, keyFormat, *key, exportSuccessCallback, exportFailureCallback);690 WebCore::exportKey(exec, keyFormat, *key, std::move(exportSuccessCallback), std::move(exportFailureCallback)); 691 691 if (ec) { 692 692 setDOMException(exec, ec); … … 782 782 }; 783 783 ExecState* exec = domGlobalObject->globalExec(); 784 WebCore::importKey(exec, keyFormat, std::make_pair(result.data(), result.size()), unwrappedKeyAlgorithmPtr, unwrappedKeyAlgorithmParametersPtr, extractable, keyUsages, importSuccessCallback, importFailureCallback);784 WebCore::importKey(exec, keyFormat, std::make_pair(result.data(), result.size()), unwrappedKeyAlgorithmPtr, unwrappedKeyAlgorithmParametersPtr, extractable, keyUsages, std::move(importSuccessCallback), std::move(importFailureCallback)); 785 785 if (exec->hadException()) { 786 786 // FIXME: Report exception details to console, and possibly to calling script once there is a standardized way to pass errors to WebCrypto promise reject functions. -
trunk/Source/WebCore/crypto/CryptoAlgorithmIdentifier.h
r158236 r159966 52 52 CONCAT, 53 53 HKDF_CTR, 54 PBKDF2 54 PBKDF2, 55 AES_KW // Not yet standardized. 55 56 }; 56 57 -
trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp
r159390 r159966 44 44 || algorithm == CryptoAlgorithmIdentifier::AES_CMAC 45 45 || algorithm == CryptoAlgorithmIdentifier::AES_GCM 46 || algorithm == CryptoAlgorithmIdentifier::AES_CFB); 46 || algorithm == CryptoAlgorithmIdentifier::AES_CFB 47 || algorithm == CryptoAlgorithmIdentifier::AES_KW); 47 48 } 48 49 -
trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp
r159944 r159966 30 30 31 31 #include "CryptoAlgorithmAES_CBC.h" 32 #include "CryptoAlgorithmAES_KW.h" 32 33 #include "CryptoAlgorithmHMAC.h" 33 34 #include "CryptoAlgorithmRSASSA_PKCS1_v1_5.h" … … 44 45 { 45 46 registerAlgorithm<CryptoAlgorithmAES_CBC>(); 47 registerAlgorithm<CryptoAlgorithmAES_KW>(); 46 48 registerAlgorithm<CryptoAlgorithmHMAC>(); 47 49 registerAlgorithm<CryptoAlgorithmRSASSA_PKCS1_v1_5>();
Note:
See TracChangeset
for help on using the changeset viewer.