Skip to content

Commit

Permalink
LibCrypto: Reset cached trimmed length after add_into_accumulator
Browse files Browse the repository at this point in the history
The trimmed cache length of the `UnsignedBigInteger` was not reset after
an `add_into_accumulator_without_allocation` operation because the
function manipulates the words directly.

This meant that if the trimmed length was calculated before this
operation it would be wrong after.
  • Loading branch information
devgianlu authored and alimpfard committed Dec 15, 2024
1 parent 40bf8dd commit a74ef5d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ void UnsignedBigIntegerAlgorithms::add_into_accumulator_without_allocation(Unsig
// Note : The accumulator couldn't add the carry directly, so we reached its end
accumulator.m_words.append(last_carry_for_word);
}

accumulator.m_cached_trimmed_length = {};
}

/**
Expand Down

0 comments on commit a74ef5d

Please sign in to comment.