LibCrypto: Skip the check against 2^32 on 32-bit

We can't have a length that large there. This was causing a build error
about shifting a 32-bit value by 32 bits.
This commit is contained in:
Sergey Bugaev 2024-04-24 17:04:56 +03:00 committed by Andrew Kaster
parent d458471e09
commit e720eadd9e

View file

@ -24,8 +24,10 @@ public:
size_t h_len = hash.digest_size();
// 1. If length > 2^32(hLen), output "mask too long" and stop.
if (length > (h_len << 32))
return Error::from_string_view("mask too long"sv);
if constexpr (sizeof(size_t) > 32) {
if (length > (h_len << 32))
return Error::from_string_view("mask too long"sv);
}
// 2. Let T be the empty octet string.
auto t = TRY(ByteBuffer::create_uninitialized(0));