David Horstmann 652ea21737 Fix timing side-channel in PKCS7 padding
Previously, we were checking if the last padding byte was in the range
1-16 and returning early if not. This was to prevent an integer overflow
in the output length.

Instead, do the checks in constant-time and conditionally set the output
length based on whether the padding is correct or not, preventing both
the side-channel and the integer overflow.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-01-22 11:36:16 +00:00
..
2024-11-14 14:19:40 +00:00