Skip to content

Commit

Permalink
xfrm: Add support for SM3 secure hash
Browse files Browse the repository at this point in the history
This patch allows IPsec to use SM3 HMAC authentication algorithm.

Signed-off-by: Xu Jia <xujia39@huawei.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Xu Jia authored and Steffen Klassert committed Dec 23, 2021
1 parent af734a2 commit e6911af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/uapi/linux/pfkeyv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ struct sadb_x_filter {
#define SADB_X_AALG_SHA2_512HMAC 7
#define SADB_X_AALG_RIPEMD160HMAC 8
#define SADB_X_AALG_AES_XCBC_MAC 9
#define SADB_X_AALG_SM3_256HMAC 10
#define SADB_X_AALG_NULL 251 /* kame */
#define SADB_AALG_MAX 251

Expand Down
20 changes: 20 additions & 0 deletions net/xfrm/xfrm_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,26 @@ static struct xfrm_algo_desc aalg_list[] = {

.pfkey_supported = 0,
},
{
.name = "hmac(sm3)",
.compat = "sm3",

.uinfo = {
.auth = {
.icv_truncbits = 256,
.icv_fullbits = 256,
}
},

.pfkey_supported = 1,

.desc = {
.sadb_alg_id = SADB_X_AALG_SM3_256HMAC,
.sadb_alg_ivlen = 0,
.sadb_alg_minbits = 256,
.sadb_alg_maxbits = 256
}
},
};

static struct xfrm_algo_desc ealg_list[] = {
Expand Down

0 comments on commit e6911af

Please sign in to comment.