Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp585615pxk; Thu, 3 Sep 2020 07:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUrHWGHwPkMdvzq0GRKQtH5YsvPqQ82Sq1cDKwvxu1+damifv6FTZjgjbEPIlj8FyYeHk1 X-Received: by 2002:a50:ab1d:: with SMTP id s29mr3593445edc.246.1599143835013; Thu, 03 Sep 2020 07:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599143835; cv=none; d=google.com; s=arc-20160816; b=vFKeRJuRVXhldAN9iBn1BPXdrlhEGXd+5t3kcFLuaInYHx1PxjW8vlHC5bWa+80uzu xA0uDs6iuL4wKz/bjqfU8N1UNYNAWUxn72dPdG3+zGx6vBc7vQGqXLHlsNFlwtH7zuSw Q75KOAsTemMNbdBxKm5o/RjV+L9PFaQvdZaPorUosSHc2bzhp7zIsZDcrF8rEDo3Wj+X PjeJ4scPFKOAqFgMcj/w5dc+B9xjr6xVcvUt+NUldDEDZAzFB03f/Xwx82MAPhE+SAjq BWewZLXGYIVj1YBmUdI1VE9KftCA9r+VGvjnOSJHl19JRnG/dxldbtd8I+tThB28HrZn 8Rsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=s4wPwnFqaB+aYfKUp2ASw++oRRd1dSt36Ucvg3Ltcx0=; b=TJ5l5Aj6Lw2Z2NWiIyA4k+m/EdyYGf6+Ovh6TNnIqndBULZ6s6Gs32WCtHwrclaJSh 0V0l+V1hhxSwhVkGO9fCxCav+aSroXcy8kmreU/AdSH2VRcyBM6/y64gYO+NnrahJMAZ AFNAm5fsu5QuWshFXIR06jbCJYH1PvzHGwLB8UA9OiGMcb4QV1pHyqsicIJMrGfDTVYI 68yja/TeNivopIPKT1sibZlrndj74BoAOLsE+/LwLxvc8+EvsaRa7qoPCeANhVA0awf6 qyChYm8bKEwicdeRdOijJnglBN8lcdt+QPN4WqqcBuazDsPOOmKvi4pT49HxgZOpbI4K eiDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si1075906ejx.710.2020.09.03.07.36.50; Thu, 03 Sep 2020 07:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbgICOga (ORCPT + 99 others); Thu, 3 Sep 2020 10:36:30 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:54286 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729081AbgICOgT (ORCPT ); Thu, 3 Sep 2020 10:36:19 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R941e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07484;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=31;SR=0;TI=SMTPD_---0U7pCPib_1599138763; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U7pCPib_1599138763) by smtp.aliyun-inc.com(127.0.0.1); Thu, 03 Sep 2020 21:12:43 +0800 From: Tianjia Zhang To: Herbert Xu , "David S. Miller" , David Howells , Maxime Coquelin , Alexandre Torgue , James Morris , "Serge E. Hallyn" , Stephan Mueller , Marcelo Henrique Cerri , "Steven Rostedt (VMware)" , Masahiro Yamada , Brendan Higgins , Andrew Morton , Johannes Weiner , Waiman Long , Mimi Zohar , Lakshmi Ramasubramanian , Colin Ian King , Tushar Sugandhi , Vitaly Chikunov , "Gilad Ben-Yossef" , Pascal van Leeuwen , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-security-module@vger.kernel.org Cc: Xufeng Zhang , Jia Zhang , Tianjia Zhang Subject: [PATCH v6 1/8] crypto: sm3 - export crypto_sm3_final function Date: Thu, 3 Sep 2020 21:12:35 +0800 Message-Id: <20200903131242.128665-2-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 In-Reply-To: <20200903131242.128665-1-tianjia.zhang@linux.alibaba.com> References: <20200903131242.128665-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Both crypto_sm3_update and crypto_sm3_finup have been exported, exporting crypto_sm3_final, to avoid having to use crypto_sm3_finup(desc, NULL, 0, dgst) to calculate the hash in some cases. Signed-off-by: Tianjia Zhang Tested-by: Xufeng Zhang --- crypto/sm3_generic.c | 7 ++++--- include/crypto/sm3.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto/sm3_generic.c b/crypto/sm3_generic.c index 3468975215ca..193c4584bd00 100644 --- a/crypto/sm3_generic.c +++ b/crypto/sm3_generic.c @@ -149,17 +149,18 @@ int crypto_sm3_update(struct shash_desc *desc, const u8 *data, } EXPORT_SYMBOL(crypto_sm3_update); -static int sm3_final(struct shash_desc *desc, u8 *out) +int crypto_sm3_final(struct shash_desc *desc, u8 *out) { sm3_base_do_finalize(desc, sm3_generic_block_fn); return sm3_base_finish(desc, out); } +EXPORT_SYMBOL(crypto_sm3_final); int crypto_sm3_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *hash) { sm3_base_do_update(desc, data, len, sm3_generic_block_fn); - return sm3_final(desc, hash); + return crypto_sm3_final(desc, hash); } EXPORT_SYMBOL(crypto_sm3_finup); @@ -167,7 +168,7 @@ static struct shash_alg sm3_alg = { .digestsize = SM3_DIGEST_SIZE, .init = sm3_base_init, .update = crypto_sm3_update, - .final = sm3_final, + .final = crypto_sm3_final, .finup = crypto_sm3_finup, .descsize = sizeof(struct sm3_state), .base = { diff --git a/include/crypto/sm3.h b/include/crypto/sm3.h index 1438942dc773..42ea21289ba9 100644 --- a/include/crypto/sm3.h +++ b/include/crypto/sm3.h @@ -35,6 +35,8 @@ struct shash_desc; extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data, unsigned int len); +extern int crypto_sm3_final(struct shash_desc *desc, u8 *out); + extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *hash); #endif -- 2.19.1.3.ge56e4f7