mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibCrypto: Remove the concept of invalid big integers
This concept is rarely used in codebase and very much error-prone if you forget to check it. Instead, make it so that operations that would produce invalid integers return an error instead.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
14387e5411
commit
5f1a30197c
Notes:
github-actions[bot]
2025-04-28 10:06:55 +00:00
Author: https://github.com/devgianlu Commit: https://github.com/LadybirdBrowser/ladybird/commit/5f1a30197cc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4482 Reviewed-by: https://github.com/gmta ✅
@@ -262,7 +262,7 @@ void UnsignedBigIntegerAlgorithms::montgomery_modular_power_with_minimal_allocat
|
||||
// Note : Since we were using "almost montgomery" multiplications, we aren't guaranteed to be under the modulo already.
|
||||
// So, if we're here, we need to respect the modulo.
|
||||
// We can, however, start by trying to subtract the modulo, just in case we're close.
|
||||
subtract_without_allocation(zz, modulo, result);
|
||||
MUST(subtract_without_allocation(zz, modulo, result));
|
||||
|
||||
if (modulo < zz) {
|
||||
// Note: This branch shouldn't happen in theory (as noted in https://github.com/rust-num/num-bigint/blob/master/src/biguint/monty.rs#L210)
|
||||
|
||||
Reference in New Issue
Block a user