1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibCrypto+LibTLS: Use AK/Random.h

This makes it possible to build both of these on Linux.
This commit is contained in:
Andreas Kling 2020-05-27 12:28:17 +02:00
parent 9a113b0229
commit c1dd67e792
5 changed files with 17 additions and 8 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/Random.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
//#define NT_DEBUG
@ -289,7 +290,7 @@ static UnsignedBigInteger random_number(const UnsignedBigInteger& min, const Uns
// FIXME: Need a cryptographically secure rng
auto size = range.trimmed_length() * sizeof(u32);
u8 buf[size];
arc4random_buf(buf, size);
AK::fill_with_random(buf, size);
Vector<u32> vec;
for (size_t i = 0; i < size / sizeof(u32); ++i) {
vec.append(*(u32*)buf + i);