mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibCrypto: Replace all hashes implementation with OpenSSL
This required multiple changes: - Make hashes non-copiable because they contain a heap allocated pointer - Reference classes via `NonnullOwnPtr` only (they are non-copiable) - Drop all existing hashes implementations - Use the `OpenSSLHashFunction` base class to implement the same hashes I was not able to come up with a way to divide this commit into multiple without increasing the amount of changes. Nothing breaks with this commit!
This commit is contained in:
parent
2d799727e8
commit
89061dd3c4
Notes:
github-actions[bot]
2024-12-22 17:54:42 +00:00
Author: https://github.com/devgianlu
Commit: 89061dd3c4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2989
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/rmg-x
16 changed files with 164 additions and 1350 deletions
|
@ -437,15 +437,14 @@ static void hmac_pseudorandom_function(Bytes output, ReadonlyBytes secret, u8 co
|
|||
HMACType hmac(secret);
|
||||
append_label_seed(hmac);
|
||||
|
||||
constexpr auto digest_size = hmac.digest_size();
|
||||
u8 digest[digest_size];
|
||||
auto digest_0 = Bytes { digest, digest_size };
|
||||
auto digest_size = hmac.digest_size();
|
||||
auto digest_0 = MUST(ByteBuffer::create_uninitialized(digest_size));
|
||||
|
||||
digest_0.overwrite(0, hmac.digest().immutable_data(), digest_size);
|
||||
|
||||
size_t index = 0;
|
||||
while (index < output.size()) {
|
||||
hmac.update(digest_0);
|
||||
hmac.update(digest_0.bytes());
|
||||
append_label_seed(hmac);
|
||||
auto digest_1 = hmac.digest();
|
||||
|
||||
|
@ -454,7 +453,7 @@ static void hmac_pseudorandom_function(Bytes output, ReadonlyBytes secret, u8 co
|
|||
output.overwrite(index, digest_1.immutable_data(), copy_size);
|
||||
index += copy_size;
|
||||
|
||||
digest_0.overwrite(0, hmac.process(digest_0).immutable_data(), digest_size);
|
||||
digest_0.overwrite(0, hmac.process(digest_0.bytes()).immutable_data(), digest_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue