Skip to content

Commit 2139581

Browse files
jallisonciqPlaidCat
authored andcommitted
In essiv_aead_setkey(), use the same logic as crypto_authenc_esn_setkey() to zeroize keys on exit.
Signed-off-by: Jeremy Allison <[email protected]>
1 parent 508c93a commit 2139581

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crypto/essiv.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static int essiv_aead_setkey(struct crypto_aead *tfm, const u8 *key,
127127
crypto_shash_update(desc, keys.enckey, keys.enckeylen) ?:
128128
crypto_shash_finup(desc, keys.authkey, keys.authkeylen, salt);
129129
if (err)
130-
return err;
130+
goto out;
131131

132132
crypto_cipher_clear_flags(tctx->essiv_cipher, CRYPTO_TFM_REQ_MASK);
133133
crypto_cipher_set_flags(tctx->essiv_cipher, crypto_aead_get_flags(tfm) &
@@ -137,6 +137,8 @@ static int essiv_aead_setkey(struct crypto_aead *tfm, const u8 *key,
137137
crypto_aead_set_flags(tfm, crypto_cipher_get_flags(tctx->essiv_cipher) &
138138
CRYPTO_TFM_RES_MASK);
139139

140+
out:
141+
memzero_explicit(&keys, sizeof(keys));
140142
return err;
141143
}
142144

0 commit comments

Comments
 (0)