haikuwebkit/Source/WebCore/crypto/mac
Chris Dumez 8021e79588 [WebCrypto] deriveBits() incorrectly throws for PBKDF2 algorithm when the password is empty
https://bugs.webkit.org/show_bug.cgi?id=227810

Reviewed by Yusuke Suzuki.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing.

* web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.https.any-expected.txt:
* web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.https.any.worker-expected.txt:

Source/WebCore:

deriveBits() was incorrectly throwing for PBKDF2 algorithm when the provided password was empty.
The reason for that was that we would pass a null key pointer to CCKeyDerivationPBKDF() in this
case and it was causing CCKeyDerivationPBKDF() to return an error, even though the key length is
0. To avoid this issue, we now pass an empty string as key to CCKeyDerivationPBKDF() instead of
a null pointer, when the length is 0.

This is causing Safari to fail subtests in the following WPT test:
- https://wpt.live/WebCryptoAPI/derive_bits_keys/pbkdf2.https.any.html?5001-6000

       Empty passwords are supported by both Chrome and Firefox.

No new tests, rebaselined existing tests.

* crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):


Canonical link: https://commits.webkit.org/239555@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279788 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-09 17:32:53 +00:00
..
CommonCryptoDERUtilities.cpp
CommonCryptoDERUtilities.h
CryptoAlgorithmAES_CBCMac.cpp
CryptoAlgorithmAES_CFBMac.cpp
CryptoAlgorithmAES_CTRMac.cpp
CryptoAlgorithmAES_GCMMac.cpp Next step toward using std::optional directly instead of through WTF::Optional typedef 2021-05-28 01:26:23 +00:00
CryptoAlgorithmAES_KWMac.cpp
CryptoAlgorithmECDHMac.cpp [WebCrypto] Support Elliptic Curve P-521 on Mac 2021-07-08 00:25:46 +00:00
CryptoAlgorithmECDSAMac.cpp [WebCrypto] Support Elliptic Curve P-521 on Mac 2021-07-08 00:25:46 +00:00
CryptoAlgorithmHKDFMac.cpp
CryptoAlgorithmHMACMac.cpp Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
CryptoAlgorithmPBKDF2Mac.cpp [WebCrypto] deriveBits() incorrectly throws for PBKDF2 algorithm when the password is empty 2021-07-09 17:32:53 +00:00
CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp
CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp
CryptoAlgorithmRSA_OAEPMac.cpp
CryptoAlgorithmRSA_PSSMac.cpp
CryptoAlgorithmRegistryMac.cpp
CryptoDigestAlgorithm.h Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
CryptoKeyECMac.cpp [WebCrypto] Support Elliptic Curve P-521 on Mac 2021-07-08 00:25:46 +00:00
CryptoKeyMac.cpp
CryptoKeyRSAMac.cpp Remove WTF::Optional synonym for std::optional, using that class template directly instead 2021-05-30 16:11:40 +00:00
CryptoUtilitiesCocoa.cpp
CryptoUtilitiesCocoa.h
SerializedCryptoKeyWrapMac.mm Use `const uint8_t*` type more consistently to store bytes in WebKit 2021-06-06 05:25:41 +00:00