Backed out changeset d8f0ba47e216 (bug 1919532) for causing failures at test_WebCrypto_ECDH.html. CLOSED TREE

This commit is contained in:
Butkovits Atila 2024-10-03 13:12:51 +03:00
parent b3dbc4b895
commit 296c17ac65
3 changed files with 5772 additions and 8 deletions

View File

@ -1599,12 +1599,12 @@ class ImportSymmetricKeyTask : public ImportKeyTask {
mAlgName.EqualsLiteral(WEBCRYPTO_ALG_AES_KW)) {
if (mKey->HasUsageOtherThan(CryptoKey::ENCRYPT | CryptoKey::DECRYPT |
CryptoKey::WRAPKEY | CryptoKey::UNWRAPKEY)) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_AES_KW) &&
mKey->HasUsageOtherThan(CryptoKey::WRAPKEY | CryptoKey::UNWRAPKEY)) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
if ((length != 128) && (length != 192) && (length != 256)) {
@ -1620,7 +1620,7 @@ class ImportSymmetricKeyTask : public ImportKeyTask {
mAlgName.EqualsLiteral(WEBCRYPTO_ALG_PBKDF2)) {
if (mKey->HasUsageOtherThan(CryptoKey::DERIVEKEY |
CryptoKey::DERIVEBITS)) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
mKey->Algorithm().MakeKDF(mAlgName);
@ -1630,7 +1630,7 @@ class ImportSymmetricKeyTask : public ImportKeyTask {
};
} else if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_HMAC)) {
if (mKey->HasUsageOtherThan(CryptoKey::SIGN | CryptoKey::VERIFY)) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
mKey->Algorithm().MakeHmac(length, mHashName);
@ -1808,7 +1808,7 @@ class ImportRsaKeyTask : public ImportKeyTask {
(mKey->GetKeyType() == CryptoKey::PRIVATE &&
mKey->HasUsageOtherThan(CryptoKey::DECRYPT |
CryptoKey::UNWRAPKEY))) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
} else if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_RSASSA_PKCS1) ||
mAlgName.EqualsLiteral(WEBCRYPTO_ALG_RSA_PSS)) {
@ -1816,7 +1816,7 @@ class ImportRsaKeyTask : public ImportKeyTask {
mKey->HasUsageOtherThan(CryptoKey::VERIFY)) ||
(mKey->GetKeyType() == CryptoKey::PRIVATE &&
mKey->HasUsageOtherThan(CryptoKey::SIGN))) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
}
@ -2000,7 +2000,7 @@ class ImportEcKeyTask : public ImportKeyTask {
uint32_t privateAllowedUsages = 0, publicAllowedUsages = 0;
if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_ECDH)) {
privateAllowedUsages = CryptoKey::DERIVEBITS | CryptoKey::DERIVEKEY;
publicAllowedUsages = 0;
publicAllowedUsages = CryptoKey::DERIVEBITS | CryptoKey::DERIVEKEY;
} else if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_ECDSA)) {
privateAllowedUsages = CryptoKey::SIGN;
publicAllowedUsages = CryptoKey::VERIFY;
@ -2011,7 +2011,7 @@ class ImportEcKeyTask : public ImportKeyTask {
mKey->HasUsageOtherThan(privateAllowedUsages)) ||
(mKey->GetKeyType() == CryptoKey::PUBLIC &&
mKey->HasUsageOtherThan(publicAllowedUsages))) {
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_ERROR_DOM_DATA_ERR;
}
if (mKey->GetKeyType() == CryptoKey::PRIVATE && !mKey->HasAnyUsage()) {