mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibWeb: Test subtleties in HKDF 'salt' interpretation
This also doubles as HKDF implementation test.
This commit is contained in:
committed by
Andrew Kaster
parent
f670c68ded
commit
6d68d6ddb2
Notes:
github-actions[bot]
2024-10-23 18:21:48 +00:00
Author: https://github.com/BenWiederhake Commit: https://github.com/LadybirdBrowser/ladybird/commit/6d68d6ddb2d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1877 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/alimpfard ✅ Reviewed-by: https://github.com/stelar7
@@ -1467,7 +1467,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::ArrayBuffer>> HKDF::derive_bits(Algorit
|
||||
// * the contents of the salt member of normalizedAlgorithm as salt,
|
||||
// * the contents of the info member of normalizedAlgorithm as info,
|
||||
// * length divided by 8 as the value of L,
|
||||
// FIXME: salt null versus salt empty?!
|
||||
// Note: Although HKDF technically supports absent salt (treating it as hashLen many NUL bytes),
|
||||
// all major browsers instead raise a TypeError, for example:
|
||||
// "Failed to execute 'deriveBits' on 'SubtleCrypto': HkdfParams: salt: Not a BufferSource"
|
||||
// Because we are forced by neither peer pressure nor the spec, we don't support it either.
|
||||
auto const& hash_algorithm = TRY(normalized_algorithm.hash.visit(
|
||||
[](String const& name) -> JS::ThrowCompletionOr<String> { return name; },
|
||||
[&](JS::Handle<JS::Object> const& obj) -> JS::ThrowCompletionOr<String> {
|
||||
|
||||
Reference in New Issue
Block a user