Skip to content

Commit

Permalink
crypto: arm/neon - memzero_explicit aes-cbc key
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Torsten Duwe authored and herbertx committed Mar 20, 2020
1 parent 7fe8e48 commit 82ff493
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/crypto/aes-neonbs-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
kernel_neon_begin();
aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
kernel_neon_end();
memzero_explicit(&rk, sizeof(rk));

return crypto_cipher_setkey(ctx->enc_tfm, in_key, key_len);
}
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/crypto/aes-neonbs-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
kernel_neon_begin();
aesbs_convert_key(ctx->key.rk, rk.key_enc, ctx->key.rounds);
kernel_neon_end();
memzero_explicit(&rk, sizeof(rk));

return 0;
}
Expand Down

0 comments on commit 82ff493

Please sign in to comment.