From patchwork Tue Jan 15 13:43:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 155666 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4907266jaa; Tue, 15 Jan 2019 05:44:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ExwthTJoMmloognhmsVCwXfdmQ6nurtKBVSS/Wt4UKQIWcX1vt5xJYB/VbrwXWjQxJSZg X-Received: by 2002:a63:960a:: with SMTP id c10mr3941455pge.106.1547559851793; Tue, 15 Jan 2019 05:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547559851; cv=none; d=google.com; s=arc-20160816; b=enHOu56EJHbqAklddzncKzks8mGX+wJ6vm83CQ9P9JKI01UT88xZThjMPeXZn5XEsr YY7zd5fZTwXEE143bC41jSWs99TiVigsV0jVbKolGafSZnRv0l8pvPWDkV9loZuvYd9o vcOE7X/5BiVMhFnHV6eCKTnNSKNvlHxcdCfuaLNt32WMMByDX1hK/M5fmBG2s2R8A5fd OJuiZ2YjbJj+h6oh4Iw/QANf+BDUR3LFE32YR6BIS4r1W0b3OjFX7pk3RbzN7J0i3THN v5DGWD3sk2dn5ggf4gsDYUiYbgmymyKk4P1vDHScLjG2KILiPphFshN0zGFXjF62BSSy ykqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bmjBFgBqNJhCx9yGQVYBvVwCzvSUqi50att8gAVHrEE=; b=mim0bdmR3nP1stT84bOGaRXF+ZcfWEtemJGhEdbKbGb48oGq7vse2iqLWkuI+FO9Oy bn5GVO/pDo2UsreHeDLLr9TzItB1LSLzuIJ28xTyBUWE3Q/mEZDYD57x8Kl6OGYEkWL+ 9UvBiHqaidKXABTR1GHIbP+ooq3Y7ajF3L8WNxMAgelRQlY1TCKPPkIRh64wdAKdiYQh kVPfD6MpLMX1vM+td3YckmnGPp6hQQUsVRFEeHqtktFwuHwQx8TSoLFOU7hauey/NWNL jLWVVYbcLtbz0fnFAXYUXDe4Kn4nT8FaxttQ3dzmEyHT4W01oQoWkrkF/2iH4qTBIlaM ZxDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f82si3410107pfa.221.2019.01.15.05.44.11; Tue, 15 Jan 2019 05:44:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728468AbfAONoK (ORCPT + 3 others); Tue, 15 Jan 2019 08:44:10 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50736 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729844AbfAONni (ORCPT ); Tue, 15 Jan 2019 08:43:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8E5EBA78; Tue, 15 Jan 2019 05:43:38 -0800 (PST) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E3033F70D; Tue, 15 Jan 2019 05:43:36 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Hadar Gat , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] crypto: ccree: add error message Date: Tue, 15 Jan 2019 15:43:12 +0200 Message-Id: <20190115134318.28712-3-gilad@benyossef.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115134318.28712-1-gilad@benyossef.com> References: <20190115134318.28712-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Hadar Gat Add error message in case of too many mlli entries. Signed-off-by: Hadar Gat Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_buffer_mgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c index 32d2df36ced2..237a87a57830 100644 --- a/drivers/crypto/ccree/cc_buffer_mgr.c +++ b/drivers/crypto/ccree/cc_buffer_mgr.c @@ -156,8 +156,11 @@ static int cc_render_buff_to_mlli(struct device *dev, dma_addr_t buff_dma, /* Verify there is no memory overflow*/ new_nents = (*curr_nents + buff_size / CC_MAX_MLLI_ENTRY_SIZE + 1); - if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES) + if (new_nents > MAX_NUM_OF_TOTAL_MLLI_ENTRIES) { + dev_err(dev, "Too many mlli entries. current %d max %d\n", + new_nents, MAX_NUM_OF_TOTAL_MLLI_ENTRIES); return -ENOMEM; + } /*handle buffer longer than 64 kbytes */ while (buff_size > CC_MAX_MLLI_ENTRY_SIZE) { From patchwork Tue Jan 15 13:43:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 155662 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4906859jaa; Tue, 15 Jan 2019 05:43:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN5aoFyFXsdljaRt6F/Dt/BmYA0A09+sFVk/6WP8ElmhKB5XE2BkJxgqQbIm8HYPYFcRrxMQ X-Received: by 2002:aa7:824f:: with SMTP id e15mr4046665pfn.192.1547559826947; Tue, 15 Jan 2019 05:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547559826; cv=none; d=google.com; s=arc-20160816; b=WPCb2nCLiix5CM9CXtOXXS6O+W/vaN9rFnWUNeUv2X9ktT0seKREbwLVRP0TLcinGo Y3rbdxN6uI9FiEafZXhJgzZjoWP+CgH/3w9MhALp7VP2tAIVOV25yv38Q6NBwsZATiSg EhBA0g///ugIg/5h9O3pYaI9j8dMBNYjeVw3G8K0iug7lTOli5msJRBhGV9Z0UMqiwg0 PGnnbTRHl6fbuWq/6NEpHSeW5ZsQQA5FcC9VkrjG11W++ZEz+vOAMCVCwuGw6Y/Y/Cwh a0XPvwKXyR2gweKs7TkLWRy3WEhAcF9Ah8pvVScAjCnxet2OKeS8CoL/GisSufDkc39B fHGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rHaRz/YFu2TkFlQhYkbUoD1tDaDdIAc0ipE/WosVR0I=; b=FuIAfoO6ac+SEEm2CeWtAtfYBtX2mD5inZ31PFrGONxECd9xfz0qDUKvFQokVECb43 YQocsnQN/LD9KIKtgCxesUR67YF3bAQPsK6GOCrv1GwMijLuCydAPX1Eimq1OzmSWsZV hFLHJG5hDMHSBE6pxwiRxkzoCbDobmnBb9tGwk83OvzHkqHkMBHdZ0E3Bbq3ZSdYYOs5 YdLeb00cw/DlMdcujOZ4a2TBxknWTImdKGVFJeat+czPwR2ZZGuuyfQzR5fU0x2Y44j3 O9POoQDgX0M504csYW6m3YzYHdWkMBGxhT0hAqWmo5Bxd+DccmAwh9VSsryasMBN6EOo Ss5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si3323194pgl.484.2019.01.15.05.43.46; Tue, 15 Jan 2019 05:43:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729894AbfAONnp (ORCPT + 3 others); Tue, 15 Jan 2019 08:43:45 -0500 Received: from foss.arm.com ([217.140.101.70]:50752 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729245AbfAONno (ORCPT ); Tue, 15 Jan 2019 08:43:44 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8F4BA78; Tue, 15 Jan 2019 05:43:43 -0800 (PST) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 495D93F70D; Tue, 15 Jan 2019 05:43:42 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Hadar Gat , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] crypto: ccree: remove legacy leftover Date: Tue, 15 Jan 2019 15:43:14 +0200 Message-Id: <20190115134318.28712-5-gilad@benyossef.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115134318.28712-1-gilad@benyossef.com> References: <20190115134318.28712-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Hadar Gat Remove legacy code no longer in use. Signed-off-by: Hadar Gat Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_driver.h | 2 -- 1 file changed, 2 deletions(-) -- 2.20.1 diff --git a/drivers/crypto/ccree/cc_driver.h b/drivers/crypto/ccree/cc_driver.h index 5be7fd431b05..33dbf3e6d15d 100644 --- a/drivers/crypto/ccree/cc_driver.h +++ b/drivers/crypto/ccree/cc_driver.h @@ -111,13 +111,11 @@ struct cc_crypto_req { * @cc_base: virt address of the CC registers * @irq: device IRQ number * @irq_mask: Interrupt mask shadow (1 for masked interrupts) - * @fw_ver: SeP loaded firmware version */ struct cc_drvdata { void __iomem *cc_base; int irq; u32 irq_mask; - u32 fw_ver; struct completion hw_queue_avail; /* wait for HW queue availability */ struct platform_device *plat_dev; cc_sram_addr_t mlli_sram_addr; From patchwork Tue Jan 15 13:43:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 155663 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4906946jaa; Tue, 15 Jan 2019 05:43:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN7iLiVJqE77cdBDV3iM4fkCzB1/f3VsdnPLmrYTfvDie/8HPUEySn+V4Ci7onA9gvRRLOov X-Received: by 2002:a63:1f4e:: with SMTP id q14mr3816521pgm.88.1547559833023; Tue, 15 Jan 2019 05:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547559833; cv=none; d=google.com; s=arc-20160816; b=c7L78lME0KLUFfUic8qgQ68oQvvjmDwpIs2ZIv0dBvxl3vhfGJcvoP8vWzvN+3Ovfb uSC8QJCaZdNLYoEvowXCszkz0vqFNN2FoFtpMZCQ+Gc1t3Ouvfy6K0hGkYzKcmrJWRwC B1SHvIFFHNxLYAXcRzNFOmBg1BI3NmxKe6Vm+7X4ADxTfTLtv1iFrjWFYOxH9Omh0BJk emnfEFwnYe+JMmfsW74hwXoZ+byuCFQ/oz9ApQHe/BxUFbtArd67wptdFURQzVNZ+NoY D1Vpwsbx4Bkac7yVEcxIre++MedFft+tlxm5+QAB1uCql33/sF0mPuc2KuHN7PrxJe+v Sz1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DkkOFLCRY1Rs0mC8ft4dBl/ezNUqYq/LhcW9/oOEYh4=; b=ZRnJ1QIyIGdpEF5rdsO8tecrn+r2udpw5qGJy82YPHk6V1O+cT1xZe/WRXf7RL9m4C Yzi5/G9uIx3O+YxvUeY9LaE5QtE6N2Ijw9p2VaGlPrmq0VPd/3tRbX+fs/HBVFUGSIVc qiA/iyaDgRYpA1WY+cP229pRCKwTNfrKZxPzKKcjtuTdiGfVZLXpL1Xfs60zN9fpU7Lb q8cvoayex7mscCS1MQn2x/jDY8BXr35ZQbAXlp/uRhzhMdeQUUqEek3gGBHwDeJ/+MTV cUjIw5wfCPP0oKjVge9F+cCp+bDxsxOPZukzZDKXH9fmvh9l+jMxzeigy29OEuhNzE54 4+7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si3284248pfn.111.2019.01.15.05.43.52; Tue, 15 Jan 2019 05:43:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729932AbfAONnv (ORCPT + 3 others); Tue, 15 Jan 2019 08:43:51 -0500 Received: from foss.arm.com ([217.140.101.70]:50774 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729925AbfAONnv (ORCPT ); Tue, 15 Jan 2019 08:43:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 14C87A78; Tue, 15 Jan 2019 05:43:51 -0800 (PST) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 893773F70D; Tue, 15 Jan 2019 05:43:49 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: stable@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] crypto: ccree: don't copy zero size ciphertext Date: Tue, 15 Jan 2019 15:43:17 +0200 Message-Id: <20190115134318.28712-8-gilad@benyossef.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115134318.28712-1-gilad@benyossef.com> References: <20190115134318.28712-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org For decryption in CBC mode we need to save the last ciphertext block for use as the next IV. However, we were trying to do this also with zero sized ciphertext resulting in a panic. Fix this by only doing the copy if the ciphertext length is at least of IV size. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org --- drivers/crypto/ccree/cc_cipher.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 98ea53524250..e202d7c7ea00 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -800,7 +800,8 @@ static int cc_cipher_decrypt(struct skcipher_request *req) memset(req_ctx, 0, sizeof(*req_ctx)); - if (ctx_p->cipher_mode == DRV_CIPHER_CBC) { + if ((ctx_p->cipher_mode == DRV_CIPHER_CBC) && + (req->cryptlen >= ivsize)) { /* Allocate and save the last IV sized bytes of the source, * which will be lost in case of in-place decryption.