Skip to content

Commit f7b5d8c

Browse files
jason-rodriPlaidCat
authored andcommitted
In essiv_aead_setkey(), use the same logic as crypto_authenc_esn_setkey() to zeroize keys on exit.
1 parent 82395cb commit f7b5d8c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crypto/essiv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,14 @@ static int essiv_aead_setkey(struct crypto_aead *tfm, const u8 *key,
114114
crypto_shash_update(desc, keys.enckey, keys.enckeylen) ?:
115115
crypto_shash_finup(desc, keys.authkey, keys.authkeylen, salt);
116116
if (err)
117-
return err;
117+
goto out;
118118

119119
crypto_cipher_clear_flags(tctx->essiv_cipher, CRYPTO_TFM_REQ_MASK);
120120
crypto_cipher_set_flags(tctx->essiv_cipher, crypto_aead_get_flags(tfm) &
121121
CRYPTO_TFM_REQ_MASK);
122-
return crypto_cipher_setkey(tctx->essiv_cipher, salt,
123-
crypto_shash_digestsize(tctx->hash));
122+
out:
123+
memzero_explicit(&keys, sizeof(keys));
124+
return err;
124125
}
125126

126127
static int essiv_aead_setauthsize(struct crypto_aead *tfm,

0 commit comments

Comments
 (0)