LibWeb: Correct WebCryptoAPI derive length behaviour

Fixes multiple slightly wrong behaviours of the `deriveBits` method
across various algorithms. Some of them might be due to a spec update.

Add tests related to fixes.
This commit is contained in:
devgianlu 2024-12-17 16:22:09 +01:00 committed by Jelle Raaijmakers
commit f3a9bb0a91
Notes: github-actions[bot] 2024-12-18 12:19:39 +00:00
9 changed files with 217 additions and 27 deletions

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 18 tests
17 Pass
1 Fail
18 Pass
Pass setup - define tests
Pass X448 key derivation checks for all-zero value result with a key of order 0
Pass X448 key derivation checks for all-zero value result with a key of order 1
@ -13,7 +12,7 @@ Pass X448 key derivation checks for all-zero value result with a key of order p+
Pass X448 good parameters
Pass X448 mixed case parameters
Pass X448 short result
Fail X448 non-multiple of 8 bits
Pass X448 non-multiple of 8 bits
Pass X448 missing public property
Pass X448 public property of algorithm is not a CryptoKey
Pass X448 mismatched algorithms

View file

@ -0,0 +1,34 @@
Harness status: OK
Found 29 tests
29 Pass
Pass setup - define tests
Pass HKDF derivation with 256 as 'length' parameter
Pass HKDF derivation with 384 as 'length' parameter
Pass HKDF derivation with 230 as 'length' parameter
Pass HKDF derivation with 0 as 'length' parameter
Pass HKDF derivation with null as 'length' parameter
Pass HKDF derivation with undefined as 'length' parameter
Pass HKDF derivation with omitted as 'length' parameter
Pass PBKDF2 derivation with 256 as 'length' parameter
Pass PBKDF2 derivation with 384 as 'length' parameter
Pass PBKDF2 derivation with 230 as 'length' parameter
Pass PBKDF2 derivation with 0 as 'length' parameter
Pass PBKDF2 derivation with null as 'length' parameter
Pass PBKDF2 derivation with undefined as 'length' parameter
Pass PBKDF2 derivation with omitted as 'length' parameter
Pass ECDH derivation with 256 as 'length' parameter
Pass ECDH derivation with 384 as 'length' parameter
Pass ECDH derivation with 230 as 'length' parameter
Pass ECDH derivation with 0 as 'length' parameter
Pass ECDH derivation with null as 'length' parameter
Pass ECDH derivation with undefined as 'length' parameter
Pass ECDH derivation with omitted as 'length' parameter
Pass X25519 derivation with 256 as 'length' parameter
Pass X25519 derivation with 384 as 'length' parameter
Pass X25519 derivation with 230 as 'length' parameter
Pass X25519 derivation with 0 as 'length' parameter
Pass X25519 derivation with null as 'length' parameter
Pass X25519 derivation with undefined as 'length' parameter
Pass X25519 derivation with omitted as 'length' parameter

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 40 tests
31 Pass
9 Fail
35 Pass
5 Fail
Pass setup - define tests
Fail P-521 good parameters
Fail P-521 mixed case parameters
@ -21,7 +21,7 @@ Pass P-521 asking for too many bits
Pass P-256 good parameters
Pass P-256 mixed case parameters
Pass P-256 short result
Fail P-256 non-multiple of 8 bits
Pass P-256 non-multiple of 8 bits
Pass P-256 missing public curve
Pass P-256 public property of algorithm is not a CryptoKey
Pass P-256 mismatched curves
@ -30,11 +30,11 @@ Pass P-256 no deriveBits usage for base key
Pass P-256 base key is not a private key
Pass P-256 public property value is a private key
Pass P-256 public property value is a secret key
Fail P-256 asking for too many bits
Pass P-256 asking for too many bits
Pass P-384 good parameters
Pass P-384 mixed case parameters
Pass P-384 short result
Fail P-384 non-multiple of 8 bits
Pass P-384 non-multiple of 8 bits
Pass P-384 missing public curve
Pass P-384 public property of algorithm is not a CryptoKey
Pass P-384 mismatched curves
@ -43,4 +43,4 @@ Pass P-384 no deriveBits usage for base key
Pass P-384 base key is not a private key
Pass P-384 public property value is a private key
Pass P-384 public property value is a secret key
Fail P-384 asking for too many bits
Pass P-384 asking for too many bits