mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibCrypto: Prevent a signed overflow during BigInt Modular Power
The algorithm isn't explicit about what type this needs to be. But this passes all of the tests, so that's probably fine.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 18:10:34 +09:00
Author: https://github.com/Dexesttp Commit: https://github.com/SerenityOS/serenity/commit/36a56871c04 Pull-request: https://github.com/SerenityOS/serenity/pull/7094
@@ -58,9 +58,9 @@ ALWAYS_INLINE static u32 inverse_wrapped(u32 value)
|
||||
{
|
||||
VERIFY(value & 1);
|
||||
|
||||
i64 b = static_cast<i64>(value);
|
||||
i64 k0 = (2 - b);
|
||||
i64 t = (b - 1);
|
||||
u64 b = static_cast<u64>(value);
|
||||
u64 k0 = (2 - b);
|
||||
u64 t = (b - 1);
|
||||
size_t i = 1;
|
||||
while (i < 32) {
|
||||
t = t * t;
|
||||
|
||||
Reference in New Issue
Block a user