From patchwork Wed Jan 13 17:52:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8027581 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C5A8BBEEE5 for ; Wed, 13 Jan 2016 17:52:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5AC320513 for ; Wed, 13 Jan 2016 17:52:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 085902050B for ; Wed, 13 Jan 2016 17:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932184AbcAMRwa (ORCPT ); Wed, 13 Jan 2016 12:52:30 -0500 Received: from mail-yk0-f195.google.com ([209.85.160.195]:36002 "EHLO mail-yk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932464AbcAMRw3 (ORCPT ); Wed, 13 Jan 2016 12:52:29 -0500 Received: by mail-yk0-f195.google.com with SMTP id k129so37530069yke.3 for ; Wed, 13 Jan 2016 09:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7TC6cqQBB9HcNW1J4yF/8W6DHH/b+BykGhz0kt0Qjss=; b=gWTpV1UqIf6ouUykNxDwCu9zJhG+iT5KHNO0ujHhdFHoMwiXf5wAsJGHIXr2jlW9Y1 sD9reZMQ6YW/HB34UM4cdhjPECrMXchBvNA9p6mnLVge89/+sw1Lk0F3jXEA0I5WBSS2 RJ4Q9rWkt4nRDIv1+c9BOBKlToUMb6PcBIwzYKwDSdXQ5Xm53z5XV9MUEgBhNIY4qPdz g82RJltCWQzniiQl3J73ypqNgEleSGM+edXsHgusmCwHgt1N1ol6HzaaOp4hXhk7NEWa dqehsJgUU5CPOEsYKe6n3xGTvGNv+fe22JSFUhmfNkDQrjP76cKgbxfC5AQyXmUmAoV9 QQ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7TC6cqQBB9HcNW1J4yF/8W6DHH/b+BykGhz0kt0Qjss=; b=gt5lW2OTFF94esYh1b47cASpWnGuEIsTVphzl3twLIxJjInV1yzqygR+6CTO+QG1bh z/6NY5JVATlSxrZhqCzAj75UexicSr8KN7dQVrs4e5BFyKxcexsP58v/t/KkcKn22JLw LlpcKiE8zIJW7Ptp6Tb82r4F6/sT7fhrSghqyvFuqZe+wUXAmh6NNGZZHP/Ujzb56J7x QbU2zl/MKwPVLRUd6kxAhBkgG4NkKK88CzBgt6tDdDQvw+AsXbXfSP5d47fXoygtkpL1 x1Wn2kcxVw5gJJzogpuw3/xLqvG4LmZq5U5LVl9gxMCV9wVmwh3Bf95HRuYaNweZO7ET m0pA== X-Gm-Message-State: ALoCoQmZD0tLehEpJQzVRgtyRwBOVTvIdGnC3CNEPhSrnM7inQX4+ySKXtHECiCNQw0JyNeMZ3qyQnI9t56VCAehmPTTmp79Wg== X-Received: by 10.13.219.6 with SMTP id d6mr119539823ywe.228.1452707549269; Wed, 13 Jan 2016 09:52:29 -0800 (PST) Received: from localhost.localdomain ([187.64.228.119]) by smtp.gmail.com with ESMTPSA id r8sm1495550ywb.20.2016.01.13.09.52.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jan 2016 09:52:28 -0800 (PST) From: Fabio Estevam To: herbert@gondor.apana.org.au Cc: marex@denx.de, s.trumtrar@pengutronix.de, thomas.lendacky@amd.com, linux@arm.linux.org.uk, linux-crypto@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 3/3] crypto: mxs-dcp - provide statesize and import/export() Date: Wed, 13 Jan 2016 15:52:04 -0200 Message-Id: <1452707524-7695-3-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452707524-7695-1-git-send-email-festevam@gmail.com> References: <1452707524-7695-1-git-send-email-festevam@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Currently the mxs-dcp driver fails to probe: mxs-dcp 80028000.dcp: Failed to register sha1 hash! mxs-dcp: probe of 80028000.dcp failed with error -22 This happens since commit 8996eafdcbad ("crypto: ahash - ensure statesize is non-zero"), which requires statesize to be filled. Other than filling statesize, we also need to provide the import/export functions. Based on the implementation of the sahara and caam drivers. Signed-off-by: Fabio Estevam --- Changes since v2: - Newly introduced in this series drivers/crypto/mxs-dcp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index 59ed54e..1e2017f 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c @@ -775,6 +775,24 @@ static void dcp_sha_cra_exit(struct crypto_tfm *tfm) { } +static int dcp_sha_export(struct ahash_request *req, void *out) +{ + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req); + + memcpy(out, rctx, sizeof(struct dcp_sha_req_ctx)); + + return 0; +} + +static int dcp_sha_import(struct ahash_request *req, const void *in) +{ + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req); + + memcpy(rctx, in, sizeof(struct dcp_sha_req_ctx)); + + return 0; +} + /* AES 128 ECB and AES 128 CBC */ static struct crypto_alg dcp_aes_algs[] = { { @@ -834,8 +852,11 @@ static struct ahash_alg dcp_sha1_alg = { .final = dcp_sha_final, .finup = dcp_sha_finup, .digest = dcp_sha_digest, + .import = dcp_sha_import, + .export = dcp_sha_export, .halg = { .digestsize = SHA1_DIGEST_SIZE, + .statesize = sizeof(struct dcp_sha_req_ctx), .base = { .cra_name = "sha1", .cra_driver_name = "sha1-dcp", @@ -858,8 +879,11 @@ static struct ahash_alg dcp_sha256_alg = { .final = dcp_sha_final, .finup = dcp_sha_finup, .digest = dcp_sha_digest, + .import = dcp_sha_import, + .export = dcp_sha_export, .halg = { .digestsize = SHA256_DIGEST_SIZE, + .statesize = sizeof(struct dcp_sha_req_ctx), .base = { .cra_name = "sha256", .cra_driver_name = "sha256-dcp",