Changeset 218030 in webkit
- Timestamp:
- Jun 9, 2017 5:08:28 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r218028 r218030 1 2017-06-09 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] Remove unsupported CryptoAlgorithmIdentifier 4 https://bugs.webkit.org/show_bug.cgi?id=173128 5 <rdar://problem/32666826> 6 7 Reviewed by Brent Fulgham. 8 9 This patch remove AES_CMAC, DH and CONCAT as they are not implemented and not recommended 10 by the spec. Hence there is no plan to support them in short term. 11 12 No change of behaviour. 13 14 * bindings/js/JSCryptoAlgorithmDictionary.cpp: 15 (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): 16 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): 17 (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): 18 (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): 19 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): 20 (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): 21 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): 22 (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): 23 (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): 24 (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): 25 * bindings/js/JSSubtleCryptoCustom.cpp: 26 (WebCore::normalizeCryptoAlgorithmParameters): 27 (WebCore::supportExportKeyThrow): 28 * bindings/js/SerializedScriptValue.cpp: 29 (WebCore::CloneSerializer::write): 30 (WebCore::CloneDeserializer::read): 31 * crypto/CryptoAlgorithmIdentifier.h: 32 * crypto/keys/CryptoKeyAES.cpp: 33 (WebCore::CryptoKeyAES::isValidAESAlgorithm): 34 1 35 2017-06-09 Daniel Bates <dabates@apple.com> 2 36 -
trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp
r215477 r218030 317 317 case CryptoAlgorithmIdentifier::AES_CBC: 318 318 return createAesCbcParams(state, value); 319 case CryptoAlgorithmIdentifier::AES_CMAC:320 319 case CryptoAlgorithmIdentifier::AES_GCM: 321 320 case CryptoAlgorithmIdentifier::AES_CFB: … … 325 324 return adoptRef(*new CryptoAlgorithmParametersDeprecated); 326 325 case CryptoAlgorithmIdentifier::HMAC: 327 case CryptoAlgorithmIdentifier::DH: 328 case CryptoAlgorithmIdentifier::SHA_1: 329 case CryptoAlgorithmIdentifier::SHA_224: 330 case CryptoAlgorithmIdentifier::SHA_256: 331 case CryptoAlgorithmIdentifier::SHA_384: 332 case CryptoAlgorithmIdentifier::SHA_512: 333 case CryptoAlgorithmIdentifier::CONCAT: 326 case CryptoAlgorithmIdentifier::SHA_1: 327 case CryptoAlgorithmIdentifier::SHA_224: 328 case CryptoAlgorithmIdentifier::SHA_256: 329 case CryptoAlgorithmIdentifier::SHA_384: 330 case CryptoAlgorithmIdentifier::SHA_512: 334 331 case CryptoAlgorithmIdentifier::HKDF: 335 332 case CryptoAlgorithmIdentifier::PBKDF2: … … 359 356 case CryptoAlgorithmIdentifier::AES_CBC: 360 357 return createAesCbcParams(state, value); 361 case CryptoAlgorithmIdentifier::AES_CMAC:362 358 case CryptoAlgorithmIdentifier::AES_GCM: 363 359 case CryptoAlgorithmIdentifier::AES_CFB: … … 367 363 return adoptRef(*new CryptoAlgorithmParametersDeprecated); 368 364 case CryptoAlgorithmIdentifier::HMAC: 369 case CryptoAlgorithmIdentifier::DH: 370 case CryptoAlgorithmIdentifier::SHA_1: 371 case CryptoAlgorithmIdentifier::SHA_224: 372 case CryptoAlgorithmIdentifier::SHA_256: 373 case CryptoAlgorithmIdentifier::SHA_384: 374 case CryptoAlgorithmIdentifier::SHA_512: 375 case CryptoAlgorithmIdentifier::CONCAT: 365 case CryptoAlgorithmIdentifier::SHA_1: 366 case CryptoAlgorithmIdentifier::SHA_224: 367 case CryptoAlgorithmIdentifier::SHA_256: 368 case CryptoAlgorithmIdentifier::SHA_384: 369 case CryptoAlgorithmIdentifier::SHA_512: 376 370 case CryptoAlgorithmIdentifier::HKDF: 377 371 case CryptoAlgorithmIdentifier::PBKDF2: … … 397 391 case CryptoAlgorithmIdentifier::AES_CTR: 398 392 case CryptoAlgorithmIdentifier::AES_CBC: 399 case CryptoAlgorithmIdentifier::AES_CMAC:400 393 case CryptoAlgorithmIdentifier::AES_GCM: 401 394 case CryptoAlgorithmIdentifier::AES_CFB: … … 405 398 case CryptoAlgorithmIdentifier::HMAC: 406 399 return createHmacParams(state, value); 407 case CryptoAlgorithmIdentifier::DH: 408 case CryptoAlgorithmIdentifier::SHA_1: 409 case CryptoAlgorithmIdentifier::SHA_224: 410 case CryptoAlgorithmIdentifier::SHA_256: 411 case CryptoAlgorithmIdentifier::SHA_384: 412 case CryptoAlgorithmIdentifier::SHA_512: 413 case CryptoAlgorithmIdentifier::CONCAT: 400 case CryptoAlgorithmIdentifier::SHA_1: 401 case CryptoAlgorithmIdentifier::SHA_224: 402 case CryptoAlgorithmIdentifier::SHA_256: 403 case CryptoAlgorithmIdentifier::SHA_384: 404 case CryptoAlgorithmIdentifier::SHA_512: 414 405 case CryptoAlgorithmIdentifier::HKDF: 415 406 case CryptoAlgorithmIdentifier::PBKDF2: … … 435 426 case CryptoAlgorithmIdentifier::AES_CTR: 436 427 case CryptoAlgorithmIdentifier::AES_CBC: 437 case CryptoAlgorithmIdentifier::AES_CMAC:438 428 case CryptoAlgorithmIdentifier::AES_GCM: 439 429 case CryptoAlgorithmIdentifier::AES_CFB: … … 443 433 case CryptoAlgorithmIdentifier::HMAC: 444 434 return createHmacParams(state, value); 445 case CryptoAlgorithmIdentifier::DH: 446 case CryptoAlgorithmIdentifier::SHA_1: 447 case CryptoAlgorithmIdentifier::SHA_224: 448 case CryptoAlgorithmIdentifier::SHA_256: 449 case CryptoAlgorithmIdentifier::SHA_384: 450 case CryptoAlgorithmIdentifier::SHA_512: 451 case CryptoAlgorithmIdentifier::CONCAT: 435 case CryptoAlgorithmIdentifier::SHA_1: 436 case CryptoAlgorithmIdentifier::SHA_224: 437 case CryptoAlgorithmIdentifier::SHA_256: 438 case CryptoAlgorithmIdentifier::SHA_384: 439 case CryptoAlgorithmIdentifier::SHA_512: 452 440 case CryptoAlgorithmIdentifier::HKDF: 453 441 case CryptoAlgorithmIdentifier::PBKDF2: … … 470 458 case CryptoAlgorithmIdentifier::AES_CTR: 471 459 case CryptoAlgorithmIdentifier::AES_CBC: 472 case CryptoAlgorithmIdentifier::AES_CMAC: 473 case CryptoAlgorithmIdentifier::AES_GCM: 474 case CryptoAlgorithmIdentifier::AES_CFB: 475 case CryptoAlgorithmIdentifier::AES_KW: 476 case CryptoAlgorithmIdentifier::HMAC: 477 case CryptoAlgorithmIdentifier::DH: 460 case CryptoAlgorithmIdentifier::AES_GCM: 461 case CryptoAlgorithmIdentifier::AES_CFB: 462 case CryptoAlgorithmIdentifier::AES_KW: 463 case CryptoAlgorithmIdentifier::HMAC: 478 464 throwNotSupportedError(state, scope); 479 465 return nullptr; … … 484 470 case CryptoAlgorithmIdentifier::SHA_512: 485 471 return adoptRef(*new CryptoAlgorithmParametersDeprecated); 486 case CryptoAlgorithmIdentifier::CONCAT:487 472 case CryptoAlgorithmIdentifier::HKDF: 488 473 case CryptoAlgorithmIdentifier::PBKDF2: … … 508 493 case CryptoAlgorithmIdentifier::AES_CTR: 509 494 case CryptoAlgorithmIdentifier::AES_CBC: 510 case CryptoAlgorithmIdentifier::AES_CMAC:511 495 case CryptoAlgorithmIdentifier::AES_GCM: 512 496 case CryptoAlgorithmIdentifier::AES_CFB: … … 515 499 case CryptoAlgorithmIdentifier::HMAC: 516 500 return createHmacKeyParams(state, value); 517 case CryptoAlgorithmIdentifier::DH: 518 case CryptoAlgorithmIdentifier::SHA_1: 519 case CryptoAlgorithmIdentifier::SHA_224: 520 case CryptoAlgorithmIdentifier::SHA_256: 521 case CryptoAlgorithmIdentifier::SHA_384: 522 case CryptoAlgorithmIdentifier::SHA_512: 523 case CryptoAlgorithmIdentifier::CONCAT: 501 case CryptoAlgorithmIdentifier::SHA_1: 502 case CryptoAlgorithmIdentifier::SHA_224: 503 case CryptoAlgorithmIdentifier::SHA_256: 504 case CryptoAlgorithmIdentifier::SHA_384: 505 case CryptoAlgorithmIdentifier::SHA_512: 524 506 case CryptoAlgorithmIdentifier::HKDF: 525 507 case CryptoAlgorithmIdentifier::PBKDF2: … … 542 524 case CryptoAlgorithmIdentifier::AES_CTR: 543 525 case CryptoAlgorithmIdentifier::AES_CBC: 544 case CryptoAlgorithmIdentifier::AES_CMAC: 545 case CryptoAlgorithmIdentifier::AES_GCM: 546 case CryptoAlgorithmIdentifier::AES_CFB: 547 case CryptoAlgorithmIdentifier::AES_KW: 548 case CryptoAlgorithmIdentifier::HMAC: 549 case CryptoAlgorithmIdentifier::DH: 550 case CryptoAlgorithmIdentifier::SHA_1: 551 case CryptoAlgorithmIdentifier::SHA_224: 552 case CryptoAlgorithmIdentifier::SHA_256: 553 case CryptoAlgorithmIdentifier::SHA_384: 554 case CryptoAlgorithmIdentifier::SHA_512: 555 case CryptoAlgorithmIdentifier::CONCAT: 526 case CryptoAlgorithmIdentifier::AES_GCM: 527 case CryptoAlgorithmIdentifier::AES_CFB: 528 case CryptoAlgorithmIdentifier::AES_KW: 529 case CryptoAlgorithmIdentifier::HMAC: 530 case CryptoAlgorithmIdentifier::SHA_1: 531 case CryptoAlgorithmIdentifier::SHA_224: 532 case CryptoAlgorithmIdentifier::SHA_256: 533 case CryptoAlgorithmIdentifier::SHA_384: 534 case CryptoAlgorithmIdentifier::SHA_512: 556 535 case CryptoAlgorithmIdentifier::HKDF: 557 536 case CryptoAlgorithmIdentifier::PBKDF2: … … 574 553 case CryptoAlgorithmIdentifier::AES_CTR: 575 554 case CryptoAlgorithmIdentifier::AES_CBC: 576 case CryptoAlgorithmIdentifier::AES_CMAC: 577 case CryptoAlgorithmIdentifier::AES_GCM: 578 case CryptoAlgorithmIdentifier::AES_CFB: 579 case CryptoAlgorithmIdentifier::AES_KW: 580 case CryptoAlgorithmIdentifier::HMAC: 581 case CryptoAlgorithmIdentifier::DH: 582 case CryptoAlgorithmIdentifier::SHA_1: 583 case CryptoAlgorithmIdentifier::SHA_224: 584 case CryptoAlgorithmIdentifier::SHA_256: 585 case CryptoAlgorithmIdentifier::SHA_384: 586 case CryptoAlgorithmIdentifier::SHA_512: 587 case CryptoAlgorithmIdentifier::CONCAT: 555 case CryptoAlgorithmIdentifier::AES_GCM: 556 case CryptoAlgorithmIdentifier::AES_CFB: 557 case CryptoAlgorithmIdentifier::AES_KW: 558 case CryptoAlgorithmIdentifier::HMAC: 559 case CryptoAlgorithmIdentifier::SHA_1: 560 case CryptoAlgorithmIdentifier::SHA_224: 561 case CryptoAlgorithmIdentifier::SHA_256: 562 case CryptoAlgorithmIdentifier::SHA_384: 563 case CryptoAlgorithmIdentifier::SHA_512: 588 564 case CryptoAlgorithmIdentifier::HKDF: 589 565 case CryptoAlgorithmIdentifier::PBKDF2: … … 607 583 case CryptoAlgorithmIdentifier::AES_CTR: 608 584 case CryptoAlgorithmIdentifier::AES_CBC: 609 case CryptoAlgorithmIdentifier::AES_CMAC:610 585 case CryptoAlgorithmIdentifier::AES_GCM: 611 586 case CryptoAlgorithmIdentifier::AES_CFB: … … 614 589 case CryptoAlgorithmIdentifier::HMAC: 615 590 return createHmacParams(state, value); 616 case CryptoAlgorithmIdentifier::DH: 591 case CryptoAlgorithmIdentifier::SHA_1: 592 case CryptoAlgorithmIdentifier::SHA_224: 593 case CryptoAlgorithmIdentifier::SHA_256: 594 case CryptoAlgorithmIdentifier::SHA_384: 595 case CryptoAlgorithmIdentifier::SHA_512: 596 case CryptoAlgorithmIdentifier::HKDF: 597 case CryptoAlgorithmIdentifier::PBKDF2: 598 throwNotSupportedError(state, scope); 599 return nullptr; 600 } 601 RELEASE_ASSERT_NOT_REACHED(); 602 return nullptr; 603 } 604 605 RefPtr<CryptoAlgorithmParametersDeprecated> JSCryptoAlgorithmDictionary::createParametersForExportKey(ExecState& state, ThrowScope& scope, CryptoAlgorithmIdentifier algorithm, JSValue) 606 { 607 switch (algorithm) { 608 case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5: 609 case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5: 610 case CryptoAlgorithmIdentifier::RSA_PSS: 611 case CryptoAlgorithmIdentifier::RSA_OAEP: 612 case CryptoAlgorithmIdentifier::ECDSA: 613 case CryptoAlgorithmIdentifier::ECDH: 614 case CryptoAlgorithmIdentifier::AES_CTR: 615 case CryptoAlgorithmIdentifier::AES_CBC: 616 case CryptoAlgorithmIdentifier::AES_GCM: 617 case CryptoAlgorithmIdentifier::AES_CFB: 618 case CryptoAlgorithmIdentifier::AES_KW: 619 case CryptoAlgorithmIdentifier::HMAC: 617 620 return adoptRef(*new CryptoAlgorithmParametersDeprecated); 618 621 case CryptoAlgorithmIdentifier::SHA_1: … … 621 624 case CryptoAlgorithmIdentifier::SHA_384: 622 625 case CryptoAlgorithmIdentifier::SHA_512: 623 case CryptoAlgorithmIdentifier::CONCAT:624 case CryptoAlgorithmIdentifier::HKDF:625 case CryptoAlgorithmIdentifier::PBKDF2:626 throwNotSupportedError(state, scope);627 return nullptr;628 }629 RELEASE_ASSERT_NOT_REACHED();630 return nullptr;631 }632 633 RefPtr<CryptoAlgorithmParametersDeprecated> JSCryptoAlgorithmDictionary::createParametersForExportKey(ExecState& state, ThrowScope& scope, CryptoAlgorithmIdentifier algorithm, JSValue)634 {635 switch (algorithm) {636 case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:637 case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:638 case CryptoAlgorithmIdentifier::RSA_PSS:639 case CryptoAlgorithmIdentifier::RSA_OAEP:640 case CryptoAlgorithmIdentifier::ECDSA:641 case CryptoAlgorithmIdentifier::ECDH:642 case CryptoAlgorithmIdentifier::AES_CTR:643 case CryptoAlgorithmIdentifier::AES_CBC:644 case CryptoAlgorithmIdentifier::AES_CMAC:645 case CryptoAlgorithmIdentifier::AES_GCM:646 case CryptoAlgorithmIdentifier::AES_CFB:647 case CryptoAlgorithmIdentifier::AES_KW:648 case CryptoAlgorithmIdentifier::HMAC:649 case CryptoAlgorithmIdentifier::DH:650 return adoptRef(*new CryptoAlgorithmParametersDeprecated);651 case CryptoAlgorithmIdentifier::SHA_1:652 case CryptoAlgorithmIdentifier::SHA_224:653 case CryptoAlgorithmIdentifier::SHA_256:654 case CryptoAlgorithmIdentifier::SHA_384:655 case CryptoAlgorithmIdentifier::SHA_512:656 case CryptoAlgorithmIdentifier::CONCAT:657 626 case CryptoAlgorithmIdentifier::HKDF: 658 627 case CryptoAlgorithmIdentifier::PBKDF2: -
trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
r217433 r218030 206 206 case CryptoAlgorithmIdentifier::AES_CTR: 207 207 case CryptoAlgorithmIdentifier::AES_CBC: 208 case CryptoAlgorithmIdentifier::AES_CMAC:209 208 case CryptoAlgorithmIdentifier::AES_GCM: 210 209 case CryptoAlgorithmIdentifier::AES_CFB: … … 288 287 case CryptoAlgorithmIdentifier::AES_CTR: 289 288 case CryptoAlgorithmIdentifier::AES_CBC: 290 case CryptoAlgorithmIdentifier::AES_CMAC:291 289 case CryptoAlgorithmIdentifier::AES_GCM: 292 290 case CryptoAlgorithmIdentifier::AES_CFB: … … 333 331 case CryptoAlgorithmIdentifier::AES_CTR: 334 332 case CryptoAlgorithmIdentifier::AES_CBC: 335 case CryptoAlgorithmIdentifier::AES_CMAC:336 333 case CryptoAlgorithmIdentifier::AES_GCM: 337 334 case CryptoAlgorithmIdentifier::AES_CFB: … … 510 507 case CryptoAlgorithmIdentifier::AES_CTR: 511 508 case CryptoAlgorithmIdentifier::AES_CBC: 512 case CryptoAlgorithmIdentifier::AES_CMAC:513 509 case CryptoAlgorithmIdentifier::AES_GCM: 514 510 case CryptoAlgorithmIdentifier::AES_CFB: -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r217052 r218030 231 231 AES_CTR = 6, 232 232 AES_CBC = 7, 233 AES_CMAC = 8, 234 AES_GCM = 9, 235 AES_CFB = 10, 236 AES_KW = 11, 237 HMAC = 12, 238 DH = 13, 239 SHA_1 = 14, 240 SHA_224 = 15, 241 SHA_256 = 16, 242 SHA_384 = 17, 243 SHA_512 = 18, 244 CONCAT = 19, 245 HKDF = 20, 246 PBKDF2 = 21, 233 AES_GCM = 8, 234 AES_CFB = 9, 235 AES_KW = 10, 236 HMAC = 11, 237 SHA_1 = 12, 238 SHA_224 = 13, 239 SHA_256 = 14, 240 SHA_384 = 15, 241 SHA_512 = 16, 242 HKDF = 17, 243 PBKDF2 = 18, 247 244 }; 248 245 const uint8_t cryptoAlgorithmIdentifierTagMaximumValue = 21; … … 1138 1135 write(CryptoAlgorithmIdentifierTag::AES_CBC); 1139 1136 break; 1140 case CryptoAlgorithmIdentifier::AES_CMAC:1141 write(CryptoAlgorithmIdentifierTag::AES_CMAC);1142 break;1143 1137 case CryptoAlgorithmIdentifier::AES_GCM: 1144 1138 write(CryptoAlgorithmIdentifierTag::AES_GCM); … … 1153 1147 write(CryptoAlgorithmIdentifierTag::HMAC); 1154 1148 break; 1155 case CryptoAlgorithmIdentifier::DH:1156 write(CryptoAlgorithmIdentifierTag::DH);1157 break;1158 1149 case CryptoAlgorithmIdentifier::SHA_1: 1159 1150 write(CryptoAlgorithmIdentifierTag::SHA_1); … … 1170 1161 case CryptoAlgorithmIdentifier::SHA_512: 1171 1162 write(CryptoAlgorithmIdentifierTag::SHA_512); 1172 break;1173 case CryptoAlgorithmIdentifier::CONCAT:1174 write(CryptoAlgorithmIdentifierTag::CONCAT);1175 1163 break; 1176 1164 case CryptoAlgorithmIdentifier::HKDF: … … 2040 2028 result = CryptoAlgorithmIdentifier::AES_CBC; 2041 2029 break; 2042 case CryptoAlgorithmIdentifierTag::AES_CMAC:2043 result = CryptoAlgorithmIdentifier::AES_CMAC;2044 break;2045 2030 case CryptoAlgorithmIdentifierTag::AES_GCM: 2046 2031 result = CryptoAlgorithmIdentifier::AES_GCM; … … 2055 2040 result = CryptoAlgorithmIdentifier::HMAC; 2056 2041 break; 2057 case CryptoAlgorithmIdentifierTag::DH:2058 result = CryptoAlgorithmIdentifier::DH;2059 break;2060 2042 case CryptoAlgorithmIdentifierTag::SHA_1: 2061 2043 result = CryptoAlgorithmIdentifier::SHA_1; … … 2072 2054 case CryptoAlgorithmIdentifierTag::SHA_512: 2073 2055 result = CryptoAlgorithmIdentifier::SHA_512; 2074 break;2075 case CryptoAlgorithmIdentifierTag::CONCAT:2076 result = CryptoAlgorithmIdentifier::CONCAT;2077 2056 break; 2078 2057 case CryptoAlgorithmIdentifierTag::HKDF: -
trunk/Source/WebCore/crypto/CryptoAlgorithmIdentifier.h
r215382 r218030 39 39 AES_CTR, 40 40 AES_CBC, 41 AES_CMAC,42 41 AES_GCM, 43 42 AES_CFB, 44 43 AES_KW, 45 44 HMAC, 46 DH,47 45 SHA_1, 48 46 SHA_224, … … 50 48 SHA_384, 51 49 SHA_512, 52 CONCAT,53 50 HKDF, 54 51 PBKDF2 -
trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp
r213628 r218030 67 67 return algorithm == CryptoAlgorithmIdentifier::AES_CTR 68 68 || algorithm == CryptoAlgorithmIdentifier::AES_CBC 69 || algorithm == CryptoAlgorithmIdentifier::AES_CMAC70 69 || algorithm == CryptoAlgorithmIdentifier::AES_GCM 71 70 || algorithm == CryptoAlgorithmIdentifier::AES_CFB
Note: See TracChangeset
for help on using the changeset viewer.