From patchwork Wed Nov 30 21:01:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9454925 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2C4460585 for ; Wed, 30 Nov 2016 21:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D61EC28471 for ; Wed, 30 Nov 2016 21:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAB5528497; Wed, 30 Nov 2016 21:04:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E10E5284A1 for ; Wed, 30 Nov 2016 21:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757056AbcK3VD0 (ORCPT ); Wed, 30 Nov 2016 16:03:26 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:52964 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753043AbcK3VC4 (ORCPT ); Wed, 30 Nov 2016 16:02:56 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MC5H2-1c3MJr2ReK-008qrc; Wed, 30 Nov 2016 22:02:39 +0100 From: Arnd Bergmann To: Herbert Xu Cc: Arnd Bergmann , =?UTF-8?q?Horia=20Geant=C4=83?= , Dan Douglass , "David S. Miller" , Catalin Vasile , Tudor Ambarus , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] crypto: caam: pass key buffers with typesafe pointers Date: Wed, 30 Nov 2016 22:01:59 +0100 Message-Id: <20161130210234.1666417-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:BtItcodHU64GUriZ1eSWBJZ5j/dZRn6e5VGOetlctHyPQwEBW1p JBCxDd8hrpjRhm1o8rfbqDKK3CPZ/16UsGKs/8WITXGl2e0UCY3g7xNMabJB352Q7Vmsm91 K4j7KqQW+7gl+7W0psX5IXVJxz3Kf6tdaGn2sCMDvU4JDk5we8DC4QmGjFIsnfk11AZyn5D iGekfu33kYX3N67MuzGfw== X-UI-Out-Filterresults: notjunk:1; V01:K0:q7ZADWnqbq4=:h9J0dPIPxhLv/8IzyuMPo3 ElTAowNKAz/one5qnHswsKHjx4DhXB/V44Jw7fiO9tQKI/9BeO6Mc7WRinNTvddHoV+UK7a9U mvvqxoIw/qoxvSj3S+CURkdtVh9Ke/+HC9mSt5b507+fk3XDJaO8aO3yC5lCn7ZSEj5oreGaD +TjlyRybZnjNf+9XmKz1l4TEglT7fZUBs9Hi3eNqdBFjnIQf1W+cfAiYKHf9qUbVmtKEXTSnk HoohLndSfZg1adFo9CM+RJ3TpOtWGyCEnjaxrkAQjck0GaFdkdG+52XZXplmjG/r3A3DPYbVb ksLvnWtlt/NLtf9vqgQlSeJPvRqoRpE577f8g6B6k1Ct6KfbBELcKd1KQM8qjKSw6PbiarO/3 m9FKgH7Yeh9qWAZvedToaBLi3EJco+zPJaA57sE6oP3WQDD3LBtYGkTlmqC6+ABvhYT387Ygk H/JDWjKnK4IV6TCacHwjCSLKIMC/tsTh0mq/yrZOwNpHAaIvacxwGJrOcStEXkPZfh/kbp9+3 p3yhtbc7iwE8lPsR5QfDyq5KMvKWfnPSv1cw6VjxD+rE/jeaJ6Q3yLKuGZm7bdowkYoEj6n2j 7T/q0nceGm0i2/WMMNFZzfZv6+wXFf3tgVQ/6bodp7aVzo3U8W0SYOVUCwsSgXlTzquyzZY56 Y1gcr6uewYpwiy38WlqheFCc3beQ0c3TWABBnv9fZzZ+GS6aDvFmHOYlG6B4clqhHv8c= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The 'key' field is defined as a 'u64' and used for two different pieces of information: either to store a pointer or a dma_addr_t. The former leads to a build error on 32-bit machines: drivers/crypto/caam/caamalg_desc.c: In function 'cnstr_shdsc_aead_null_encap': drivers/crypto/caam/caamalg_desc.c:67:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] drivers/crypto/caam/caamalg_desc.c: In function 'cnstr_shdsc_aead_null_decap': drivers/crypto/caam/caamalg_desc.c:143:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] Using a union to provide correct types gets rid of the warnings and as well as a couple of redundant casts. Fixes: db57656b0072 ("crypto: caam - group algorithm related params") Signed-off-by: Arnd Bergmann --- drivers/crypto/caam/caamalg.c | 60 +++++++++++++++++++------------------- drivers/crypto/caam/caamalg_desc.c | 56 +++++++++++++++++------------------ drivers/crypto/caam/desc_constr.h | 5 +++- 3 files changed, 62 insertions(+), 59 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 37f0540d4694..662fe94cb2f8 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -162,10 +162,10 @@ static int aead_null_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_AEAD_NULL_ENC_LEN) { ctx->adata.key_inline = true; - ctx->adata.key = (uintptr_t)ctx->key; + ctx->adata.key_virt = ctx->key; } else { ctx->adata.key_inline = false; - ctx->adata.key = ctx->key_dma; + ctx->adata.key_dma = ctx->key_dma; } /* aead_encrypt shared descriptor */ @@ -185,10 +185,10 @@ static int aead_null_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_AEAD_NULL_DEC_LEN) { ctx->adata.key_inline = true; - ctx->adata.key = (uintptr_t)ctx->key; + ctx->adata.key_virt = ctx->key; } else { ctx->adata.key_inline = false; - ctx->adata.key = ctx->key_dma; + ctx->adata.key_dma = ctx->key_dma; } /* aead_decrypt shared descriptor */ @@ -262,14 +262,14 @@ static int aead_set_sh_desc(struct crypto_aead *aead) return -EINVAL; if (inl_mask & 1) - ctx->adata.key = (uintptr_t)ctx->key; + ctx->adata.key_virt = ctx->key; else - ctx->adata.key = ctx->key_dma; + ctx->adata.key_dma = ctx->key_dma; if (inl_mask & 2) - ctx->cdata.key = (uintptr_t)(ctx->key + ctx->adata.keylen_pad); + ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad; else - ctx->cdata.key = ctx->key_dma + ctx->adata.keylen_pad; + ctx->cdata.key_dma = ctx->key_dma + ctx->adata.keylen_pad; ctx->adata.key_inline = !!(inl_mask & 1); ctx->cdata.key_inline = !!(inl_mask & 2); @@ -298,14 +298,14 @@ static int aead_set_sh_desc(struct crypto_aead *aead) return -EINVAL; if (inl_mask & 1) - ctx->adata.key = (uintptr_t)ctx->key; + ctx->adata.key_virt = ctx->key; else - ctx->adata.key = ctx->key_dma; + ctx->adata.key_dma = ctx->key_dma; if (inl_mask & 2) - ctx->cdata.key = (uintptr_t)(ctx->key + ctx->adata.keylen_pad); + ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad; else - ctx->cdata.key = ctx->key_dma + ctx->adata.keylen_pad; + ctx->cdata.key_dma = ctx->key_dma + ctx->adata.keylen_pad; ctx->adata.key_inline = !!(inl_mask & 1); ctx->cdata.key_inline = !!(inl_mask & 2); @@ -337,14 +337,14 @@ static int aead_set_sh_desc(struct crypto_aead *aead) return -EINVAL; if (inl_mask & 1) - ctx->adata.key = (uintptr_t)ctx->key; + ctx->adata.key_virt = ctx->key; else - ctx->adata.key = ctx->key_dma; + ctx->adata.key_dma = ctx->key_dma; if (inl_mask & 2) - ctx->cdata.key = (uintptr_t)(ctx->key + ctx->adata.keylen_pad); + ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad; else - ctx->cdata.key = ctx->key_dma + ctx->adata.keylen_pad; + ctx->cdata.key_dma = ctx->key_dma + ctx->adata.keylen_pad; ctx->adata.key_inline = !!(inl_mask & 1); ctx->cdata.key_inline = !!(inl_mask & 2); @@ -395,10 +395,10 @@ static int gcm_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_GCM_ENC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_enc; @@ -417,10 +417,10 @@ static int gcm_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_GCM_DEC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_dec; @@ -464,10 +464,10 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_RFC4106_ENC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_enc; @@ -486,10 +486,10 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_RFC4106_DEC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_dec; @@ -534,10 +534,10 @@ static int rfc4543_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_RFC4543_ENC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_enc; @@ -556,10 +556,10 @@ static int rfc4543_set_sh_desc(struct crypto_aead *aead) */ if (rem_bytes >= DESC_RFC4543_DEC_LEN) { ctx->cdata.key_inline = true; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; } else { ctx->cdata.key_inline = false; - ctx->cdata.key = ctx->key_dma; + ctx->cdata.key_dma = ctx->key_dma; } desc = ctx->sh_desc_dec; @@ -794,7 +794,7 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, return -ENOMEM; } ctx->cdata.keylen = keylen; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; ctx->cdata.key_inline = true; /* ablkcipher_encrypt shared descriptor */ @@ -857,7 +857,7 @@ static int xts_ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, return -ENOMEM; } ctx->cdata.keylen = keylen; - ctx->cdata.key = (uintptr_t)ctx->key; + ctx->cdata.key_virt = ctx->key; ctx->cdata.key_inline = true; /* xts_ablkcipher_encrypt shared descriptor */ diff --git a/drivers/crypto/caam/caamalg_desc.c b/drivers/crypto/caam/caamalg_desc.c index fa2479d9da24..7dee952ef432 100644 --- a/drivers/crypto/caam/caamalg_desc.c +++ b/drivers/crypto/caam/caamalg_desc.c @@ -64,11 +64,11 @@ void cnstr_shdsc_aead_null_encap(u32 * const desc, struct alginfo *adata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (adata->key_inline) - append_key_as_imm(desc, (void *)adata->key, adata->keylen_pad, + append_key_as_imm(desc, adata->key_virt, adata->keylen_pad, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); else - append_key(desc, adata->key, adata->keylen, CLASS_2 | + append_key(desc, adata->key_dma, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); set_jump_tgt_here(desc, key_jump_cmd); @@ -140,11 +140,11 @@ void cnstr_shdsc_aead_null_decap(u32 * const desc, struct alginfo *adata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (adata->key_inline) - append_key_as_imm(desc, (void *)adata->key, adata->keylen_pad, + append_key_as_imm(desc, adata->key_virt, adata->keylen_pad, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); else - append_key(desc, adata->key, adata->keylen, CLASS_2 | + append_key(desc, adata->key_dma, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); set_jump_tgt_here(desc, key_jump_cmd); @@ -225,18 +225,18 @@ static void init_sh_desc_key_aead(u32 * const desc, enckeylen -= CTR_RFC3686_NONCE_SIZE; if (adata->key_inline) - append_key_as_imm(desc, (void *)adata->key, adata->keylen_pad, + append_key_as_imm(desc, adata->key_virt, adata->keylen_pad, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); else - append_key(desc, adata->key, adata->keylen, CLASS_2 | + append_key(desc, adata->key_dma, adata->keylen, CLASS_2 | KEY_DEST_MDHA_SPLIT | KEY_ENC); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, enckeylen, + append_key_as_imm(desc, cdata->key_virt, enckeylen, enckeylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, enckeylen, CLASS_1 | + append_key(desc, cdata->key_dma, enckeylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load Counter into CONTEXT1 reg */ @@ -536,10 +536,10 @@ void cnstr_shdsc_gcm_encap(u32 * const desc, struct alginfo *cdata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD | JUMP_COND_SELF); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -626,10 +626,10 @@ void cnstr_shdsc_gcm_decap(u32 * const desc, struct alginfo *cdata, JUMP_TEST_ALL | JUMP_COND_SHRD | JUMP_COND_SELF); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -702,10 +702,10 @@ void cnstr_shdsc_rfc4106_encap(u32 * const desc, struct alginfo *cdata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -773,11 +773,11 @@ void cnstr_shdsc_rfc4106_decap(u32 * const desc, struct alginfo *cdata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -845,10 +845,10 @@ void cnstr_shdsc_rfc4543_encap(u32 * const desc, struct alginfo *cdata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -915,10 +915,10 @@ void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata, key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); if (cdata->key_inline) - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); else - append_key(desc, cdata->key, cdata->keylen, CLASS_1 | + append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); set_jump_tgt_here(desc, key_jump_cmd); @@ -1006,12 +1006,12 @@ void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata, JUMP_COND_SHRD); /* Load class1 key only */ - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load nonce into CONTEXT1 reg */ if (is_rfc3686) { - u8 *nonce = (u8 *)cdata->key + cdata->keylen; + u8 *nonce = cdata->key_virt + cdata->keylen; append_load_as_imm(desc, nonce, CTR_RFC3686_NONCE_SIZE, LDST_CLASS_IND_CCB | @@ -1071,12 +1071,12 @@ void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata, JUMP_COND_SHRD); /* Load class1 key only */ - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load nonce into CONTEXT1 reg */ if (is_rfc3686) { - u8 *nonce = (u8 *)cdata->key + cdata->keylen; + u8 *nonce = cdata->key_virt + cdata->keylen; append_load_as_imm(desc, nonce, CTR_RFC3686_NONCE_SIZE, LDST_CLASS_IND_CCB | @@ -1140,12 +1140,12 @@ void cnstr_shdsc_ablkcipher_givencap(u32 * const desc, struct alginfo *cdata, JUMP_COND_SHRD); /* Load class1 key only */ - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load Nonce into CONTEXT1 reg */ if (is_rfc3686) { - u8 *nonce = (u8 *)cdata->key + cdata->keylen; + u8 *nonce = cdata->key_virt + cdata->keylen; append_load_as_imm(desc, nonce, CTR_RFC3686_NONCE_SIZE, LDST_CLASS_IND_CCB | @@ -1216,7 +1216,7 @@ void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata) JUMP_COND_SHRD); /* Load class1 keys only */ - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load sector size with index 40 bytes (0x28) */ @@ -1268,7 +1268,7 @@ void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata) JUMP_COND_SHRD); /* Load class1 key only */ - append_key_as_imm(desc, (void *)cdata->key, cdata->keylen, + append_key_as_imm(desc, cdata->key_virt, cdata->keylen, cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); /* Load sector size with index 40 bytes (0x28) */ diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h index fa70c0d79c40..b9c8d98ef826 100644 --- a/drivers/crypto/caam/desc_constr.h +++ b/drivers/crypto/caam/desc_constr.h @@ -446,7 +446,10 @@ struct alginfo { u32 algtype; unsigned int keylen; unsigned int keylen_pad; - u64 key; + union { + dma_addr_t key_dma; + void *key_virt; + }; bool key_inline; };