Remove redundant return value of sm3_ce_final() and add return value of do_hmac_sm3_ce() in invalid case.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- drv/isa_ce_sm3.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drv/isa_ce_sm3.c b/drv/isa_ce_sm3.c index 5442b3c..ace6905 100644 --- a/drv/isa_ce_sm3.c +++ b/drv/isa_ce_sm3.c @@ -135,7 +135,7 @@ static void sm3_ce_update(struct sm3_ce_ctx *sctx, const void *data, memcpy(sctx->block, data, data_len); }
-static int sm3_ce_final(struct sm3_ce_ctx *sctx, __u8 *md, +static void sm3_ce_final(struct sm3_ce_ctx *sctx, __u8 *md, sm3_ce_block_fn *block_fn) { size_t i, offset1, offset2; @@ -166,8 +166,6 @@ static int sm3_ce_final(struct sm3_ce_ctx *sctx, __u8 *md, block_fn(sctx->word_reg, sctx->block, 1); for (i = 0; i < SM3_STATE_WORDS; i++) PUTU32_TO_U8(md + i * WORD_TO_CHAR_OFFSET, sctx->word_reg[i]); - - return WD_SUCCESS; }
static int do_sm3_ce(struct wd_digest_msg *msg, __u8 *out_digest) @@ -327,7 +325,7 @@ static int do_hmac_sm3_ce(struct wd_digest_msg *msg, __u8 *out_hmac) break; default: WD_ERR("Invalid block type!\n"); - break; + return -WD_EINVAL; }
if (msg->out_bytes < SM3_DIGEST_SIZE)