Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3595089ybv; Sun, 16 Feb 2020 01:03:39 -0800 (PST) X-Google-Smtp-Source: APXvYqy0EenP+upqYZDaFW/KSvO+rLcxvIVhd1CvNUiF6y7x1g5Tl/Tm3rdwdyrKoCFCFugl2QDu X-Received: by 2002:a54:450f:: with SMTP id l15mr7081170oil.126.1581843819200; Sun, 16 Feb 2020 01:03:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581843819; cv=none; d=google.com; s=arc-20160816; b=BxHDcr0Kx0FZDY3JgzDHE1OhSRq0DTvHmZH0xYcNszIM/eV+DEKwUGf4xRDc+sVi66 uA+0JsW3XfpDP0JbFXl20qoRzEKrfxgTEeD1/+PuF34dkqg7Mi5R3JEGQQmEoprK+JhI +1ivfpmtT3F+hjGSGTifPC/4+QXS+7ocRc9E7S9wcT/P3QB+OT+wEo10Q1s8zflp09Vp /XsoF/3qpBb+CZeFUNxvQK+NvgyKGMXqn1KXvw7qkwDtyNJGb0sJnJWrgh3QB9Kge0ND auk8g0FiCeA5K+4jyyrJYmo+we9KtNQReqZWWSGapuZCKMOVhd7HrlwEoYN2oGoYGVGh KiOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=rWpj8zJCDDtNfpKqvTjZ+nYTC4g61UrT1IhKuXiNI9k=; b=MOTXlUkUpSrA6PD97B/5UyRuPBkSyy88Roki5xnAkqmP0qYJJzm+NIYGsPFMklRjV+ JQU1WGWLqq8uQ61+fmh5NNVt7AWJsswIslhP9hxKEI9p1bfaEBGwvCZnsqxh/4jtq+K1 W7OtMYhoNxrO94H9l9rVNPuwScK9zKJGcwlQ7FLcHZ37RDBA/mEhNBFltvMW3kyH0kYq NGKmhUYlip89t3PBjCIzs2CEVD1J3q/4AlT1WsghX4LKBz3tG+3c11h2vNwXpah1joR/ PMPfpYqQg0RANH0bBhc00pQojLdkhXIM++295j2iLx4tVS6dCbXNVJ/Fs8WUSn1o32/u bgWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id b191si4917826oii.266.2020.02.16.01.03.27; Sun, 16 Feb 2020 01:03:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 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 S1725993AbgBPJCr (ORCPT + 99 others); Sun, 16 Feb 2020 04:02:47 -0500 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:64423 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbgBPJCr (ORCPT ); Sun, 16 Feb 2020 04:02:47 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tq4ZmiE_1581843754; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Tq4ZmiE_1581843754) by smtp.aliyun-inc.com(127.0.0.1); Sun, 16 Feb 2020 17:02:34 +0800 From: Tianjia Zhang To: herbert@gondor.apana.org.au, davem@davemloft.net, ebiggers@kernel.org, pvanleeuwen@rambus.com, zohar@linux.ibm.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: sm3 - export crypto_sm3_final function Date: Sun, 16 Feb 2020 17:02:33 +0800 Message-Id: <20200216090233.109416-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 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 --- 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.17.1