diff --git a/home/nipa/nipa_out/999126/ynl/old-code/handshake-user.c b/home/nipa/nipa_out/999126/ynl/new-code/handshake-user.c index 0d640d9e9819..89022cf184e3 100644 --- a/home/nipa/nipa_out/999126/ynl/old-code/handshake-user.c +++ b/home/nipa/nipa_out/999126/ynl/new-code/handshake-user.c @@ -42,6 +42,10 @@ static const char * const handshake_msg_type_strmap[] = { [0] = "unspec", [1] = "clienthello", [2] = "serverhello", + [3] = "clientkeyupdate", + [4] = "clientkeyupdaterequest", + [5] = "serverkeyupdate", + [6] = "serverkeyupdaterequest", }; const char *handshake_msg_type_str(enum handshake_msg_type value) @@ -65,6 +69,20 @@ const char *handshake_auth_str(enum handshake_auth value) return handshake_auth_strmap[value]; } +static const char * const handshake_key_update_type_strmap[] = { + [0] = "unspec", + [1] = "send", + [2] = "received", + [3] = "received_request_update", +}; + +const char *handshake_key_update_type_str(enum handshake_key_update_type value) +{ + if (value < 0 || value >= (int)YNL_ARRAY_SIZE(handshake_key_update_type_strmap)) + return NULL; + return handshake_key_update_type_strmap[value]; +} + /* Policies */ const struct ynl_policy_attr handshake_x509_policy[HANDSHAKE_A_X509_MAX + 1] = { [HANDSHAKE_A_X509_CERT] = { .name = "cert", .type = YNL_PT_U32, }, @@ -86,6 +104,8 @@ const struct ynl_policy_attr handshake_accept_policy[HANDSHAKE_A_ACCEPT_MAX + 1] [HANDSHAKE_A_ACCEPT_CERTIFICATE] = { .name = "certificate", .type = YNL_PT_NEST, .nest = &handshake_x509_nest, }, [HANDSHAKE_A_ACCEPT_PEERNAME] = { .name = "peername", .type = YNL_PT_NUL_STR, }, [HANDSHAKE_A_ACCEPT_KEYRING] = { .name = "keyring", .type = YNL_PT_U32, }, + [HANDSHAKE_A_ACCEPT_KEY_UPDATE_REQUEST] = { .name = "key-update-request", .type = YNL_PT_U32, }, + [HANDSHAKE_A_ACCEPT_KEY_SERIAL] = { .name = "key-serial", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest handshake_accept_nest = { @@ -97,6 +117,7 @@ const struct ynl_policy_attr handshake_done_policy[HANDSHAKE_A_DONE_MAX + 1] = { [HANDSHAKE_A_DONE_STATUS] = { .name = "status", .type = YNL_PT_U32, }, [HANDSHAKE_A_DONE_SOCKFD] = { .name = "sockfd", .type = YNL_PT_U32, }, [HANDSHAKE_A_DONE_REMOTE_AUTH] = { .name = "remote-auth", .type = YNL_PT_U32, }, + [HANDSHAKE_A_DONE_SESSION_ID] = { .name = "session-id", .type = YNL_PT_U32, }, }; const struct ynl_policy_nest handshake_done_nest = { @@ -214,6 +235,11 @@ int handshake_accept_rsp_parse(const struct nlmsghdr *nlh, return YNL_PARSE_CB_ERROR; dst->_present.keyring = 1; dst->keyring = ynl_attr_get_u32(attr); + } else if (type == HANDSHAKE_A_ACCEPT_KEY_SERIAL) { + if (ynl_attr_validate(yarg, attr)) + return YNL_PARSE_CB_ERROR; + dst->_present.key_serial = 1; + dst->key_serial = ynl_attr_get_u32(attr); } } @@ -316,6 +342,8 @@ int handshake_done(struct ynl_sock *ys, struct handshake_done_req *req) ynl_attr_put_s32(nlh, HANDSHAKE_A_DONE_SOCKFD, req->sockfd); for (i = 0; i < req->_count.remote_auth; i++) ynl_attr_put_u32(nlh, HANDSHAKE_A_DONE_REMOTE_AUTH, req->remote_auth[i]); + if (req->_present.session_id) + ynl_attr_put_u32(nlh, HANDSHAKE_A_DONE_SESSION_ID, req->session_id); err = ynl_exec(ys, nlh, &yrs); if (err < 0) diff --git a/home/nipa/nipa_out/999126/ynl/old-code/handshake-user.h b/home/nipa/nipa_out/999126/ynl/new-code/handshake-user.h index 713431c6dfb8..ff19c851e5ff 100644 --- a/home/nipa/nipa_out/999126/ynl/old-code/handshake-user.h +++ b/home/nipa/nipa_out/999126/ynl/new-code/handshake-user.h @@ -20,6 +20,8 @@ const char *handshake_op_str(int op); const char *handshake_handler_class_str(enum handshake_handler_class value); const char *handshake_msg_type_str(enum handshake_msg_type value); const char *handshake_auth_str(enum handshake_auth value); +const char * +handshake_key_update_type_str(enum handshake_key_update_type value); /* Common nested types */ struct handshake_x509 { @@ -63,6 +65,7 @@ struct handshake_accept_rsp { __u32 timeout:1; __u32 auth_mode:1; __u32 keyring:1; + __u32 key_serial:1; } _present; struct { __u32 peername; @@ -80,6 +83,7 @@ struct handshake_accept_rsp { struct handshake_x509 *certificate; char *peername; __u32 keyring; + __u32 key_serial; }; void handshake_accept_rsp_free(struct handshake_accept_rsp *rsp); @@ -107,6 +111,7 @@ struct handshake_done_req { struct { __u32 status:1; __u32 sockfd:1; + __u32 session_id:1; } _present; struct { __u32 remote_auth; @@ -115,6 +120,7 @@ struct handshake_done_req { __u32 status; __s32 sockfd; __u32 *remote_auth; + __u32 session_id; }; static inline struct handshake_done_req *handshake_done_req_alloc(void) @@ -144,6 +150,13 @@ __handshake_done_req_set_remote_auth(struct handshake_done_req *req, req->remote_auth = remote_auth; req->_count.remote_auth = n_remote_auth; } +static inline void +handshake_done_req_set_session_id(struct handshake_done_req *req, + __u32 session_id) +{ + req->_present.session_id = 1; + req->session_id = session_id; +} /* * Handler reports handshake completion