1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibCrypto: Do not silently ignore key size mismatch

Before, when the actually passed key was too long, the extra bytes were silently
ignored. This can lead to all sorts of trouble, so ... don't do that.

The original intention was maybe to support non-integer amounts of key bytes.
But that doesn't happen anyway with AES.
This commit is contained in:
Ben Wiederhake 2020-08-28 11:13:30 +02:00 committed by Andreas Kling
parent e0b7833078
commit 1c60ea235e

View file

@ -67,7 +67,7 @@ void AESCipherKey::expand_encrypt_key(const ByteBuffer& user_key, size_t bits)
ASSERT(!user_key.is_null());
ASSERT(is_valid_key_size(bits));
ASSERT(user_key.size() >= bits / 8);
ASSERT(user_key.size() == bits / 8);
round_key = round_keys();