LibCrypto+AK: Merge LibCrypto/SecureRandom into AK/Random

AK/Random is already the same as SecureRandom. See PR for more details.

ProcessPrng is used on Windows for compatibility w/ sandboxing measures
See e.g. https://crbug.com/40277768
This commit is contained in:
Colleirose
2026-01-02 16:48:45 -08:00
committed by Jelle Raaijmakers
parent d942b98549
commit bf7fd80140
Notes: github-actions[bot] 2026-02-06 11:11:30 +00:00
15 changed files with 104 additions and 109 deletions

View File

@@ -11,6 +11,7 @@
#include <AK/Base64.h>
#include <AK/HashTable.h>
#include <AK/QuickSort.h>
#include <AK/Random.h>
#include <LibCrypto/ASN1/ASN1.h>
#include <LibCrypto/ASN1/Constants.h>
#include <LibCrypto/ASN1/DER.h>
@@ -29,7 +30,6 @@
#include <LibCrypto/PK/MLDSA.h>
#include <LibCrypto/PK/MLKEM.h>
#include <LibCrypto/PK/RSA.h>
#include <LibCrypto/SecureRandom.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/ArrayBuffer.h>
#include <LibJS/Runtime/DataView.h>
@@ -274,7 +274,7 @@ static WebIDL::ExceptionOr<void> validate_jwk_key_ops(JS::Realm& realm, Bindings
static WebIDL::ExceptionOr<ByteBuffer> generate_random_key(JS::VM& vm, u16 const size_in_bits)
{
auto key_buffer = TRY_OR_THROW_OOM(vm, ByteBuffer::create_uninitialized(size_in_bits / 8));
::Crypto::fill_with_secure_random(key_buffer);
fill_with_random(key_buffer);
return key_buffer;
}