mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-30 21:28:59 +00:00
Meta+LibCrypto: Add SecureRandom and replace PRNG usage with it
This adds a thin wrapper to LibCrypto for generating cryptographically secure random values and replaces current usages of PRNG within LibCrypto as well.
This commit is contained in:
parent
b981e6f7bc
commit
f55f507e56
Notes:
github-actions[bot]
2024-12-24 16:56:11 +00:00
Author: https://github.com/rmg-x
Commit: f55f507e56
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2996
Reviewed-by: https://github.com/ADKaster
10 changed files with 50 additions and 6 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibCrypto/ASN1/PEM.h>
|
||||
#include <LibCrypto/Certificate/Certificate.h>
|
||||
#include <LibCrypto/PK/RSA.h>
|
||||
#include <LibCrypto/SecureRandom.h>
|
||||
|
||||
namespace Crypto::PK {
|
||||
|
||||
|
@ -253,7 +254,7 @@ void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out)
|
|||
Vector<u8, 8096> ps;
|
||||
ps.resize(ps_length);
|
||||
|
||||
fill_with_random(ps);
|
||||
fill_with_secure_random(ps);
|
||||
// since fill_with_random can create zeros (shocking!)
|
||||
// we have to go through and un-zero the zeros
|
||||
for (size_t i = 0; i < ps_length; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue