Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2588220pxk; Sun, 20 Sep 2020 09:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0sARawTgI4OdXjbeJQT4hXPVnw1eybKxen+FbT/3FL8OOGSS5WlojsghnXRmEXyyNqYxz X-Received: by 2002:a17:907:7215:: with SMTP id dr21mr33098059ejc.239.1600619002843; Sun, 20 Sep 2020 09:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600619002; cv=none; d=google.com; s=arc-20160816; b=MmHh48dO/X+9uA+Cpc4LHsTjWWUDQoYN1ay0FbuAfr1GnacH7sdPC2eKSO0+m5Iqh2 O1dlivZJ7ae4yIQCg22ORKknHGdr5A/3qUcxAHIj6dOaad4nUlaO9ixc9/qN6qSb90ZD URDXTgi/5Vd3YU13hEJl7gtPU8BV72cuentzUtl6KabDwUPAPv8J2xHF7PSafBAKvol7 tXMCUtUXdBzauVlb0PuRRFfGNgOSyu6h25saYYaQxiT6gpatsfEh9KbePdkReckdBnEO 5aOgmcONPblOFihIK6VbgsZuGHj6tCSXAjU2tIUde0SYrSuWjHvLFb5W6th76oCmr8M7 Zbmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=s4wPwnFqaB+aYfKUp2ASw++oRRd1dSt36Ucvg3Ltcx0=; b=Q07z7h9sw4vz++IjyL344z48FzOpLbXTaDu7CT6QeghyCO0tHtYEHoirf2NdXBoqDG I+qbD0mEVuSTazzoKXbDGRl57doH7xMatlMvA94AfeTtZOnUCdQ/V0RuQhbrJlBseUcj WeSo2lyRsfYOLg2wHBZLvGSqBMrpL4Kw5bpFRu8D/VV04BP+HXNa9CJCxSBNJJEkFG0W 3+wh9WcatM7lkazC0nADVCEY1bMM12vmzIaO/3r46j/XXBgQ/iiOnVOuN3qilicqVe/r Oyybvepgx97Tn9/yebEjD2OO7I9AC2eP1jVfHJ5zo8Xui0aP7O44rriByJCnfErL+cV9 b05A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 wq8si6506622ejb.480.2020.09.20.09.22.59; Sun, 20 Sep 2020 09:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726524AbgITQV2 (ORCPT + 99 others); Sun, 20 Sep 2020 12:21:28 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:55245 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbgITQVU (ORCPT ); Sun, 20 Sep 2020 12:21:20 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=34;SR=0;TI=SMTPD_---0U9VT-20_1600618864; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U9VT-20_1600618864) by smtp.aliyun-inc.com(127.0.0.1); Mon, 21 Sep 2020 00:21:04 +0800 From: Tianjia Zhang To: Herbert Xu , "David S. Miller" , David Howells , Eric Biggers , Jarkko Sakkinen , 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, keyrings@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Xufeng Zhang , Jia Zhang , Tianjia Zhang Subject: [PATCH v7 01/10] crypto: sm3 - export crypto_sm3_final function Date: Mon, 21 Sep 2020 00:20:54 +0800 Message-Id: <20200920162103.83197-2-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 In-Reply-To: <20200920162103.83197-1-tianjia.zhang@linux.alibaba.com> References: <20200920162103.83197-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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