Skip to content

Commit 82ff493

Browse files
Torsten Duweherbertx
authored andcommitted
crypto: arm/neon - memzero_explicit aes-cbc key
At function exit, do not leave the expanded key in the rk struct which got allocated on the stack. Signed-off-by: Torsten Duwe <[email protected]> Acked-by: Will Deacon <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 7fe8e48 commit 82ff493

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/arm/crypto/aes-neonbs-glue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
138138
kernel_neon_begin();
139139
aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
140140
kernel_neon_end();
141+
memzero_explicit(&rk, sizeof(rk));
141142

142143
return crypto_cipher_setkey(ctx->enc_tfm, in_key, key_len);
143144
}

arch/arm64/crypto/aes-neonbs-glue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
151151
kernel_neon_begin();
152152
aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
153153
kernel_neon_end();
154+
memzero_explicit(&rk, sizeof(rk));
154155

155156
return 0;
156157
}

0 commit comments

Comments
 (0)