crypto: Fix 192-bit checks for AES-GCM encrypt/decrypt (#34333)

* Fix 192-bit key length check for AES-GCM encrypt/decrypt

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Update expectations

- Regenerated legacy ones as they had outdated expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Add missed expectations

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
Daniel Adams 2024-11-21 12:50:32 -10:00 committed by GitHub
parent 108e316aa6
commit bd9843405a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 294 additions and 3702 deletions

View file

@ -1873,7 +1873,7 @@ impl SubtleCrypto {
.expect("key length did not match")
.encrypt_in_place_detached(nonce, additional_data, &mut ciphertext)
},
(20, 12) => {
(24, 12) => {
let nonce = GenericArray::from_slice(&params.iv);
<Aes192Gcm96Iv>::new_from_slice(key_bytes)
.expect("key length did not match")
@ -1891,7 +1891,7 @@ impl SubtleCrypto {
.expect("key length did not match")
.encrypt_in_place_detached(nonce, additional_data, &mut ciphertext)
},
(20, 32) => {
(24, 32) => {
let nonce = GenericArray::from_slice(&params.iv);
<Aes192Gcm256Iv>::new_from_slice(key_bytes)
.expect("key length did not match")
@ -1992,7 +1992,7 @@ impl SubtleCrypto {
.expect("key length did not match")
.decrypt_in_place(nonce, additional_data, &mut plaintext)
},
(20, 12) => {
(24, 12) => {
let nonce = GenericArray::from_slice(&params.iv);
<Aes192Gcm96Iv>::new_from_slice(key_bytes)
.expect("key length did not match")
@ -2010,7 +2010,7 @@ impl SubtleCrypto {
.expect("key length did not match")
.decrypt_in_place(nonce, additional_data, &mut plaintext)
},
(20, 32) => {
(24, 32) => {
let nonce = GenericArray::from_slice(&params.iv);
<Aes192Gcm256Iv>::new_from_slice(key_bytes)
.expect("key length did not match")