LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] crypto: sm3 - export crypto_sm3_final function
@ 2020-02-16 9:02 Tianjia Zhang
2020-02-22 1:19 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Tianjia Zhang @ 2020-02-16 9:02 UTC (permalink / raw)
To: herbert, davem, ebiggers, pvanleeuwen, zohar; +Cc: linux-crypto, linux-kernel
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 <tianjia.zhang@linux.alibaba.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: sm3 - export crypto_sm3_final function
2020-02-16 9:02 [PATCH] crypto: sm3 - export crypto_sm3_final function Tianjia Zhang
@ 2020-02-22 1:19 ` Herbert Xu
2020-02-23 4:21 ` Tianjia Zhang
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2020-02-22 1:19 UTC (permalink / raw)
To: Tianjia Zhang
Cc: davem, ebiggers, pvanleeuwen, zohar, linux-crypto, linux-kernel
On Sun, Feb 16, 2020 at 05:02:33PM +0800, Tianjia Zhang wrote:
> 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 <tianjia.zhang@linux.alibaba.com>
> ---
> crypto/sm3_generic.c | 7 ++++---
> include/crypto/sm3.h | 2 ++
> 2 files changed, 6 insertions(+), 3 deletions(-)
Please add this into the series that actually uses the function.
It makes no sense on its own.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: sm3 - export crypto_sm3_final function
2020-02-22 1:19 ` Herbert Xu
@ 2020-02-23 4:21 ` Tianjia Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Tianjia Zhang @ 2020-02-23 4:21 UTC (permalink / raw)
To: Herbert Xu
Cc: davem, ebiggers, pvanleeuwen, zohar, linux-crypto, linux-kernel, gilad
On 2020/2/22 9:19, Herbert Xu wrote:
> On Sun, Feb 16, 2020 at 05:02:33PM +0800, Tianjia Zhang wrote:
>> 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 <tianjia.zhang@linux.alibaba.com>
>> ---
>> crypto/sm3_generic.c | 7 ++++---
>> include/crypto/sm3.h | 2 ++
>> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> Please add this into the series that actually uses the function.
> It makes no sense on its own.
>
> Thanks,
>
The actual use of this function is in sm2 and OSCCA certificates. This
set of patches has been submitted to the community. Please review them.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-23 4:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 9:02 [PATCH] crypto: sm3 - export crypto_sm3_final function Tianjia Zhang
2020-02-22 1:19 ` Herbert Xu
2020-02-23 4:21 ` Tianjia Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).