Skip to content

Commit 3c8c29a

Browse files
jason-rodrikerneltoast
authored andcommitted
In essiv_aead_setkey(), use the same logic as crypto_authenc_esn_setkey() to zeroize keys on exit.
converting ws
1 parent 3e889ae commit 3c8c29a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crypto/essiv.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,16 @@ 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+
err = crypto_cipher_setkey(tctx->essiv_cipher, salt,
123+
crypto_shash_digestsize(tctx->hash));
124+
out:
125+
memzero_explicit(&keys, sizeof(keys));
126+
return err;
124127
}
125128

126129
static int essiv_aead_setauthsize(struct crypto_aead *tfm,

0 commit comments

Comments
 (0)