Skip to content

Commit

Permalink
handshake: Fix sign of key_serial_t fields
Browse files Browse the repository at this point in the history
key_serial_t fields are signed integers. Use nla_get/put_s32 for
those to avoid implicit signed conversion in the netlink protocol.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/169530167716.8905.645746457741372879.stgit@oracle-102.nfsv4bat.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Chuck Lever authored and Jakub Kicinski committed Oct 2, 2023
1 parent a6b07a5 commit 160f404
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Documentation/netlink/specs/handshake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ attribute-sets:
attributes:
-
name: cert
type: u32
type: s32
-
name: privkey
type: u32
type: s32
-
name: accept
attributes:
Expand Down
4 changes: 2 additions & 2 deletions net/handshake/tlshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ static int tls_handshake_put_certificate(struct sk_buff *msg,
if (!entry_attr)
return -EMSGSIZE;

if (nla_put_u32(msg, HANDSHAKE_A_X509_CERT,
if (nla_put_s32(msg, HANDSHAKE_A_X509_CERT,
treq->th_certificate) ||
nla_put_u32(msg, HANDSHAKE_A_X509_PRIVKEY,
nla_put_s32(msg, HANDSHAKE_A_X509_PRIVKEY,
treq->th_privkey)) {
nla_nest_cancel(msg, entry_attr);
return -EMSGSIZE;
Expand Down
4 changes: 2 additions & 2 deletions tools/net/ynl/generated/handshake-user.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ struct handshake_x509 {
__u32 privkey:1;
} _present;

__u32 cert;
__u32 privkey;
__s32 cert;
__s32 privkey;
};

/* ============== HANDSHAKE_CMD_ACCEPT ============== */
Expand Down

0 comments on commit 160f404

Please sign in to comment.