aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/primitives/padding.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cryptography/hazmat/primitives/padding.py b/cryptography/hazmat/primitives/padding.py
index 4e834726..cf7dbecd 100644
--- a/cryptography/hazmat/primitives/padding.py
+++ b/cryptography/hazmat/primitives/padding.py
@@ -49,8 +49,8 @@ bool Cryptography_check_padding(const uint8_t *data, uint8_t block_len) {
}
/* Check to make sure the pad_size was within the valid range. */
- mismatch |= !(0 < pad_size);
- mismatch |= !(pad_size <= block_len);
+ mismatch |= ~Cryptography_constant_time_lt(0, pad_size);
+ mismatch |= Cryptography_constant_time_lt(block_len, pad_size);
/* Make sure any bits set are copied to the lowest bit */
mismatch |= mismatch >> 4;