mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -155,11 +155,17 @@ function run_test() {
|
|||
|
||||
// Check for successful signing and verification.
|
||||
testVectors.forEach(function(vector) {
|
||||
// RSA signing is deterministic with PKCS#1 v1.5, or PSS with zero-length salts.
|
||||
const isDeterministic = !("saltLength" in vector.algorithm) || vector.algorithm.saltLength == 0;
|
||||
var promise = importVectorKeys(vector, ["verify"], ["sign"])
|
||||
.then(function(vectors) {
|
||||
promise_test(function(test) {
|
||||
return subtle.sign(vector.algorithm, vector.privateKey, vector.plaintext)
|
||||
.then(function(signature) {
|
||||
if (isDeterministic) {
|
||||
// If deterministic, we can check the output matches. Otherwise, we can only check it verifies.
|
||||
assert_true(equalBuffers(signature, vector.signature), "Signing did not give the expected output");
|
||||
}
|
||||
// Can we verify the new signature?
|
||||
return subtle.verify(vector.algorithm, vector.publicKey, signature, vector.plaintext)
|
||||
.then(function(is_verified) {
|
||||
|
@ -173,10 +179,10 @@ function run_test() {
|
|||
// Will a second signing give us different signature? It should for PSS with non-empty salt
|
||||
return subtle.sign(vector.algorithm, vector.privateKey, vector.plaintext)
|
||||
.then(function(signature) {
|
||||
if ("saltLength" in vector.algorithm && vector.algorithm.saltLength > 0) {
|
||||
assert_false(equalBuffers(priorSignature, signature), "Two signings with a salt give different signatures")
|
||||
} else {
|
||||
if (isDeterministic) {
|
||||
assert_true(equalBuffers(priorSignature, signature), "Two signings with empty salt give same signature")
|
||||
} else {
|
||||
assert_false(equalBuffers(priorSignature, signature), "Two signings with a salt give different signatures")
|
||||
}
|
||||
}, function(err) {
|
||||
assert_unreached("second time verify error for test " + vector.name + ": '" + err.message + "'");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue