Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp357323ybt; Wed, 8 Jul 2020 01:30:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4TyAhSopCCEiD7FY220bHfBhIxWgqB9JoJwfwPrLQwY7rtyqj4pMtneZzRMmqp7f3BpxN X-Received: by 2002:a05:6402:31bb:: with SMTP id dj27mr1176690edb.387.1594197029143; Wed, 08 Jul 2020 01:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594197029; cv=none; d=google.com; s=arc-20160816; b=Rxz5FASv7dv43MN3giWv5OXbl6WLmr1Wy+8xTtPnyqVB1hyM4fP5nAgtNhgYKUR/Tx k6GhDOpUWZZqiwEnmdPEEjlScaGnZ+5yDBpUbISRLfQUOvJli6UOu0IKZitSxdPqcGnd FYXkxY04spmzzjn6YiU+ZEl6W6PFlOxLtP6r56lGHOFVDnBnXF0IOovtuoVlqB/kbJw0 PC56gooXV4NMYgdl4eF4WtpaduikCcsk1MA6EuebXi3r/E5F2Fx2tcMrdzs6ohM0me1U Xh7inmsKwqnzsU6+ZAkCIQ4GLGmoBHY946kFpqnMasfGyiXrqTmrDx1iSQBwgt2ce5FL 9pFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=rWpj8zJCDDtNfpKqvTjZ+nYTC4g61UrT1IhKuXiNI9k=; b=0gFG8imQrfA3ljymH2Ozo6BR5XJWbJspy3GHoSoyVFPGhqOntv0cfzXiCzA9JZ3xXg yNQRNmdQz+n1B7x4yReiqGH7nhPPOjO9O09G+6uQ3ad3V4o7XCcLiNuYrJxI7WyogaqW 32MP3qelyVAVn71YP4Z0603PwmDY+j8v8zfPp0MrP5AviQAhuw0/1l0q7npHddZ1QFa9 R1peyFdwz1TVZSAuMYxGRY0Gxroa1LKMCvIdjEdtjoBokJOpZhCsmifSEqhdH4eLu00G ClwgBrdlAZwJ/4fW6Dtf0WxsFAaoNQqwRSS5Ms+E+2FKu9kVvQsZwDW6uUD1AcfKBf10 tp8w== 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 i16si1079094edx.275.2020.07.08.01.30.06; Wed, 08 Jul 2020 01:30:29 -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 S1728119AbgGHI20 (ORCPT + 99 others); Wed, 8 Jul 2020 04:28:26 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:38110 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728112AbgGHI2Z (ORCPT ); Wed, 8 Jul 2020 04:28:25 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U26.E2X_1594196899; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U26.E2X_1594196899) by smtp.aliyun-inc.com(127.0.0.1); Wed, 08 Jul 2020 16:28:19 +0800 From: Tianjia Zhang To: herbert@gondor.apana.org.au, davem@davemloft.net, dhowells@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, jmorris@namei.org, serge@hallyn.com, nramas@linux.microsoft.com, tusharsu@linux.microsoft.com, zohar@linux.ibm.com, gilad@benyossef.com, pvanleeuwen@rambus.com Cc: 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, linux-integrity@vger.kernel.org, zhang.jia@linux.alibaba.com, tianjia.zhang@linux.alibaba.com Subject: [PATCH v4 1/8] crypto: sm3 - export crypto_sm3_final function Date: Wed, 8 Jul 2020 16:28:11 +0800 Message-Id: <20200708082818.5511-2-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708082818.5511-1-tianjia.zhang@linux.alibaba.com> References: <20200708082818.5511-1-tianjia.zhang@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org 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 --- 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