mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
crypto: sm3 - export crypto_sm3_final function
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> Tested-by: Xufeng Zhang <yunbo.xufeng@linux.alibaba.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d8e8876617
commit
f49282870f
@ -149,17 +149,18 @@ int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(crypto_sm3_update);
|
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);
|
sm3_base_do_finalize(desc, sm3_generic_block_fn);
|
||||||
return sm3_base_finish(desc, out);
|
return sm3_base_finish(desc, out);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(crypto_sm3_final);
|
||||||
|
|
||||||
int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
|
int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
|
||||||
unsigned int len, u8 *hash)
|
unsigned int len, u8 *hash)
|
||||||
{
|
{
|
||||||
sm3_base_do_update(desc, data, len, sm3_generic_block_fn);
|
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);
|
EXPORT_SYMBOL(crypto_sm3_finup);
|
||||||
|
|
||||||
@ -167,7 +168,7 @@ static struct shash_alg sm3_alg = {
|
|||||||
.digestsize = SM3_DIGEST_SIZE,
|
.digestsize = SM3_DIGEST_SIZE,
|
||||||
.init = sm3_base_init,
|
.init = sm3_base_init,
|
||||||
.update = crypto_sm3_update,
|
.update = crypto_sm3_update,
|
||||||
.final = sm3_final,
|
.final = crypto_sm3_final,
|
||||||
.finup = crypto_sm3_finup,
|
.finup = crypto_sm3_finup,
|
||||||
.descsize = sizeof(struct sm3_state),
|
.descsize = sizeof(struct sm3_state),
|
||||||
.base = {
|
.base = {
|
||||||
|
@ -35,6 +35,8 @@ struct shash_desc;
|
|||||||
extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
|
extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
|
||||||
unsigned int len);
|
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,
|
extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
|
||||||
unsigned int len, u8 *hash);
|
unsigned int len, u8 *hash);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user