Backed out changeset dc1d2b9d698b (bug 1285986) for causing wpt failures on aes_cbc.https.any.worker.html CLOSED TREE

This commit is contained in:
Cristian Tuns 2022-10-12 18:09:04 -04:00
Родитель c815815081
Коммит d531f63b7c
2 изменённых файлов: 32 добавлений и 77 удалений

Просмотреть файл

@ -506,7 +506,7 @@ class AesTask : public ReturnArrayBufferViewTask, public DeferredData {
ATTEMPT_BUFFER_INIT(mIv, params.mIv)
if (mIv.Length() != 16) {
mEarlyRv = NS_ERROR_DOM_OPERATION_ERR;
mEarlyRv = NS_ERROR_DOM_DATA_ERR;
return;
}
} else if (algName.EqualsLiteral(WEBCRYPTO_ALG_AES_CTR)) {
@ -523,7 +523,7 @@ class AesTask : public ReturnArrayBufferViewTask, public DeferredData {
ATTEMPT_BUFFER_INIT(mIv, params.mCounter)
if (mIv.Length() != 16) {
mEarlyRv = NS_ERROR_DOM_OPERATION_ERR;
mEarlyRv = NS_ERROR_DOM_DATA_ERR;
return;
}

Просмотреть файл

@ -517,27 +517,17 @@ TestArray.addTest(
x, tv.aes_cbc_enc.data);
}
function checkPromises(promises) {
for (var promise of promises) {
if (promise.status != "rejected") {
return false;
}
if (promise.reason.name != "OperationError") {
return false;
}
}
return true;
function doEncrypt(x) {
return encrypt(x, new Uint8Array(15))
.catch(function() { return encrypt(new Uint8Array(17)); });
}
crypto.subtle.importKey("raw", tv.aes_cbc_enc.key, "AES-CBC", false, ["encrypt"])
.then(function(key) {
var p1 = encrypt(key, new Uint8Array(15));
var p2 = encrypt(key, new Uint8Array(17));
Promise.allSettled([p1, p2])
.then(complete(that, checkPromises));
});
.then(doEncrypt)
.then(
error(that),
complete(that)
);
}
);
@ -574,27 +564,17 @@ TestArray.addTest(
x, tv.aes_cbc_dec.data);
}
function checkPromises(promises) {
for (var promise of promises) {
if (promise.status != "rejected") {
return false;
}
if (promise.reason.name != "OperationError") {
return false;
}
}
return true;
function doDecrypt(x) {
return decrypt(x, new Uint8Array(15))
.catch(function() { return decrypt(x, new Uint8Array(17)); });
}
crypto.subtle.importKey("raw", tv.aes_cbc_dec.key, "AES-CBC", false, ["decrypt"])
.then(function(key) {
var p1 = decrypt(key, new Uint8Array(15));
var p2 = decrypt(key, new Uint8Array(17));
Promise.allSettled([p1, p2])
.then(complete(that, checkPromises));
});
.then(doDecrypt)
.then(
error(that),
complete(that)
);
}
);
@ -631,27 +611,17 @@ TestArray.addTest(
x, tv.aes_ctr_enc.data);
}
function checkPromises(promises) {
for (var promise of promises) {
if (promise.status != "rejected") {
return false;
}
if (promise.reason.name != "OperationError") {
return false;
}
}
return true;
function doEncrypt(x) {
return encrypt(x, new Uint8Array(15))
.catch(function() { return encrypt(x, new Uint8Array(17)); });
}
crypto.subtle.importKey("raw", tv.aes_ctr_enc.key, "AES-CTR", false, ["encrypt"])
.then(function(key) {
var p1 = encrypt(key, new Uint8Array(15));
var p2 = encrypt(key, new Uint8Array(17));
Promise.allSettled([p1, p2])
.then(complete(that, checkPromises));
});
.then(doEncrypt)
.then(
error(that),
complete(that)
);
}
);
@ -682,33 +652,18 @@ TestArray.addTest(
function() {
var that = this;
function decrypt(x, iv) {
function doDecrypt(x, iv) {
return crypto.subtle.decrypt(
{ name: "AES-CTR", counter: iv, length: 32 },
x, tv.aes_ctr_dec.data);
}
function checkPromises(promises) {
for (var promise of promises) {
if (promise.status != "rejected") {
return false;
}
if (promise.reason.name != "OperationError") {
return false;
}
}
return true;
}
crypto.subtle.importKey("raw", tv.aes_ctr_dec.key, "AES-CTR", false, ["decrypt"])
.then(function(key) {
var p1 = decrypt(key, new Uint8Array(15));
var p2 = decrypt(key, new Uint8Array(17));
Promise.allSettled([p1, p2])
.then(complete(that, checkPromises));
});
.then(doDecrypt)
.then(
error(that),
complete(that)
);
}
);