Repository navigation
script: Expand supports() validation coverage in WebCrypto - #47545
Conversation
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
| // Step 2. | ||
| // Step 2. Let keyData be the key data to be imported. | ||
|
|
||
| // Step 3. |
There was a problem hiding this comment.
Do you mind putting the spec text here as well?
There was a problem hiding this comment.
https://w3c.github.io/webcrypto/#ecdsa-operations-import-key
Step 3 consists of a long list of sub-steps, which are already included below. (However, the if-clauses of step 3 are missing, and I added them right above each match-arms.)
| public_exponent | ||
| .iter() | ||
| .skip_while(|byte| **byte == 0) | ||
| .all(|byte| *byte == 255) |
There was a problem hiding this comment.
Does this work for values of modulus_length isn't a multiple of 8?
There was a problem hiding this comment.
Nice finding! It won't work when modulus_length is not a multiple of 8.
I rewrote this part. Now we don't calculate the public exponent length in bits. This implementation should be more straightforward.
TIL: we can get 255u8 by 0u8.wrapping_sub(1).
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
…7545) WebCrypto API specification has updated some cryptography operations in order to expand `supports()` validation coverage. We follow the updates. The update basically consists of moving all parameter validation to the beginning of the operations, and adding some new parameter validation which were done implicitly. Therefore, these operations should not have observable changes from user perspective. Meanwhile, since the actually implementation of Step 8 of the **check support for an algorithm** algorithm is based on how these operations are written, and it follows the above changes, the `supports()` method, which relies on the **check support for an algorithm** algorithm, improves its validation coverage. We also update our comment next to Step 8 based on the discussion in WICG/webcrypto-modern-algos#74. Spec Update: w3c/webcrypto#558 WPT Update: web-platform-tests/wpt#62115 Testing: Pass more WPT tests. --------- Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
…7545) WebCrypto API specification has updated some cryptography operations in order to expand `supports()` validation coverage. We follow the updates. The update basically consists of moving all parameter validation to the beginning of the operations, and adding some new parameter validation which were done implicitly. Therefore, these operations should not have observable changes from user perspective. Meanwhile, since the actually implementation of Step 8 of the **check support for an algorithm** algorithm is based on how these operations are written, and it follows the above changes, the `supports()` method, which relies on the **check support for an algorithm** algorithm, improves its validation coverage. We also update our comment next to Step 8 based on the discussion in WICG/webcrypto-modern-algos#74. Spec Update: w3c/webcrypto#558 WPT Update: web-platform-tests/wpt#62115 Testing: Pass more WPT tests. --------- Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
WebCrypto API specification has updated some cryptography operations in order to expand
supports()validation coverage. We follow the updates.The update basically consists of moving all parameter validation to the beginning of the operations, and adding some new parameter validation which were done implicitly. Therefore, these operations should not have observable changes from user perspective.
Meanwhile, since the actually implementation of Step 8 of the check support for an algorithm algorithm is based on how these operations are written, and it follows the above changes, the
supports()method, which relies on the check support for an algorithm algorithm, improves its validation coverage.We also update our comment next to Step 8 based on the discussion in WICG/webcrypto-modern-algos#74.
Spec Update: w3c/webcrypto#558
WPT Update: web-platform-tests/wpt#62115
Testing: Pass more WPT tests.