From patchwork Tue Jan 10 13:50:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Whitchurch X-Patchwork-Id: 41483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2758869wrt; Tue, 10 Jan 2023 05:56:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXu4TqqqJAYZMX7mvflvLpH1/erXuGn4QFT0Ld7rSa3qJIR7CVJpAreknNta7ev3tlX3wIoO X-Received: by 2002:a17:903:40c4:b0:193:197e:494f with SMTP id t4-20020a17090340c400b00193197e494fmr13200778pld.27.1673358989368; Tue, 10 Jan 2023 05:56:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673358989; cv=none; d=google.com; s=arc-20160816; b=IGX6kzPqpdRHK+GW707clbhayU0Y3DjOgbo+/T0FVAytkaEAvmlPUFPn7QrCtvTbaI SaTcffMZTR4FeADAW4FtJHeNQdvS9uu1IkrgDFTwUa3yuYhRkh0pQJzXX/QDu7twuDwU rhXxEbJJfzyGBSMYKQg03okb7NfG+3T09Ieg+MRWXZ2dfqPyA2Fofb58lSG1WPy5X6MJ 7sHNZH+N8fXF9qHGmgWzhj+dgXA8ge7Mi/3OB3r5D3HcZYjERRXqCpulsTpIStc4HFB1 gRxwueMTyde1Ku/h57451KeVg8GWRNMiR6b6bw+LHwcvykb4GCdDPzDsXxDMA1Ej3irk tGLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YBWPPr1+kqTd4bU3Mi91t3NpLL6yLU7kv9iml0RWA0w=; b=W4Y0K+jmQ1gSbJN+Oy/O970mOzTm2jXdILwqxqvgNBQX+3as3lX9xIbXkJl9Dd0U+P iOkjbgW/OWDJ38hbpQlqCF51tTkFq3mvR4OS72MwVp3/6nrRaXKDBvrlA0Ok35ZQeaIj A6/XMD9Co171XYrQzAiNREZ8+HPgfY8z/1VovUFETGMKgFOPxJDIvIrlu6TVNIfb2Cck f1PbYt1SK0w3nnfOsSSDi/4p6XIf9vFbnzFXbrJbFfy6nupo80fnKkPsPQQnrw+PjhG4 utQLP8+5U9sK/W5I6KVoSlAEo5UMc1Y6rxmLpqRbZPyNDT6sIvQxNM0ucqcjOMGDVojq b62g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=cSmKa9qj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f9-20020a170902e98900b00186e9ff4edcsi10792970plb.408.2023.01.10.05.56.12; Tue, 10 Jan 2023 05:56:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=cSmKa9qj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238672AbjAJNvm (ORCPT + 99 others); Tue, 10 Jan 2023 08:51:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238321AbjAJNu6 (ORCPT ); Tue, 10 Jan 2023 08:50:58 -0500 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9DE64EE; Tue, 10 Jan 2023 05:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1673358657; x=1704894657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YBWPPr1+kqTd4bU3Mi91t3NpLL6yLU7kv9iml0RWA0w=; b=cSmKa9qjjsnjdPUeeXCfU3LJGnsMVCPkTtz9FYcRTS5ReqDGUC21jvmt BqRXGb8TM7Q+Cmd8W04/g+V5otzsJTkV0bzhjUtl1T94YhP/NR9eXgmbW sYJ8Siu+DnFKnOqowc5g0w2wEBJaSJnKrMW6YMgI/8deN1iIzZ2UbV0S1 FuKmPm9Hbf3KTcGGiaksEYVQ2WvHki+XTTNHq+hUV+RJ8M6m2azRfANCm fScmTcQAJvT/vDZE/LH05Kw4cICYI7hF9MoZcphu9GfojoxwRr3+jZRas xfn+7930u5uv3LF6WPIRbXFEVdyNdja7WqnfgoKbhzRhaM9btjVAmc+Rr A==; From: Vincent Whitchurch To: , , , CC: , Vincent Whitchurch , , Subject: [PATCH 02/12] crypto: axis - do not DMA to IV Date: Tue, 10 Jan 2023 14:50:32 +0100 Message-ID: <20230110135042.2940847-3-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110135042.2940847-1-vincent.whitchurch@axis.com> References: <20230110135042.2940847-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754644076017681501?= X-GMAIL-MSGID: =?utf-8?q?1754644076017681501?= The crypto API does not promise that the IV buffer is suitable for DMA. Use an intermediate buffer instead. Signed-off-by: Vincent Whitchurch --- drivers/crypto/axis/artpec6_crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index 87af44ac3e64..d3b6ee065a81 100644 --- a/drivers/crypto/axis/artpec6_crypto.c +++ b/drivers/crypto/axis/artpec6_crypto.c @@ -321,6 +321,7 @@ struct artpec6_crypto_request_context { u32 cipher_md; bool decrypt; struct artpec6_crypto_req_common common; + unsigned char iv_bounce[AES_BLOCK_SIZE] CRYPTO_MINALIGN_ATTR; }; struct artpec6_cryptotfm_context { @@ -1779,7 +1780,8 @@ static int artpec6_crypto_prepare_crypto(struct skcipher_request *areq) return ret; if (iv_len) { - ret = artpec6_crypto_setup_out_descr(common, areq->iv, iv_len, + memcpy(req_ctx->iv_bounce, areq->iv, iv_len); + ret = artpec6_crypto_setup_out_descr(common, req_ctx->iv_bounce, iv_len, false, false); if (ret) return ret;