mirror of
https://github.com/servo/servo
synced 2026-05-12 09:56:50 +02:00
We should compare HMAC signatures in constant time when validating
user-provided signatures, to prevent leaking timing information
proportional to the number of matching bytes. The WebCrypto
specification has also updated to require to use constant-time
comparison in HMAC signatures.
We update our implementation accordingly. Since we are still using the
`aws-lc-rs` crate for our HMAC implementation, we use the function
`verify_slices_are_equal` provided by `aws_lc_rs::constant_time` to
guarantees the comparison is constant-time.
Specification Update:
c962bc7ebb
Testing: Existing tests suffice.
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>