Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto.c: ensure we don't pass too large key size to CryptoNG
We use BCryptGenerateSymmetricKey() to generate a symmetric key object, passing a buffer containing a key and a key length. While buffer length is guaranteed not to exceed 32 bytes, the key length value is passed from userspace and could be at max 256 bytes. The documentation says that: If the data passed in exceeds the target key size, the data will be truncated and the excess will be ignored. which means that passing large length should not be a problem. I confirmed it with test with driver verifier enabled - I passed "256" as key length and haven't got any errors (and got key objected created and VPN session set up). Nevertheless, let's be good citizens and error out if passed key length exceeds 32 bytes - maximum key length for AES-GCM and ChaCha20 ciphers. Bump version to 1.0.1. Reported-by: Vladimir Tokarev <[email protected]> Signed-off-by: Lev Stipakov <[email protected]>
- Loading branch information