mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibCrypto: Implement KMAC authentication support
Add a LibCrypto::Authentication::KMAC helper over OpenSSL. Add keygen/import/export logic into WebCrypto. Register KMAC128/KMAC256 operations with SubtleCrypto.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
6cc575b8a9
commit
d4cf537d58
Notes:
github-actions[bot]
2026-03-19 09:47:56 +00:00
Author: https://github.com/mikiubo Commit: https://github.com/LadybirdBrowser/ladybird/commit/d4cf537d585 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8445 Reviewed-by: https://github.com/gmta ✅
@@ -21,6 +21,7 @@ GC_DEFINE_ALLOCATOR(RsaHashedKeyAlgorithm);
|
||||
GC_DEFINE_ALLOCATOR(EcKeyAlgorithm);
|
||||
GC_DEFINE_ALLOCATOR(AesKeyAlgorithm);
|
||||
GC_DEFINE_ALLOCATOR(HmacKeyAlgorithm);
|
||||
GC_DEFINE_ALLOCATOR(KmacKeyAlgorithm);
|
||||
|
||||
template<typename T>
|
||||
static JS::ThrowCompletionOr<T*> impl_from(JS::VM& vm, StringView Name)
|
||||
@@ -237,4 +238,26 @@ JS_DEFINE_NATIVE_FUNCTION(HmacKeyAlgorithm::length_getter)
|
||||
return TRY(Bindings::throw_dom_exception_if_needed(vm, [&] { return impl->length(); }));
|
||||
}
|
||||
|
||||
GC::Ref<KmacKeyAlgorithm> KmacKeyAlgorithm::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.create<KmacKeyAlgorithm>(realm);
|
||||
}
|
||||
|
||||
KmacKeyAlgorithm::KmacKeyAlgorithm(JS::Realm& realm)
|
||||
: KeyAlgorithm(realm)
|
||||
{
|
||||
}
|
||||
|
||||
void KmacKeyAlgorithm::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
define_native_accessor(realm, "length"_utf16_fly_string, length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(KmacKeyAlgorithm::length_getter)
|
||||
{
|
||||
auto* impl = TRY(impl_from<KmacKeyAlgorithm>(vm, "KmacKeyAlgorithm"sv));
|
||||
return TRY(Bindings::throw_dom_exception_if_needed(vm, [&] { return impl->length(); }));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user