From: Wenkai Lin <linwenkai6@hisilicon.com> Only the description of SCENE_STREAM used for CTR/GCM streaming encryption in the FS is seen, and the hash function for streaming processing mode in FS014/FS017 is ignored. The common digest (such as SHA/SM3) that is not GMAC supports streaming hash processing, and SCENE_STREAM must be used. GMAC is a dedicated authentication algorithm for IPsec and SCENE_IPSEC is used independently. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> --- v1/drv/hisi_sec_udrv.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c index 7eba121..6ad6c57 100644 --- a/v1/drv/hisi_sec_udrv.c +++ b/v1/drv/hisi_sec_udrv.c @@ -1827,7 +1827,17 @@ static int fill_digest_bd3(struct wd_queue *q, struct hisi_sec_bd3_sqe *sqe, return ret; sqe->type = BD_TYPE3; - sqe->scene = is_storage ? SCENE_STORAGE : SCENE_IPSEC; + + /* + * GMAC is an IPSEC-specific auth algo (RFC4543); other digests use + * stream scene for long-data hash processing. + */ + if (is_storage) + sqe->scene = SCENE_STORAGE; + else if (msg->alg == WCRYPTO_AES_GMAC) + sqe->scene = SCENE_IPSEC; + else + sqe->scene = SCENE_STREAM; sqe->auth = AUTH_MAC_CALCULATE; sqe->a_len = msg->in_bytes; -- 2.50.1.windows.1