diff options
author | Jack Lloyd <[email protected]> | 2018-11-30 11:33:05 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-30 11:33:05 -0500 |
commit | 2d9a5c1ffa61c2a30cb66518ef2de496467540ed (patch) | |
tree | 72f9e34852fb72ea435f3a3860a8b2072069f777 /src/lib/utils | |
parent | 542975a40e34b92f483468b37589fd448b002732 (diff) |
Fix a bug in OneAndZeros unpadding
Introduced in b13c0cc8590199d, it could only trigger if the block size
was more than 256 bytes. In that case an invalid padding could be accepted.
OSS-Fuzz 11608 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11608)
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/ct_utils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/utils/ct_utils.h b/src/lib/utils/ct_utils.h index eb510baa2..9243d6701 100644 --- a/src/lib/utils/ct_utils.h +++ b/src/lib/utils/ct_utils.h @@ -125,6 +125,16 @@ class Mask } /** + * Return a Mask<T> which is set if m is set + */ + template<typename U> + static Mask<T> expand(Mask<U> m) + { + static_assert(sizeof(U) < sizeof(T), "sizes ok"); + return ~Mask<T>::is_zero(m.value()); + } + + /** * Return a Mask<T> which is set if v is == 0 or cleared otherwise */ static Mask<T> is_zero(T x) |