From patchwork Fri Mar 1 16:16:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshay Saraswat X-Patchwork-Id: 224402 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6005F2C02B7 for ; Sat, 2 Mar 2013 02:56:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2E4FE4A108; Fri, 1 Mar 2013 16:56:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c1i4OQG5dSJT; Fri, 1 Mar 2013 16:56:34 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B5AF54A112; Fri, 1 Mar 2013 16:56:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A80BA4A0F1 for ; Fri, 1 Mar 2013 16:56:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hYeSavOLNrtR for ; Fri, 1 Mar 2013 16:56:08 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id C03FD4A0A1 for ; Fri, 1 Mar 2013 16:56:06 +0100 (CET) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MIZ0097TO9CF2A0@mailout4.samsung.com> for u-boot@lists.denx.de; Sat, 02 Mar 2013 00:56:03 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 51.BF.17763.39FC0315; Sat, 02 Mar 2013 00:56:03 +0900 (KST) X-AuditID: cbfee690-b7f6b6d000004563-81-5130cf93a9d0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 57.51.03880.39FC0315; Sat, 02 Mar 2013 00:56:03 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MIZ008G5O94TO00@mmp1.samsung.com> for u-boot@lists.denx.de; Sat, 02 Mar 2013 00:56:03 +0900 (KST) From: Akshay Saraswat To: u-boot@lists.denx.de Date: Fri, 01 Mar 2013 11:16:24 -0500 Message-id: <1362154585-16216-4-git-send-email-akshay.s@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1362154585-16216-1-git-send-email-akshay.s@samsung.com> References: <1362154585-16216-1-git-send-email-akshay.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsWyRsSkTnfyeYNAg7M7rSze7u1kd2D0OHtn B2MAYxSXTUpqTmZZapG+XQJXxpV1B1kLVgpWPNg2jbWB8QtvFyMnh4SAicTFCy/YIWwxiQv3 1rN1MXJxCAksZZSY92MbG0zRyz07wGwhgUWMEku+p0EULWOSOLnzPitIgk1AR2L7ku9gk0QE JCR+9V9lBLGZBRwl9h35xgRiCwtYShy+0gNmswioSixe0QU2lFfARWL7lLksEMvkJD7seQQ2 h1PAVeLk9AMsEItdJL7uv8MMUXO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mb4p7Sj+sOX3I5nUAW9bB3fnXtx6p2ez37yWzfbllXq1t4LFv6zntdtTMD5h2pUdP z+7TFd61PLnVmt/OnkiJdos0fayZ11B9p/QJZ69z07YFdQcfK7EUZyQaajEXFScCAGtj05m1 AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: prashanth.g@samsung.com Subject: [U-Boot] [PATCH 3/4 v3] gen: Add ACE acceleration to hash X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de ACE H/W acceleration support is added to hash which can be used to test SHA 256 hash algorithm. Tested with command "hash sha256 0x40008000 0x2B 0x40009000". Used mm and md to write a standard string to memory location 0x40008000 and ran the above command to verify the output. Change-Id: If76820057763e833a6150e55bffea3d010b86721 Signed-off-by: ARUN MANKUZHI Signed-off-by: Akshay Saraswat --- Changes sice v2: - Added new nodes for SHA1 and SHA256 in struct hash_algo for the case when ACE is enabled. - Added new declaration for function pointer hash_func_ws with different return type. common/hash.c | 15 +++++++++++++++ include/hash.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/common/hash.c b/common/hash.c index e3a6e43..b8f9d29 100644 --- a/common/hash.c +++ b/common/hash.c @@ -28,12 +28,26 @@ #include #include #include +#include /* * These are the hash algorithms we support. Chips which support accelerated * crypto could perhaps add named version of these algorithms here. */ static struct hash_algo hash_algo[] = { +#ifdef CONFIG_EXYNOS_ACE_SHA + { + "SHA1", + SHA1_SUM_LEN, + ace_sha_hash_digest, + ACE_SHA_TYPE_SHA1, + }, { + "SHA256", + SHA256_SUM_LEN, + ace_sha_hash_digest, + ACE_SHA_TYPE_SHA256, + }, +#else #ifdef CONFIG_SHA1 { "SHA1", @@ -50,6 +64,7 @@ static struct hash_algo hash_algo[] = { CHUNKSZ_SHA256, }, #endif +#endif }; /** diff --git a/include/hash.h b/include/hash.h index 34ba558..83e1fb6 100644 --- a/include/hash.h +++ b/include/hash.h @@ -40,8 +40,13 @@ struct hash_algo { * @output: Checksum result (length depends on algorithm) * @chunk_sz: Trigger watchdog after processing this many bytes */ +#ifdef CONFIG_EXYNOS_ACE_SHA + int (*hash_func_ws)(const unsigned char *input, unsigned int ilen, + unsigned char *output, unsigned int chunk_sz); +#else void (*hash_func_ws)(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz); +#endif int chunk_size; /* Watchdog chunk size */ };