From patchwork Sun Dec 3 13:58:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120466 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3363579qgn; Sun, 3 Dec 2017 06:01:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMbKpAkZVi46I9IpNDW3cjX+JFAAYGgmEumGW99Jvt6MEk9B+fxA86QJo8ZzitbedDAv19nq X-Received: by 10.98.222.197 with SMTP id h188mr16461375pfg.132.1512309706863; Sun, 03 Dec 2017 06:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309706; cv=none; d=google.com; s=arc-20160816; b=MUh05dlpVSWVSIeWvrq5gbpwgIvFppx5Es0Ca56pSWbkkxHpP7kr2pADbCqep36z51 mLDUYDSiagLImtH1wGGNUehCSVwafpqZNdWiG4cBs+0GeU1oThE3jAlLhUqMpALCWtUc fT/QAy6q72RNAsYU9/FgXgMjVkKJxRLKLoSlT0QVaokHXPlhBbFGShOEAcmVywiWDPFV K/GuV+jCSqk5nXsA4p+GSB/V2GkYgNaCahI6+m/Jdu9J/hcSxsFmudtG6+G/+JWytzc7 zP+rUFEBr/NUUC3Iyjdx2JNVXCz4bAOdl/LoAkueLkRJu4mmbkS/UmKdQqmhJdpYjXrl UCgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=USYFzZYqVBoqQCNzayYPBscsAXb9fXkMvBb45gaoAlM=; b=qMizewlxO+4Q1oBpHX8EA+lZWXgspWxYLKcGX9WW9VQ9KKNgZO7x11K7/BArHF6PQx ZCY/Ddbu2FpfLdy0NHD8znyXEXWY/kLtUPWCxe3voLG1hp4XNQj3Hw4z5Hw0SQwbsdP+ b0+ZMl6padyIaTKdX8OczPwE2inR+x7u+dKzdioCXkw4xjZE94Z0r7gP83Z3PdEMDi1g DWOzYwaymTS0Ki5L0ldOtnfCgf/zL81Un+YuUKVsWtstSEFPOsSCp7ghBWsST25+tZcX 7sLg/k8eMasNolFy3w2ezi5y6hO5ycReyAn1DT14EdusMsCFw5XhVAtQ3JuPOP0Z1dmQ OAmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 t8si7948490plz.487.2017.12.03.06.01.46; Sun, 03 Dec 2017 06:01:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752695AbdLCOBp (ORCPT + 28 others); Sun, 3 Dec 2017 09:01:45 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55162 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbdLCN7b (ORCPT ); Sun, 3 Dec 2017 08:59:31 -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 9F9E41529; Sun, 3 Dec 2017 05:59:30 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E059C3F24A; Sun, 3 Dec 2017 05:59:27 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 03/10] staging: ccree: remove more unnecessary parentheses Date: Sun, 3 Dec 2017 13:58:14 +0000 Message-Id: <1512309503-29766-4-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The removal of likely/unlikely unearthed some more unnecessary parentheses. Remove them for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 4 ++-- drivers/staging/ccree/ssi_driver.c | 6 +++--- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 7ceee91..bac9d12 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -882,7 +882,7 @@ static int cc_aead_chain_assoc( else areq_ctx->assoc_buff_type = SSI_DMA_BUF_MLLI; - if ((do_chain) || areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) { + if (do_chain || areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) { dev_dbg(dev, "Chain assoc: buff_type=%s nents=%u\n", cc_dma_buf_type(areq_ctx->assoc_buff_type), areq_ctx->assoc.nents); @@ -1656,7 +1656,7 @@ void cc_unmap_hash_request(struct device *dev, void *ctx, areq_ctx->mlli_params.mlli_dma_addr); } - if ((src) && areq_ctx->in_nents) { + if (src && areq_ctx->in_nents) { dev_dbg(dev, "Unmapped sg src: virt=%pK dma=%pad len=0x%X\n", sg_virt(src), &sg_dma_address(src), sg_dma_len(src)); dma_unmap_sg(dev, src, diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 6282c37..0b2593f 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -111,7 +111,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) drvdata->irq = irr; /* Completion interrupt - most probable */ - if ((irr & SSI_COMP_IRQ_MASK)) { + if (irr & SSI_COMP_IRQ_MASK) { /* Mask AXI completion interrupt - will be unmasked in * Deferred service handler */ @@ -121,7 +121,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) } #ifdef CC_SUPPORT_FIPS /* TEE FIPS interrupt */ - if ((irr & SSI_GPR0_IRQ_MASK)) { + if (irr & SSI_GPR0_IRQ_MASK) { /* Mask interrupt - will be unmasked in Deferred service * handler */ @@ -131,7 +131,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) } #endif /* AXI error interrupt */ - if ((irr & SSI_AXI_ERR_IRQ_MASK)) { + if (irr & SSI_AXI_ERR_IRQ_MASK) { u32 axi_err; /* Read the AXI error ID */ diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 7a653f6..e890cb6 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -221,7 +221,7 @@ static int request_mgr_queues_status_check( return -EBUSY; } - if ((req_mgr_h->q_free_slots >= total_seq_len)) + if (req_mgr_h->q_free_slots >= total_seq_len) return 0; /* Wait for space in HW queue. Poll constant num of iterations. */ From patchwork Sun Dec 3 13:58:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120459 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361139qgn; Sun, 3 Dec 2017 05:59:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ6cea5vhuJM895DZiQj51tuuV6EMbFvQZFgRAck9TuGC7T7jPTNmIqTyKYh3KfwrQf2Yt2 X-Received: by 10.99.188.2 with SMTP id q2mr8125464pge.332.1512309584004; Sun, 03 Dec 2017 05:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309583; cv=none; d=google.com; s=arc-20160816; b=Fv2p/SNx9A7S1duOl6Q4Ld7Flpfhxntz1qe1adY/1Ro8RfEKQexTQp8S4cKbh+ptro fQySIi4GhU9A7ps1Q0SaVTeIjsQ2UxdFtBIupLwVf4biRig5QO0cJsJTjStnvY74/Gbo u3U66LTr5jRmW8yAEyNUfOSsQlE1amThg8thAAEC7m94tPVNlM0v2//jaRFxTgVIFFPR RR4qLVZkuu9CeUDvijihgZa//UiQanTnWY8S1Brc5oXz2nwgOup84mtT7LAj6tUAzlfd +V2CRfTSbhs4C8w84xnBWpZn2wypGCW+CmO2AY0AykJ8II1Op6tX4tKJnOGEdsxz16Gp ORuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HbFFKB11ltD4QV9lxPV6QexI7jMKAAouge5gpzem7S8=; b=eiXjdo3IG6d9k/xDQ3Q01uJNuxDl0+UtTBS6LKKS3BBjou443g3Ifq48dLWE8ER3cg 1fgarzMhTJ72I+00o/MDKBy/uZ2l49Y/aDqRp0S+NRxSZzOHejvCQ9CB7RWJRyMeDvsB pF9Zwkhl2M8k8TWzgDwOUUCynsktXFg0tJh+r5buUUgIm+G3dJ190HWUgeHpLtgAuIFc J/HHZ7w0MsmznY1KWkD6Z4/+rOJ52Mj/1FiAs0S292QzjtUH/ZaXhz0TrbPZQZbiGqRF 18h5RMJMKYMltkg2JbAR6oBj/FZZ6EX4zZQQxXjNiB1FfMblDs4r8myd4yOBGQt0ZWag J7xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e6si7812636pgr.80.2017.12.03.05.59.43; Sun, 03 Dec 2017 05:59:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbdLCN7l (ORCPT + 28 others); Sun, 3 Dec 2017 08:59:41 -0500 Received: from foss.arm.com ([217.140.101.70]:55170 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752362AbdLCN7g (ORCPT ); Sun, 3 Dec 2017 08:59:36 -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 BF7D11529; Sun, 3 Dec 2017 05:59:35 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 423213F24A; Sun, 3 Dec 2017 05:59:33 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 04/10] staging: ccree: fix indentation of var assignment Date: Sun, 3 Dec 2017 13:58:15 +0000 Message-Id: <1512309503-29766-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix indentation of var assignment split across lines for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 0b085dc..f214df7 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -1238,10 +1238,10 @@ static enum cc_flow_mode ssi_aead_get_data_flow_mode( } else { /* Decrypt */ if (setup_flow_mode == S_DIN_to_AES) data_flow_mode = is_single_pass ? - AES_and_HASH : DIN_AES_DOUT; + AES_and_HASH : DIN_AES_DOUT; else data_flow_mode = is_single_pass ? - DES_and_HASH : DIN_DES_DOUT; + DES_and_HASH : DIN_DES_DOUT; } return data_flow_mode; From patchwork Sun Dec 3 13:58:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120460 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361201qgn; Sun, 3 Dec 2017 05:59:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMbJExnf0s2W0fYdT4drB8CIdskHqFHdLukNLKtvvUBtDOBwcpPZlyuhAsp4K1cv48jG3y+m X-Received: by 10.159.206.200 with SMTP id x8mr11785838plo.273.1512309591104; Sun, 03 Dec 2017 05:59:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309591; cv=none; d=google.com; s=arc-20160816; b=mciss2rkL7aFp6zySNTd1um0OiT+3kLky/Grw7ueRWfpaL9I9Po0pOEfWCEJ6NMlRe Mdlt0b0l9TWG0dj0tkNMHFHlqDY+oQSjDp70UYnAjEIKjHydxevGnGMlNcUWeqvJhHa9 qWxyie2s004ZZ+c/Whthjcu10apSSP8S6fVeb0xnh1mZTuGToUfpQd8XzkCaa58tR1hx YKFGajv7UbNace+aO7rBEyRiKIHmPuWLNwMsvZkO2WhxvstiNyw+oJPOlNKty0OkpMk2 vVWFDqI6kqXTyXwmHpAamjjvfT1ucTFYrnju7i/iOh1B+vYWCZgyJnXT5ynaTyG4ZYVv YM+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=IPA1aZSudNJXHud9kW0f4ZraL+8ihlpWNn7IPC0Cvoc=; b=GSQomLHFEgU+3NJAN9NYKdC8mlb9xUtJtccli7pFBRSt+bWltunMguqqP8kvY4YmN8 Rm/wUOi2vAusChAj8CWtzRYs9xXr8UABvcpCSTk5OkDmz+G5xSmLW6lelDp5QNXeBuST zoQ3yTQZm1UpujrINnkHhxdbGa48cWgm5b7DUOe3BMDlRI4fhkoP8k1ZN1KGPgfvz2T+ fUoxkcRPTHFlm7+Nxb59fc0MW/iJeX9A8N+8UuLutz9JX20XkTvdA4Hc693e7EALtglx nMdTPcRyCyPF5eQXv4v9pcMdBtUy1s2t7eB6Qzso+4lKkUzPQI4OAOtKieagAv9p1rS/ ruMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 r11si7813281pgp.512.2017.12.03.05.59.50; Sun, 03 Dec 2017 05:59:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbdLCN7s (ORCPT + 28 others); Sun, 3 Dec 2017 08:59:48 -0500 Received: from foss.arm.com ([217.140.101.70]:55184 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbdLCN7l (ORCPT ); Sun, 3 Dec 2017 08:59:41 -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 CC5A81529; Sun, 3 Dec 2017 05:59:40 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4F0433F24A; Sun, 3 Dec 2017 05:59:38 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 05/10] staging: ccree: remove braces for single statement blocks Date: Sun, 3 Dec 2017 13:58:16 +0000 Message-Id: <1512309503-29766-6-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove braces from single statement if clause. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e890cb6..5f34336 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -228,9 +228,8 @@ static int request_mgr_queues_status_check( for (poll_queue = 0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue++) { req_mgr_h->q_free_slots = cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT)); - if (req_mgr_h->q_free_slots < req_mgr_h->min_free_hw_slots) { + if (req_mgr_h->q_free_slots < req_mgr_h->min_free_hw_slots) req_mgr_h->min_free_hw_slots = req_mgr_h->q_free_slots; - } if (req_mgr_h->q_free_slots >= total_seq_len) { /* If there is enough place return */ From patchwork Sun Dec 3 13:58:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120461 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361273qgn; Sun, 3 Dec 2017 05:59:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMbIp03X/DoHooSHKZt3i6h7QpnKGeO1WhMcsk2BFRUmfOpSVcTx6tjI06SqVcn9MzwcP9DZ X-Received: by 10.98.147.28 with SMTP id b28mr16258073pfe.5.1512309598677; Sun, 03 Dec 2017 05:59:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309598; cv=none; d=google.com; s=arc-20160816; b=C3eXQlAxF4stLIM8/VmmdiKFxrSibxNDYEWbZg4sixyKHkLkXCisDhiejXij8G8V5Z Vb6P+sdWKjVuWfV8YDSSjyIlmU3hxCq7IR3uox+4R0LCaq/7nT5rklnU5tNfuZvl1SbS dfcMhSHyZlps3JaaqKpxVTQhg/5G370BdJMDWZmomafWGPabzlrBa+lK2LYrOOcnkZx7 yrTfFtFMyUV4NTaqIcPLe5llgpyrC3HA3qvmDZf7ASQ0YFkbvGRDNeEz4SVK34Vg5vcO 3yD/GdiIdNJc1OK04vVgYOT/gw7ud8bf56+75e3lDsoF2wK6TUmgV6+F/taiQP9aNCO/ gFzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=q8EUdrzw+Vmtots5wFQMCfJaG/WCynTt14rXOh/sQ3w=; b=nZmOdyMsUdrL0OQBSLJCDiSebl2M0s01xxMVlEQCtBrhYqtAdcDqXzF2Z/F4zA7MX/ bOdKVimNvAfa6V7KyyKRCJXcQWyUkhIEJVI6sNkvLix2VIrzu1c/NbatImGdkqYUlRRV lV7frqZi0EYjTQYcRKK1U2rBddTN9cVe9rb3t5NYXccpqG02yuVW0wAmnxnDL2uV6qlQ 4frX0K9ntfX8YKkb+bSuhf6GxBFpdm0fi7RUuzzCZX52W/e6DjnUOnwHOQoU5KEpTXCc +CwoFODUrSBpByCVSBBDhI22BXIAyxdWSOhVRZdA1Oozw6tcZzDvvLHgQcVcyPcxbP8y epWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 d3si7773936pgq.709.2017.12.03.05.59.58; Sun, 03 Dec 2017 05:59:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752584AbdLCN7z (ORCPT + 28 others); Sun, 3 Dec 2017 08:59:55 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55202 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbdLCN7u (ORCPT ); Sun, 3 Dec 2017 08:59:50 -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 CE6CC1529; Sun, 3 Dec 2017 05:59:49 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E73A03F24A; Sun, 3 Dec 2017 05:59:47 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 07/10] staging: ccree: update TODO list Date: Sun, 3 Dec 2017 13:58:18 +0000 Message-Id: <1512309503-29766-8-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update the ccree staging TODO list in light of recent work. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/TODO | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/TODO b/drivers/staging/ccree/TODO index c9f5754..f44edcd 100644 --- a/drivers/staging/ccree/TODO +++ b/drivers/staging/ccree/TODO @@ -6,25 +6,6 @@ * * ************************************************************************* -ccree specific items -a.k.a stuff fixing for this driver to move out of staging -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +1. Migrate sysfs to debugfs. +2. Handle HW FIFO fullness more cleanly. -1. Move to using Crypto Engine to handle backlog queueing. -2. Remove synchronous algorithm support leftovers. -3. Separate platform specific code for FIPS and power management into separate platform modules. -4. Drop legacy kernel support code. -5. Move most (all?) #ifdef CONFIG into inline functions. -6. Remove all unused definitions. -7. Re-factor to accomediate newer/older HW revisions besides the 712. -8. Handle the many checkpatch errors. -9. Implement ahash import/export correctly. -10. Go through a proper review of DT bindings and sysfs ABI -11. Sort out FIPS mode: bake tests into testmgr, sort out behaviour on error, - figure if 3DES weak key check is needed - -Kernel infrastructure items -a.k.a stuff we either neither need to fix in the kernel or understand what we're doing wrong -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -1. ahash import/export context has a PAGE_SIZE/8 size limit. We need more. -2. Crypto Engine seems to be built for HW with hardware queue depth of 1, we have 600++. From patchwork Sun Dec 3 13:58:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120462 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361345qgn; Sun, 3 Dec 2017 06:00:04 -0800 (PST) X-Google-Smtp-Source: AGs4zMbzA5bcpWxv0WQDKo8m29jclHAW2zfUwqB85HwaPhrNWHJamibsuQBkTWA428B17G6r1TsK X-Received: by 10.159.198.134 with SMTP id g6mr11775605plo.42.1512309604658; Sun, 03 Dec 2017 06:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309604; cv=none; d=google.com; s=arc-20160816; b=oqu68kt93d8UnfLDaL7aBc4KM5QqpSsuhy4757FjsMSlJwPsu6nPtmbz5kPdUZe0So 7qZoGUeTCQPNRzBvx/5hW2iO/tIsEP+7nHse0XqKqsrWU+yx8EFJXvtEFMXKYzINPGbt JaiGjV/riUD9EZOmAnP/tPNafp8ud06/ehVEeMeOMLX16jurQulbyudFOQmFa2XRkMjb JARr5v11P5rLS/uIG5xD47Qn21m9dzRJaT3s0Obb8gj5zct0U0h9ZMb1zQpI1gNuUA6k vZllcudFbqGsqvLu0tHAScLDrkw5GZ6p3C8JfAtRZ093y28RXBXPCnyaoR+5czO/SBjL GGTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=nld4jAm1EGyD4c/IovAn0l8jAfFL9iqwPzqDB9cfMhM=; b=HtoDk5IkO3CwaaTFjdHl8px0AdoHwTEcX8BYg+klC5dWG96tMIr7mPxG+45mQFxbp1 uOUwGKdn7V/FWekAJJFOyzWtWQxKmSLkSvC3hjpfM51r2pP51f7aUe1wFePBmgOOkQAy cf/O8BfqcLz0pThLzm/J+NAsUUZI+g19VOX50UfnSMg1a50uE2ryZ+VAL5A5nJe/D5P/ jzp7Ek1gFltGcbUAyYeDluHzuXr4aZuhCpG+Z9oQQxOlKdCfW5EoknrDAt/vVH5jMrp3 gNDfy59O/yXHQfO1huXYxhzh9MWDTftvttX4FklVPNBPoYsRMPj45ZhfLtvERjZFNZYj 2q9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 d3si7773936pgq.709.2017.12.03.06.00.04; Sun, 03 Dec 2017 06:00:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209AbdLCOAD (ORCPT + 28 others); Sun, 3 Dec 2017 09:00:03 -0500 Received: from foss.arm.com ([217.140.101.70]:55214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbdLCN7z (ORCPT ); Sun, 3 Dec 2017 08:59:55 -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 592601529; Sun, 3 Dec 2017 05:59:55 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3CBF83F24A; Sun, 3 Dec 2017 05:59:53 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 08/10] staging: ccree: NULLify backup_info when unused Date: Sun, 3 Dec 2017 13:58:19 +0000 Message-Id: <1512309503-29766-9-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org backup_info field is only allocated for decrypt code path. The field was not nullified when not used causing a kfree in an error handling path to attempt to free random addresses as uncovered in stress testing. Fixes: 737aed947f9b ("staging: ccree: save ciphertext for CTS IV") Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_cipher.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 9019615..7b484f1 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -907,6 +907,7 @@ static int ssi_ablkcipher_encrypt(struct ablkcipher_request *req) unsigned int ivsize = crypto_ablkcipher_ivsize(ablk_tfm); req_ctx->is_giv = false; + req_ctx->backup_info = NULL; return ssi_blkcipher_process(tfm, req_ctx, req->dst, req->src, req->nbytes, req->info, ivsize, From patchwork Sun Dec 3 13:58:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120463 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361462qgn; Sun, 3 Dec 2017 06:00:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMZmiOnX3mNAsWyKQ8WZFFacGivc944Tn3GsI/e0ycWXC5HcwSUCj7ffTYhrO8Gu4fI9K0SX X-Received: by 10.98.103.156 with SMTP id t28mr8462352pfj.234.1512309610621; Sun, 03 Dec 2017 06:00:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309610; cv=none; d=google.com; s=arc-20160816; b=ex6VpKggy8fOLsXaxtE+Zr/Kd52/nIUtHVnR7oBcHfFf5RI1wZxgGhCa+Oic3yIvYK b8zepn1Llt13LF642fp8zVWhET7smUpuRx5eeqs0S2iBtDfkJoTy1YPHobkWi9FXiYeI Zt7cB9YWe/9MJSlMuSidQqqlk88Qu7ExkSQfjOAIIR+Mn7uVBy4ypxTf16xFgbZGL/9y t6B551xOhCvyJJWmQHvi7Yy7D6Nf++jmDX+HIIdHd4Uppj/A1hECVDxEomiOU7ervwaa SgzF7CEwrQCuQwTTGxB1S6knvXju+85z6hA70MXB1u8uEGew2pPQy3KxLSSqfYkCo9Ws OxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5ucKxQznqTAfw87a4rsnrd3xy/EDFpMwcXtrIZHVXbk=; b=Zq8twwKIAnAOyfRGLg83uyH+ltTX7s5HMRwkxhFIXwT/yEKl3+RMWfGvraJo+zFYle 2pBySvz/CAeMqdpyPJZn0F2YGmUQVEnL8I8ES7TMTNCyu/dV424jplTO9hG2uBIEk0H0 BqHbm9VDhGmAG/mmTz2QPpGiQkYPvujWmdRE9EvaQrflXfaqOw84UttZ/Y0Bnz4XZ+7C L3pypQoxS7E3S2LyRJPRnKGtQP8W7RYlcnT7ge1+NbJfJ6HKjQ6eHxtuoetwdy/rjyWc UQn+T0mrZD4cPo46jcNT574ZXX8P4QhEyvKieKian3HmO261fznCioyyVIlMhIzjnhKO rCAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 r20si8550694pfb.51.2017.12.03.06.00.10; Sun, 03 Dec 2017 06:00:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752628AbdLCOAJ (ORCPT + 28 others); Sun, 3 Dec 2017 09:00:09 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55224 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbdLCOAC (ORCPT ); Sun, 3 Dec 2017 09:00:02 -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 60AF41529; Sun, 3 Dec 2017 06:00:02 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DB283F24A; Sun, 3 Dec 2017 05:59:58 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 09/10] staging: ccree: fix AEAD func naming convention Date: Sun, 3 Dec 2017 13:58:20 +0000 Message-Id: <1512309503-29766-10-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The aead files was using a func naming convention which was inconsistent (ssi vs. cc), included a useless prefix (ssi_aead) and often used too long function names producing monster func names such as ssi_aead_gcm_setup_ghash_desc() that made the call site code hard to read. Make the code more readable by switching to a simpler, consistent naming conventionfor all the function defined in the file. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c | 544 ++++++++++++++++++------------------- drivers/staging/ccree/ssi_aead.h | 4 +- drivers/staging/ccree/ssi_driver.c | 6 +- 3 files changed, 273 insertions(+), 281 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index f214df7..54edd99 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -51,7 +51,7 @@ /* Value of each ICV_CMP byte (of 8) in case of success */ #define ICV_VERIF_OK 0x01 -struct ssi_aead_handle { +struct cc_aead_handle { ssi_sram_addr_t sram_workspace_addr; struct list_head aead_list; }; @@ -68,7 +68,7 @@ struct cc_xcbc_s { dma_addr_t xcbc_keys_dma_addr; }; -struct ssi_aead_ctx { +struct cc_aead_ctx { struct ssi_drvdata *drvdata; u8 ctr_nonce[MAX_NONCE_SIZE]; /* used for ctr3686 iv and aes ccm */ u8 *enckey; @@ -90,9 +90,9 @@ static inline bool valid_assoclen(struct aead_request *req) return ((req->assoclen == 16) || (req->assoclen == 20)); } -static void ssi_aead_exit(struct crypto_aead *tfm) +static void cc_aead_exit(struct crypto_aead *tfm) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); dev_dbg(dev, "Clearing context @%p for %s\n", crypto_aead_ctx(tfm), @@ -144,10 +144,10 @@ static void ssi_aead_exit(struct crypto_aead *tfm) } } -static int ssi_aead_init(struct crypto_aead *tfm) +static int cc_aead_init(struct crypto_aead *tfm) { struct aead_alg *alg = crypto_aead_alg(tfm); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct ssi_crypto_alg *ssi_alg = container_of(alg, struct ssi_crypto_alg, aead_alg); struct device *dev = drvdata_to_dev(ssi_alg->drvdata); @@ -222,16 +222,16 @@ static int ssi_aead_init(struct crypto_aead *tfm) return 0; init_failed: - ssi_aead_exit(tfm); + cc_aead_exit(tfm); return -ENOMEM; } -static void ssi_aead_complete(struct device *dev, void *ssi_req) +static void cc_aead_complete(struct device *dev, void *ssi_req) { struct aead_request *areq = (struct aead_request *)ssi_req; struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); struct crypto_aead *tfm = crypto_aead_reqtfm(ssi_req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); int err = 0; cc_unmap_aead_request(dev, areq); @@ -277,7 +277,7 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req) aead_request_complete(areq, err); } -static int xcbc_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) +static int xcbc_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx) { /* Load the AES key */ hw_desc_init(&desc[0]); @@ -317,7 +317,7 @@ static int xcbc_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) return 4; } -static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) +static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx) { unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST }; unsigned int digest_ofs = 0; @@ -386,7 +386,7 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) return idx; } -static int validate_keys_sizes(struct ssi_aead_ctx *ctx) +static int validate_keys_sizes(struct cc_aead_ctx *ctx) { struct device *dev = drvdata_to_dev(ctx->drvdata); @@ -435,11 +435,11 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx) * (copy to intenral buffer or hash in case of key longer than block */ static int -ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, - unsigned int keylen) +cc_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, + unsigned int keylen) { dma_addr_t key_dma_addr = 0; - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); u32 larval_addr = cc_larval_digest_addr(ctx->drvdata, ctx->auth_mode); struct ssi_crypto_req ssi_req = {}; @@ -557,9 +557,9 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, } static int -ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) +cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct rtattr *rta = (struct rtattr *)key; struct ssi_crypto_req ssi_req = {}; struct crypto_authenc_key_param *param; @@ -619,7 +619,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { memcpy(ctx->auth_state.xcbc.xcbc_keys, key, ctx->auth_keylen); } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC */ - rc = ssi_get_plain_hmac_key(tfm, key, ctx->auth_keylen); + rc = cc_get_plain_hmac_key(tfm, key, ctx->auth_keylen); if (rc) goto badkey; } @@ -663,10 +663,10 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) } #if SSI_CC_HAS_AES_CCM -static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, - unsigned int keylen) +static int cc_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, + unsigned int keylen) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); if (keylen < 3) return -EINVAL; @@ -674,15 +674,15 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, keylen -= 3; memcpy(ctx->ctr_nonce, key + keylen, 3); - return ssi_aead_setkey(tfm, key, keylen); + return cc_aead_setkey(tfm, key, keylen); } #endif /*SSI_CC_HAS_AES_CCM*/ -static int ssi_aead_setauthsize( +static int cc_aead_setauthsize( struct crypto_aead *authenc, unsigned int authsize) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc); + struct cc_aead_ctx *ctx = crypto_aead_ctx(authenc); struct device *dev = drvdata_to_dev(ctx->drvdata); /* Unsupported auth. sizes */ @@ -698,8 +698,8 @@ static int ssi_aead_setauthsize( } #if SSI_CC_HAS_AES_CCM -static int ssi_rfc4309_ccm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) +static int cc_rfc4309_ccm_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { switch (authsize) { case 8: @@ -710,11 +710,11 @@ static int ssi_rfc4309_ccm_setauthsize(struct crypto_aead *authenc, return -EINVAL; } - return ssi_aead_setauthsize(authenc, authsize); + return cc_aead_setauthsize(authenc, authsize); } -static int ssi_ccm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) +static int cc_ccm_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { switch (authsize) { case 4: @@ -729,19 +729,19 @@ static int ssi_ccm_setauthsize(struct crypto_aead *authenc, return -EINVAL; } - return ssi_aead_setauthsize(authenc, authsize); + return cc_aead_setauthsize(authenc, authsize); } #endif /*SSI_CC_HAS_AES_CCM*/ static void -ssi_aead_create_assoc_desc( +cc_set_assoc_desc( struct aead_request *areq, unsigned int flow_mode, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(areq); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); enum ssi_req_dma_buf_type assoc_dma_type = areq_ctx->assoc_buff_type; unsigned int idx = *seq_size; @@ -777,7 +777,7 @@ ssi_aead_create_assoc_desc( } static void -ssi_aead_process_authenc_data_desc( +cc_proc_authen_desc( struct aead_request *areq, unsigned int flow_mode, struct cc_hw_desc desc[], @@ -788,7 +788,7 @@ ssi_aead_process_authenc_data_desc( enum ssi_req_dma_buf_type data_dma_type = areq_ctx->data_buff_type; unsigned int idx = *seq_size; struct crypto_aead *tfm = crypto_aead_reqtfm(areq); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); switch (data_dma_type) { @@ -844,7 +844,7 @@ ssi_aead_process_authenc_data_desc( } static void -ssi_aead_process_cipher_data_desc( +cc_proc_cipher_desc( struct aead_request *areq, unsigned int flow_mode, struct cc_hw_desc desc[], @@ -854,7 +854,7 @@ ssi_aead_process_cipher_data_desc( struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); enum ssi_req_dma_buf_type data_dma_type = areq_ctx->data_buff_type; struct crypto_aead *tfm = crypto_aead_reqtfm(areq); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); if (areq_ctx->cryptlen == 0) @@ -891,13 +891,13 @@ ssi_aead_process_cipher_data_desc( *seq_size = (++idx); } -static void ssi_aead_process_digest_result_desc( +static void cc_proc_digest_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int idx = *seq_size; unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? @@ -942,13 +942,13 @@ static void ssi_aead_process_digest_result_desc( *seq_size = (++idx); } -static void ssi_aead_setup_cipher_desc( +static void cc_set_cipher_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int hw_iv_size = req_ctx->hw_iv_size; unsigned int idx = *seq_size; @@ -988,7 +988,7 @@ static void ssi_aead_setup_cipher_desc( *seq_size = idx; } -static void ssi_aead_process_cipher( +static void cc_proc_cipher( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size, @@ -1001,8 +1001,8 @@ static void ssi_aead_process_cipher( if (req_ctx->cryptlen == 0) return; /*null processing*/ - ssi_aead_setup_cipher_desc(req, desc, &idx); - ssi_aead_process_cipher_data_desc(req, data_flow_mode, desc, &idx); + cc_set_cipher_desc(req, desc, &idx); + cc_proc_cipher_desc(req, data_flow_mode, desc, &idx); if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* We must wait for DMA to write all cipher */ hw_desc_init(&desc[idx]); @@ -1014,13 +1014,13 @@ static void ssi_aead_process_cipher( *seq_size = idx; } -static void ssi_aead_hmac_setup_digest_desc( +static void cc_set_hmac_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256; unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? @@ -1051,13 +1051,13 @@ static void ssi_aead_hmac_setup_digest_desc( *seq_size = idx; } -static void ssi_aead_xcbc_setup_digest_desc( +static void cc_set_xcbc_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); unsigned int idx = *seq_size; /* Loading MAC state */ @@ -1113,7 +1113,7 @@ static void ssi_aead_xcbc_setup_digest_desc( *seq_size = idx; } -static void ssi_aead_process_digest_header_desc( +static void cc_proc_header_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) @@ -1121,20 +1121,20 @@ static void ssi_aead_process_digest_header_desc( unsigned int idx = *seq_size; /* Hash associated data */ if (req->assoclen > 0) - ssi_aead_create_assoc_desc(req, DIN_HASH, desc, &idx); + cc_set_assoc_desc(req, DIN_HASH, desc, &idx); /* Hash IV */ *seq_size = idx; } -static void ssi_aead_process_digest_scheme_desc( +static void cc_proc_scheme_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); - struct ssi_aead_handle *aead_handle = ctx->drvdata->aead_handle; + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_handle *aead_handle = ctx->drvdata->aead_handle; unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ? DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256; unsigned int digest_size = (ctx->auth_mode == DRV_HASH_SHA1) ? @@ -1192,14 +1192,14 @@ static void ssi_aead_process_digest_scheme_desc( *seq_size = idx; } -static void ssi_aead_load_mlli_to_sram( +static void cc_mlli_to_sram( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); if (req_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI || @@ -1221,7 +1221,7 @@ static void ssi_aead_load_mlli_to_sram( } } -static enum cc_flow_mode ssi_aead_get_data_flow_mode( +static enum cc_flow_mode cc_get_data_flow( enum drv_crypto_direction direct, enum cc_flow_mode setup_flow_mode, bool is_single_pass) @@ -1247,29 +1247,28 @@ static enum cc_flow_mode ssi_aead_get_data_flow_mode( return data_flow_mode; } -static void ssi_aead_hmac_authenc( +static void cc_hmac_authenc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); int direct = req_ctx->gen_ctx.op_type; - unsigned int data_flow_mode = ssi_aead_get_data_flow_mode( + unsigned int data_flow_mode = cc_get_data_flow( direct, ctx->flow_mode, req_ctx->is_single_pass); if (req_ctx->is_single_pass) { /** * Single-pass flow */ - ssi_aead_hmac_setup_digest_desc(req, desc, seq_size); - ssi_aead_setup_cipher_desc(req, desc, seq_size); - ssi_aead_process_digest_header_desc(req, desc, seq_size); - ssi_aead_process_cipher_data_desc(req, data_flow_mode, desc, - seq_size); - ssi_aead_process_digest_scheme_desc(req, desc, seq_size); - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_set_hmac_desc(req, desc, seq_size); + cc_set_cipher_desc(req, desc, seq_size); + cc_proc_header_desc(req, desc, seq_size); + cc_proc_cipher_desc(req, data_flow_mode, desc, seq_size); + cc_proc_scheme_desc(req, desc, seq_size); + cc_proc_digest_desc(req, desc, seq_size); return; } @@ -1280,52 +1279,49 @@ static void ssi_aead_hmac_authenc( */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ - ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); + cc_proc_cipher(req, desc, seq_size, data_flow_mode); /* authenc after..*/ - ssi_aead_hmac_setup_digest_desc(req, desc, seq_size); - ssi_aead_process_authenc_data_desc(req, DIN_HASH, desc, - seq_size, direct); - ssi_aead_process_digest_scheme_desc(req, desc, seq_size); - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_set_hmac_desc(req, desc, seq_size); + cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); + cc_proc_scheme_desc(req, desc, seq_size); + cc_proc_digest_desc(req, desc, seq_size); } else { /*DECRYPT*/ /* authenc first..*/ - ssi_aead_hmac_setup_digest_desc(req, desc, seq_size); - ssi_aead_process_authenc_data_desc(req, DIN_HASH, desc, - seq_size, direct); - ssi_aead_process_digest_scheme_desc(req, desc, seq_size); + cc_set_hmac_desc(req, desc, seq_size); + cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); + cc_proc_scheme_desc(req, desc, seq_size); /* decrypt after.. */ - ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); + cc_proc_cipher(req, desc, seq_size, data_flow_mode); /* read the digest result with setting the completion bit * must be after the cipher operation */ - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_proc_digest_desc(req, desc, seq_size); } } static void -ssi_aead_xcbc_authenc( +cc_xcbc_authenc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); int direct = req_ctx->gen_ctx.op_type; - unsigned int data_flow_mode = ssi_aead_get_data_flow_mode( + unsigned int data_flow_mode = cc_get_data_flow( direct, ctx->flow_mode, req_ctx->is_single_pass); if (req_ctx->is_single_pass) { /** * Single-pass flow */ - ssi_aead_xcbc_setup_digest_desc(req, desc, seq_size); - ssi_aead_setup_cipher_desc(req, desc, seq_size); - ssi_aead_process_digest_header_desc(req, desc, seq_size); - ssi_aead_process_cipher_data_desc(req, data_flow_mode, desc, - seq_size); - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_set_xcbc_desc(req, desc, seq_size); + cc_set_cipher_desc(req, desc, seq_size); + cc_proc_header_desc(req, desc, seq_size); + cc_proc_cipher_desc(req, data_flow_mode, desc, seq_size); + cc_proc_digest_desc(req, desc, seq_size); return; } @@ -1336,27 +1332,25 @@ ssi_aead_xcbc_authenc( */ if (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) { /* encrypt first.. */ - ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); + cc_proc_cipher(req, desc, seq_size, data_flow_mode); /* authenc after.. */ - ssi_aead_xcbc_setup_digest_desc(req, desc, seq_size); - ssi_aead_process_authenc_data_desc(req, DIN_HASH, desc, - seq_size, direct); - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_set_xcbc_desc(req, desc, seq_size); + cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); + cc_proc_digest_desc(req, desc, seq_size); } else { /*DECRYPT*/ /* authenc first.. */ - ssi_aead_xcbc_setup_digest_desc(req, desc, seq_size); - ssi_aead_process_authenc_data_desc(req, DIN_HASH, desc, - seq_size, direct); + cc_set_xcbc_desc(req, desc, seq_size); + cc_proc_authen_desc(req, DIN_HASH, desc, seq_size, direct); /* decrypt after..*/ - ssi_aead_process_cipher(req, desc, seq_size, data_flow_mode); + cc_proc_cipher(req, desc, seq_size, data_flow_mode); /* read the digest result with setting the completion bit * must be after the cipher operation */ - ssi_aead_process_digest_result_desc(req, desc, seq_size); + cc_proc_digest_desc(req, desc, seq_size); } } -static int validate_data_size(struct ssi_aead_ctx *ctx, +static int validate_data_size(struct cc_aead_ctx *ctx, enum drv_crypto_direction direct, struct aead_request *req) { @@ -1455,13 +1449,13 @@ static int set_msg_len(u8 *block, unsigned int msglen, unsigned int csize) return 0; } -static int ssi_aead_ccm( +static int cc_ccm( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int idx = *seq_size; unsigned int cipher_flow_mode; @@ -1525,7 +1519,7 @@ static int ssi_aead_ccm( /* process assoc data */ if (req->assoclen > 0) { - ssi_aead_create_assoc_desc(req, DIN_HASH, desc, &idx); + cc_set_assoc_desc(req, DIN_HASH, desc, &idx); } else { hw_desc_init(&desc[idx]); set_din_type(&desc[idx], DMA_DLLI, @@ -1537,8 +1531,7 @@ static int ssi_aead_ccm( /* process the cipher */ if (req_ctx->cryptlen) - ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, - &idx); + cc_proc_cipher_desc(req, cipher_flow_mode, desc, &idx); /* Read temporal MAC */ hw_desc_init(&desc[idx]); @@ -1583,7 +1576,7 @@ static int ssi_aead_ccm( static int config_ccm_adata(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); struct aead_req_ctx *req_ctx = aead_request_ctx(req); //unsigned int size_of_a = 0, rem_a_size = 0; @@ -1639,10 +1632,10 @@ static int config_ccm_adata(struct aead_request *req) return 0; } -static void ssi_rfc4309_ccm_process(struct aead_request *req) +static void cc_proc_rfc4309_ccm(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); /* L' */ @@ -1666,13 +1659,13 @@ static void ssi_rfc4309_ccm_process(struct aead_request *req) #if SSI_CC_HAS_AES_GCM -static void ssi_aead_gcm_setup_ghash_desc( +static void cc_set_ghash_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int idx = *seq_size; @@ -1746,13 +1739,13 @@ static void ssi_aead_gcm_setup_ghash_desc( *seq_size = idx; } -static void ssi_aead_gcm_setup_gctr_desc( +static void cc_set_gctr_desc( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int idx = *seq_size; @@ -1784,13 +1777,13 @@ static void ssi_aead_gcm_setup_gctr_desc( *seq_size = idx; } -static void ssi_aead_process_gcm_result_desc( +static void cc_proc_gcm_result( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); dma_addr_t mac_result; unsigned int idx = *seq_size; @@ -1850,7 +1843,7 @@ static void ssi_aead_process_gcm_result_desc( *seq_size = idx; } -static int ssi_aead_gcm( +static int cc_gcm( struct aead_request *req, struct cc_hw_desc desc[], unsigned int *seq_size) @@ -1866,37 +1859,36 @@ static int ssi_aead_gcm( //in RFC4543 no data to encrypt. just copy data from src to dest. if (req_ctx->plaintext_authenticate_only) { - ssi_aead_process_cipher_data_desc(req, BYPASS, desc, seq_size); - ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); + cc_proc_cipher_desc(req, BYPASS, desc, seq_size); + cc_set_ghash_desc(req, desc, seq_size); /* process(ghash) assoc data */ - ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size); - ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size); - ssi_aead_process_gcm_result_desc(req, desc, seq_size); + cc_set_assoc_desc(req, DIN_HASH, desc, seq_size); + cc_set_gctr_desc(req, desc, seq_size); + cc_proc_gcm_result(req, desc, seq_size); return 0; } // for gcm and rfc4106. - ssi_aead_gcm_setup_ghash_desc(req, desc, seq_size); + cc_set_ghash_desc(req, desc, seq_size); /* process(ghash) assoc data */ if (req->assoclen > 0) - ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size); - ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size); + cc_set_assoc_desc(req, DIN_HASH, desc, seq_size); + cc_set_gctr_desc(req, desc, seq_size); /* process(gctr+ghash) */ if (req_ctx->cryptlen) - ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, - seq_size); - ssi_aead_process_gcm_result_desc(req, desc, seq_size); + cc_proc_cipher_desc(req, cipher_flow_mode, desc, seq_size); + cc_proc_gcm_result(req, desc, seq_size); return 0; } #ifdef CC_DEBUG -static void ssi_aead_dump_gcm( +static void cc_dump_gcm( const char *title, struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); if (ctx->cipher_mode != DRV_CIPHER_GCTR) @@ -1940,7 +1932,7 @@ static void ssi_aead_dump_gcm( static int config_gcm_context(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *req_ctx = aead_request_ctx(req); struct device *dev = drvdata_to_dev(ctx->drvdata); @@ -1987,10 +1979,10 @@ static int config_gcm_context(struct aead_request *req) return 0; } -static void ssi_rfc4_gcm_process(struct aead_request *req) +static void cc_proc_rfc4_gcm(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); memcpy(areq_ctx->ctr_iv + GCM_BLOCK_RFC4_NONCE_OFFSET, @@ -2003,14 +1995,14 @@ static void ssi_rfc4_gcm_process(struct aead_request *req) #endif /*SSI_CC_HAS_AES_GCM*/ -static int ssi_aead_process(struct aead_request *req, - enum drv_crypto_direction direct) +static int cc_proc_aead(struct aead_request *req, + enum drv_crypto_direction direct) { int rc = 0; int seq_len = 0; struct cc_hw_desc desc[MAX_AEAD_PROCESS_SEQ]; struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); struct device *dev = drvdata_to_dev(ctx->drvdata); struct ssi_crypto_req ssi_req = {}; @@ -2031,7 +2023,7 @@ static int ssi_aead_process(struct aead_request *req, } /* Setup DX request structure */ - ssi_req.user_cb = (void *)ssi_aead_complete; + ssi_req.user_cb = (void *)cc_aead_complete; ssi_req.user_arg = (void *)req; /* Setup request context */ @@ -2138,26 +2130,26 @@ static int ssi_aead_process(struct aead_request *req, /* STAT_PHASE_2: Create sequence */ /* Load MLLI tables to SRAM if necessary */ - ssi_aead_load_mlli_to_sram(req, desc, &seq_len); + cc_mlli_to_sram(req, desc, &seq_len); /*TODO: move seq len by reference */ switch (ctx->auth_mode) { case DRV_HASH_SHA1: case DRV_HASH_SHA256: - ssi_aead_hmac_authenc(req, desc, &seq_len); + cc_hmac_authenc(req, desc, &seq_len); break; case DRV_HASH_XCBC_MAC: - ssi_aead_xcbc_authenc(req, desc, &seq_len); + cc_xcbc_authenc(req, desc, &seq_len); break; #if (SSI_CC_HAS_AES_CCM || SSI_CC_HAS_AES_GCM) case DRV_HASH_NULL: #if SSI_CC_HAS_AES_CCM if (ctx->cipher_mode == DRV_CIPHER_CCM) - ssi_aead_ccm(req, desc, &seq_len); + cc_ccm(req, desc, &seq_len); #endif /*SSI_CC_HAS_AES_CCM*/ #if SSI_CC_HAS_AES_GCM if (ctx->cipher_mode == DRV_CIPHER_GCTR) - ssi_aead_gcm(req, desc, &seq_len); + cc_gcm(req, desc, &seq_len); #endif /*SSI_CC_HAS_AES_GCM*/ break; #endif @@ -2181,7 +2173,7 @@ static int ssi_aead_process(struct aead_request *req, return rc; } -static int ssi_aead_encrypt(struct aead_request *req) +static int cc_aead_encrypt(struct aead_request *req) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc; @@ -2193,7 +2185,7 @@ static int ssi_aead_encrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_ENCRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2201,13 +2193,13 @@ static int ssi_aead_encrypt(struct aead_request *req) } #if SSI_CC_HAS_AES_CCM -static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) +static int cc_rfc4309_ccm_encrypt(struct aead_request *req) { - /* Very similar to ssi_aead_encrypt() above. */ + /* Very similar to cc_aead_encrypt() above. */ struct aead_req_ctx *areq_ctx = aead_request_ctx(req); struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); int rc = -EINVAL; @@ -2221,9 +2213,9 @@ static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) areq_ctx->backup_giv = NULL; areq_ctx->is_gcm4543 = true; - ssi_rfc4309_ccm_process(req); + cc_proc_rfc4309_ccm(req); - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_ENCRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; out: @@ -2231,7 +2223,7 @@ static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) } #endif /* SSI_CC_HAS_AES_CCM */ -static int ssi_aead_decrypt(struct aead_request *req) +static int cc_aead_decrypt(struct aead_request *req) { struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc; @@ -2243,7 +2235,7 @@ static int ssi_aead_decrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_DECRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2251,10 +2243,10 @@ static int ssi_aead_decrypt(struct aead_request *req) } #if SSI_CC_HAS_AES_CCM -static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) +static int cc_rfc4309_ccm_decrypt(struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc = -EINVAL; @@ -2269,9 +2261,9 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) areq_ctx->backup_giv = NULL; areq_ctx->is_gcm4543 = true; - ssi_rfc4309_ccm_process(req); + cc_proc_rfc4309_ccm(req); - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_DECRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2282,10 +2274,10 @@ static int ssi_rfc4309_ccm_decrypt(struct aead_request *req) #if SSI_CC_HAS_AES_GCM -static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, - unsigned int keylen) +static int cc_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, + unsigned int keylen) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); dev_dbg(dev, "%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2296,13 +2288,13 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - return ssi_aead_setkey(tfm, key, keylen); + return cc_aead_setkey(tfm, key, keylen); } -static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, - unsigned int keylen) +static int cc_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, + unsigned int keylen) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); dev_dbg(dev, "%s() keylen %d, key %p\n", __func__, keylen, key); @@ -2313,11 +2305,11 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, keylen -= 4; memcpy(ctx->ctr_nonce, key + keylen, 4); - return ssi_aead_setkey(tfm, key, keylen); + return cc_aead_setkey(tfm, key, keylen); } -static int ssi_gcm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) +static int cc_gcm_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { switch (authsize) { case 4: @@ -2332,13 +2324,13 @@ static int ssi_gcm_setauthsize(struct crypto_aead *authenc, return -EINVAL; } - return ssi_aead_setauthsize(authenc, authsize); + return cc_aead_setauthsize(authenc, authsize); } -static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) +static int cc_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc); + struct cc_aead_ctx *ctx = crypto_aead_ctx(authenc); struct device *dev = drvdata_to_dev(ctx->drvdata); dev_dbg(dev, "authsize %d\n", authsize); @@ -2352,13 +2344,13 @@ static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, return -EINVAL; } - return ssi_aead_setauthsize(authenc, authsize); + return cc_aead_setauthsize(authenc, authsize); } -static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, - unsigned int authsize) +static int cc_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { - struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc); + struct cc_aead_ctx *ctx = crypto_aead_ctx(authenc); struct device *dev = drvdata_to_dev(ctx->drvdata); dev_dbg(dev, "authsize %d\n", authsize); @@ -2366,15 +2358,15 @@ static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc, if (authsize != 16) return -EINVAL; - return ssi_aead_setauthsize(authenc, authsize); + return cc_aead_setauthsize(authenc, authsize); } -static int ssi_rfc4106_gcm_encrypt(struct aead_request *req) +static int cc_rfc4106_gcm_encrypt(struct aead_request *req) { - /* Very similar to ssi_aead_encrypt() above. */ + /* Very similar to cc_aead_encrypt() above. */ struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc = -EINVAL; @@ -2390,19 +2382,19 @@ static int ssi_rfc4106_gcm_encrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; - ssi_rfc4_gcm_process(req); + cc_proc_rfc4_gcm(req); areq_ctx->is_gcm4543 = true; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_ENCRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; out: return rc; } -static int ssi_rfc4543_gcm_encrypt(struct aead_request *req) +static int cc_rfc4543_gcm_encrypt(struct aead_request *req) { - /* Very similar to ssi_aead_encrypt() above. */ + /* Very similar to cc_aead_encrypt() above. */ struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc; @@ -2414,22 +2406,22 @@ static int ssi_rfc4543_gcm_encrypt(struct aead_request *req) areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - ssi_rfc4_gcm_process(req); + cc_proc_rfc4_gcm(req); areq_ctx->is_gcm4543 = true; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_ENCRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_ENCRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; return rc; } -static int ssi_rfc4106_gcm_decrypt(struct aead_request *req) +static int cc_rfc4106_gcm_decrypt(struct aead_request *req) { - /* Very similar to ssi_aead_decrypt() above. */ + /* Very similar to cc_aead_decrypt() above. */ struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm); + struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc = -EINVAL; @@ -2445,19 +2437,19 @@ static int ssi_rfc4106_gcm_decrypt(struct aead_request *req) areq_ctx->plaintext_authenticate_only = false; - ssi_rfc4_gcm_process(req); + cc_proc_rfc4_gcm(req); areq_ctx->is_gcm4543 = true; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_DECRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; out: return rc; } -static int ssi_rfc4543_gcm_decrypt(struct aead_request *req) +static int cc_rfc4543_gcm_decrypt(struct aead_request *req) { - /* Very similar to ssi_aead_decrypt() above. */ + /* Very similar to cc_aead_decrypt() above. */ struct aead_req_ctx *areq_ctx = aead_request_ctx(req); int rc; @@ -2469,10 +2461,10 @@ static int ssi_rfc4543_gcm_decrypt(struct aead_request *req) areq_ctx->backup_iv = req->iv; areq_ctx->backup_giv = NULL; - ssi_rfc4_gcm_process(req); + cc_proc_rfc4_gcm(req); areq_ctx->is_gcm4543 = true; - rc = ssi_aead_process(req, DRV_CRYPTO_DIRECTION_DECRYPT); + rc = cc_proc_aead(req, DRV_CRYPTO_DIRECTION_DECRYPT); if (rc != -EINPROGRESS) req->iv = areq_ctx->backup_iv; @@ -2488,12 +2480,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = AES_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA1_DIGEST_SIZE, }, @@ -2507,12 +2499,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = DES3_EDE_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA1_DIGEST_SIZE, }, @@ -2526,12 +2518,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = AES_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA256_DIGEST_SIZE, }, @@ -2545,12 +2537,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = DES3_EDE_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA256_DIGEST_SIZE, }, @@ -2564,12 +2556,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = AES_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = AES_BLOCK_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2583,12 +2575,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = CTR_RFC3686_IV_SIZE, .maxauthsize = SHA1_DIGEST_SIZE, }, @@ -2602,12 +2594,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = CTR_RFC3686_IV_SIZE, .maxauthsize = SHA256_DIGEST_SIZE, }, @@ -2621,12 +2613,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_aead_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_aead_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = CTR_RFC3686_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2641,12 +2633,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_ccm_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_ccm_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = AES_BLOCK_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2660,12 +2652,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_rfc4309_ccm_setkey, - .setauthsize = ssi_rfc4309_ccm_setauthsize, - .encrypt = ssi_rfc4309_ccm_encrypt, - .decrypt = ssi_rfc4309_ccm_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_rfc4309_ccm_setkey, + .setauthsize = cc_rfc4309_ccm_setauthsize, + .encrypt = cc_rfc4309_ccm_encrypt, + .decrypt = cc_rfc4309_ccm_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = CCM_BLOCK_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2681,12 +2673,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_aead_setkey, - .setauthsize = ssi_gcm_setauthsize, - .encrypt = ssi_aead_encrypt, - .decrypt = ssi_aead_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_aead_setkey, + .setauthsize = cc_gcm_setauthsize, + .encrypt = cc_aead_encrypt, + .decrypt = cc_aead_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = 12, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2700,12 +2692,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_rfc4106_gcm_setkey, - .setauthsize = ssi_rfc4106_gcm_setauthsize, - .encrypt = ssi_rfc4106_gcm_encrypt, - .decrypt = ssi_rfc4106_gcm_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_rfc4106_gcm_setkey, + .setauthsize = cc_rfc4106_gcm_setauthsize, + .encrypt = cc_rfc4106_gcm_encrypt, + .decrypt = cc_rfc4106_gcm_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = GCM_BLOCK_RFC4_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2719,12 +2711,12 @@ static struct ssi_alg_template aead_algs[] = { .blocksize = 1, .type = CRYPTO_ALG_TYPE_AEAD, .template_aead = { - .setkey = ssi_rfc4543_gcm_setkey, - .setauthsize = ssi_rfc4543_gcm_setauthsize, - .encrypt = ssi_rfc4543_gcm_encrypt, - .decrypt = ssi_rfc4543_gcm_decrypt, - .init = ssi_aead_init, - .exit = ssi_aead_exit, + .setkey = cc_rfc4543_gcm_setkey, + .setauthsize = cc_rfc4543_gcm_setauthsize, + .encrypt = cc_rfc4543_gcm_encrypt, + .decrypt = cc_rfc4543_gcm_decrypt, + .init = cc_aead_init, + .exit = cc_aead_exit, .ivsize = GCM_BLOCK_RFC4_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, @@ -2735,7 +2727,7 @@ static struct ssi_alg_template aead_algs[] = { #endif /*SSI_CC_HAS_AES_GCM*/ }; -static struct ssi_crypto_alg *ssi_aead_create_alg( +static struct ssi_crypto_alg *cc_create_aead_alg( struct ssi_alg_template *template, struct device *dev) { @@ -2755,11 +2747,11 @@ static struct ssi_crypto_alg *ssi_aead_create_alg( alg->base.cra_module = THIS_MODULE; alg->base.cra_priority = SSI_CRA_PRIO; - alg->base.cra_ctxsize = sizeof(struct ssi_aead_ctx); + alg->base.cra_ctxsize = sizeof(struct cc_aead_ctx); alg->base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY | template->type; - alg->init = ssi_aead_init; - alg->exit = ssi_aead_exit; + alg->init = cc_aead_init; + alg->exit = cc_aead_exit; t_alg->aead_alg = *alg; @@ -2770,11 +2762,11 @@ static struct ssi_crypto_alg *ssi_aead_create_alg( return t_alg; } -int ssi_aead_free(struct ssi_drvdata *drvdata) +int cc_aead_free(struct ssi_drvdata *drvdata) { struct ssi_crypto_alg *t_alg, *n; - struct ssi_aead_handle *aead_handle = - (struct ssi_aead_handle *)drvdata->aead_handle; + struct cc_aead_handle *aead_handle = + (struct cc_aead_handle *)drvdata->aead_handle; if (aead_handle) { /* Remove registered algs */ @@ -2791,9 +2783,9 @@ int ssi_aead_free(struct ssi_drvdata *drvdata) return 0; } -int ssi_aead_alloc(struct ssi_drvdata *drvdata) +int cc_aead_alloc(struct ssi_drvdata *drvdata) { - struct ssi_aead_handle *aead_handle; + struct cc_aead_handle *aead_handle; struct ssi_crypto_alg *t_alg; int rc = -ENOMEM; int alg; @@ -2819,7 +2811,7 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata) /* Linux crypto */ for (alg = 0; alg < ARRAY_SIZE(aead_algs); alg++) { - t_alg = ssi_aead_create_alg(&aead_algs[alg], dev); + t_alg = cc_create_aead_alg(&aead_algs[alg], dev); if (IS_ERR(t_alg)) { rc = PTR_ERR(t_alg); dev_err(dev, "%s alg allocation failed\n", @@ -2844,7 +2836,7 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata) fail2: kfree(t_alg); fail1: - ssi_aead_free(drvdata); + cc_aead_free(drvdata); fail0: return rc; } diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h index 4e29063..5172241 100644 --- a/drivers/staging/ccree/ssi_aead.h +++ b/drivers/staging/ccree/ssi_aead.h @@ -116,7 +116,7 @@ struct aead_req_ctx { bool plaintext_authenticate_only; //for gcm_rfc4543 }; -int ssi_aead_alloc(struct ssi_drvdata *drvdata); -int ssi_aead_free(struct ssi_drvdata *drvdata); +int cc_aead_alloc(struct ssi_drvdata *drvdata); +int cc_aead_free(struct ssi_drvdata *drvdata); #endif /*__SSI_AEAD_H__*/ diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 0b2593f..041624f 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -365,9 +365,9 @@ static int init_cc_resources(struct platform_device *plat_dev) goto post_cipher_err; } - rc = ssi_aead_alloc(new_drvdata); + rc = cc_aead_alloc(new_drvdata); if (rc) { - dev_err(dev, "ssi_aead_alloc failed\n"); + dev_err(dev, "cc_aead_alloc failed\n"); goto post_hash_err; } @@ -417,7 +417,7 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) struct ssi_drvdata *drvdata = (struct ssi_drvdata *)platform_get_drvdata(plat_dev); - ssi_aead_free(drvdata); + cc_aead_free(drvdata); ssi_hash_free(drvdata); ssi_ablkcipher_free(drvdata); ssi_ivgen_fini(drvdata); From patchwork Sun Dec 3 13:58:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 120464 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3361738qgn; Sun, 3 Dec 2017 06:00:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMa71eaLeh7W9J8KxsqZB39115aj4VFFamGbAvj9nK0GZjSXXbqCB7r7+K3PocDR8NypGfwH X-Received: by 10.101.80.197 with SMTP id s5mr11056745pgp.399.1512309625373; Sun, 03 Dec 2017 06:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512309625; cv=none; d=google.com; s=arc-20160816; b=r2Qo2H4j6tTLQSxklLZ9OUqkHdsB6vdcLNxgMKMcRyaPa+239la5uQflcUTCsG22lS 6KM3g70WNIuYYaI2CB5RDlpFVY3bIO0dDbZXxwPJMQwm/p1yV96Wfy93JPRbRiByjWrz ebtLdyo5Ce4oJkfZH3SsyT66Rk1qevNLsfXE97rS35bZNgifnTqUAl6/svvCQbyys5lV lVKTe0ZPp41fYyE3U8kS6FwccmFIfCB789tPlMGVzlBhB9dOTyelWs5ZXKOpeMOnSxaO TVW119MCrZOuwejOtHrRuSlbNLOu4OuydZoBhMscODD3s+WLaLKA+I14l2Jippo6fbku 4UDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3HD0Ku6kivEyVxt2/I1kCkkFhsELqRcBn0JLMONiAdA=; b=TjTAAiipmV/54iyhm7Td4DHDKWaJSnauACRfTOykvownB8QlZp/cfj/JpIUXVUwy4S 35fyJ4Za5fo8MJPGLjvfxkSCwlkOJfy13GdV176cVboS/ZTi/YT5U3ngWojSeFIpxg4B mwK4FZoGpzA+nBdam3N5V7M5vjVqjsWMG1KJ1tKbrhECrIMaHkVaHbDoKkDdSkz7u3VA QYzy8/aFVXOL4YIwPHKtgxBxjRczDZnWVLVXjFJ1pNI+XrfyFWVWmO9lQrZk1PPh34hF WpYYYc1xQ92kO+aG7ix1eOW64csU24NWUsauht/BxSZOdL7tfNyurLSk3POJiRM9NZlj CXKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 134si7793721pgg.733.2017.12.03.06.00.25; Sun, 03 Dec 2017 06:00:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbdLCOAW (ORCPT + 28 others); Sun, 3 Dec 2017 09:00:22 -0500 Received: from foss.arm.com ([217.140.101.70]:55236 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752607AbdLCOAH (ORCPT ); Sun, 3 Dec 2017 09:00:07 -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 2B76A1529; Sun, 3 Dec 2017 06:00:07 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 407213F24A; Sun, 3 Dec 2017 06:00:05 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 10/10] staging: ccree: amend aead func def for readability Date: Sun, 3 Dec 2017 13:58:21 +0000 Message-Id: <1512309503-29766-11-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512309503-29766-1-git-send-email-gilad@benyossef.com> References: <1512309503-29766-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Func definitions in the aead implementation were did not adhere to coding style. Fix them for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c | 141 ++++++++++++++------------------------- 1 file changed, 51 insertions(+), 90 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index 54edd99..5548c7b 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -678,9 +678,8 @@ static int cc_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, } #endif /*SSI_CC_HAS_AES_CCM*/ -static int cc_aead_setauthsize( - struct crypto_aead *authenc, - unsigned int authsize) +static int cc_aead_setauthsize(struct crypto_aead *authenc, + unsigned int authsize) { struct cc_aead_ctx *ctx = crypto_aead_ctx(authenc); struct device *dev = drvdata_to_dev(ctx->drvdata); @@ -733,12 +732,8 @@ static int cc_ccm_setauthsize(struct crypto_aead *authenc, } #endif /*SSI_CC_HAS_AES_CCM*/ -static void -cc_set_assoc_desc( - struct aead_request *areq, - unsigned int flow_mode, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_assoc_desc(struct aead_request *areq, unsigned int flow_mode, + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(areq); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -776,13 +771,10 @@ cc_set_assoc_desc( *seq_size = (++idx); } -static void -cc_proc_authen_desc( - struct aead_request *areq, - unsigned int flow_mode, - struct cc_hw_desc desc[], - unsigned int *seq_size, - int direct) +static void cc_proc_authen_desc(struct aead_request *areq, + unsigned int flow_mode, + struct cc_hw_desc desc[], + unsigned int *seq_size, int direct) { struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); enum ssi_req_dma_buf_type data_dma_type = areq_ctx->data_buff_type; @@ -843,12 +835,10 @@ cc_proc_authen_desc( *seq_size = (++idx); } -static void -cc_proc_cipher_desc( - struct aead_request *areq, - unsigned int flow_mode, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_proc_cipher_desc(struct aead_request *areq, + unsigned int flow_mode, + struct cc_hw_desc desc[], + unsigned int *seq_size) { unsigned int idx = *seq_size; struct aead_req_ctx *areq_ctx = aead_request_ctx(areq); @@ -891,10 +881,9 @@ cc_proc_cipher_desc( *seq_size = (++idx); } -static void cc_proc_digest_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_proc_digest_desc(struct aead_request *req, + struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -942,10 +931,9 @@ static void cc_proc_digest_desc( *seq_size = (++idx); } -static void cc_set_cipher_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_cipher_desc(struct aead_request *req, + struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -988,11 +976,8 @@ static void cc_set_cipher_desc( *seq_size = idx; } -static void cc_proc_cipher( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size, - unsigned int data_flow_mode) +static void cc_proc_cipher(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size, unsigned int data_flow_mode) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); int direct = req_ctx->gen_ctx.op_type; @@ -1014,10 +999,8 @@ static void cc_proc_cipher( *seq_size = idx; } -static void cc_set_hmac_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_hmac_desc(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1051,10 +1034,8 @@ static void cc_set_hmac_desc( *seq_size = idx; } -static void cc_set_xcbc_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_xcbc_desc(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1113,10 +1094,9 @@ static void cc_set_xcbc_desc( *seq_size = idx; } -static void cc_proc_header_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_proc_header_desc(struct aead_request *req, + struct cc_hw_desc desc[], + unsigned int *seq_size) { unsigned int idx = *seq_size; /* Hash associated data */ @@ -1127,10 +1107,9 @@ static void cc_proc_header_desc( *seq_size = idx; } -static void cc_proc_scheme_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_proc_scheme_desc(struct aead_request *req, + struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1192,10 +1171,8 @@ static void cc_proc_scheme_desc( *seq_size = idx; } -static void cc_mlli_to_sram( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_mlli_to_sram(struct aead_request *req, + struct cc_hw_desc desc[], unsigned int *seq_size) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); struct crypto_aead *tfm = crypto_aead_reqtfm(req); @@ -1221,10 +1198,9 @@ static void cc_mlli_to_sram( } } -static enum cc_flow_mode cc_get_data_flow( - enum drv_crypto_direction direct, - enum cc_flow_mode setup_flow_mode, - bool is_single_pass) +static enum cc_flow_mode cc_get_data_flow(enum drv_crypto_direction direct, + enum cc_flow_mode setup_flow_mode, + bool is_single_pass) { enum cc_flow_mode data_flow_mode; @@ -1247,10 +1223,8 @@ static enum cc_flow_mode cc_get_data_flow( return data_flow_mode; } -static void cc_hmac_authenc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_hmac_authenc(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1301,10 +1275,8 @@ static void cc_hmac_authenc( } static void -cc_xcbc_authenc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +cc_xcbc_authenc(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1449,10 +1421,8 @@ static int set_msg_len(u8 *block, unsigned int msglen, unsigned int csize) return 0; } -static int cc_ccm( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static int cc_ccm(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1659,10 +1629,8 @@ static void cc_proc_rfc4309_ccm(struct aead_request *req) #if SSI_CC_HAS_AES_GCM -static void cc_set_ghash_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_ghash_desc(struct aead_request *req, + struct cc_hw_desc desc[], unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1739,10 +1707,8 @@ static void cc_set_ghash_desc( *seq_size = idx; } -static void cc_set_gctr_desc( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_set_gctr_desc(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1777,10 +1743,9 @@ static void cc_set_gctr_desc( *seq_size = idx; } -static void cc_proc_gcm_result( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static void cc_proc_gcm_result(struct aead_request *req, + struct cc_hw_desc desc[], + unsigned int *seq_size) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); @@ -1843,10 +1808,8 @@ static void cc_proc_gcm_result( *seq_size = idx; } -static int cc_gcm( - struct aead_request *req, - struct cc_hw_desc desc[], - unsigned int *seq_size) +static int cc_gcm(struct aead_request *req, struct cc_hw_desc desc[], + unsigned int *seq_size) { struct aead_req_ctx *req_ctx = aead_request_ctx(req); unsigned int cipher_flow_mode; @@ -1883,9 +1846,7 @@ static int cc_gcm( } #ifdef CC_DEBUG -static void cc_dump_gcm( - const char *title, - struct aead_request *req) +static void cc_dump_gcm(const char *title, struct aead_request *req) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm);