Skip to content

Commit

Permalink
crypto: xilinx: aes-gcm: Initialize key source with default value
Browse files Browse the repository at this point in the history
setkey callback skipped copy of key in tfm_ctx because of invalid
tfm_ctx->keysrc value.
Initialise default keysrc in tfm_init callback for versal and zynqmp.

Signed-off-by: Praveen Teja Kundanala <[email protected]>
Signed-off-by: Harsh Jain <[email protected]>
Message-ID: <[email protected]>
  • Loading branch information
Praveen Teja Kundanala authored and michalsimek committed Oct 29, 2024
1 parent 86e78fc commit d852896
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/crypto/xilinx/zynqmp-aes-gcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct xilinx_aead_drv_ctx {
struct aead_engine_alg aead;
struct device *dev;
struct crypto_engine *engine;
u8 keysrc;
int (*aes_aead_cipher)(struct aead_request *areq);
int (*fallback_check)(struct zynqmp_aead_tfm_ctx *ctx,
struct aead_request *areq);
Expand Down Expand Up @@ -572,6 +573,7 @@ static int aes_aead_init(struct crypto_aead *aead)

drv_ctx = container_of(alg, struct xilinx_aead_drv_ctx, aead.base);
tfm_ctx->dev = drv_ctx->dev;
tfm_ctx->keysrc = drv_ctx->keysrc;

tfm_ctx->fbk_cipher = crypto_alloc_aead(drv_ctx->aead.base.base.cra_name,
0,
Expand Down Expand Up @@ -606,6 +608,7 @@ static void zynqmp_aes_aead_exit(struct crypto_aead *aead)
static struct xilinx_aead_drv_ctx zynqmp_aes_drv_ctx = {
.fallback_check = zynqmp_fallback_check,
.aes_aead_cipher = zynqmp_aes_aead_cipher,
.keysrc = ZYNQMP_AES_KUP_KEY,
.aead.base = {
.setkey = zynqmp_aes_aead_setkey,
.setauthsize = zynqmp_aes_aead_setauthsize,
Expand Down Expand Up @@ -637,6 +640,7 @@ static struct xilinx_aead_drv_ctx zynqmp_aes_drv_ctx = {
static struct xilinx_aead_drv_ctx versal_aes_drv_ctx = {
.fallback_check = versal_fallback_check,
.aes_aead_cipher = versal_aes_aead_cipher,
.keysrc = VERSAL_AES_USER_KEY_0,
.aead.base = {
.setkey = versal_aes_aead_setkey,
.setauthsize = zynqmp_aes_aead_setauthsize,
Expand Down

0 comments on commit d852896

Please sign in to comment.