From: Ken Milmore <ken.milmore@gmail.com>
To: kernel-tls-handshake@lists.linux.dev
Subject: [PATCH 1/7] tlshd_handshake_parms: Dispense with unnecessary dynamic storage for peerids.
Date: Sun, 8 Jun 2025 18:42:44 +0100 [thread overview]
Message-ID: <28cbbced-681c-420e-9015-bb8b6dda3b39@gmail.com> (raw)
Signed-off-by: Ken Milmore <ken.milmore@gmail.com>
---
src/tlshd/client.c | 2 +-
src/tlshd/handshake.c | 2 --
src/tlshd/netlink.c | 9 +--------
src/tlshd/tlshd.h | 2 +-
4 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/tlshd/client.c b/src/tlshd/client.c
index 9c8f512..80107b2 100644
--- a/src/tlshd/client.c
+++ b/src/tlshd/client.c
@@ -434,7 +434,7 @@ static void tlshd_tls13_client_psk_handshake(struct tlshd_handshake_parms *parms
{
unsigned int i;
- if (!parms->peerids) {
+ if (!parms->num_peerids) {
tlshd_log_error("No key identities");
return;
}
diff --git a/src/tlshd/handshake.c b/src/tlshd/handshake.c
index b9de6b3..6d10eaf 100644
--- a/src/tlshd/handshake.c
+++ b/src/tlshd/handshake.c
@@ -185,8 +185,6 @@ out:
if (parms.keyring)
keyctl_unlink(parms.keyring, KEY_SPEC_SESSION_KEYRING);
- free(parms.peerids);
-
if (parms.session_status) {
tlshd_log_failure(parms.peername, parms.peeraddr,
parms.peeraddr_len);
diff --git a/src/tlshd/netlink.c b/src/tlshd/netlink.c
index ff9e35a..34a1f47 100644
--- a/src/tlshd/netlink.c
+++ b/src/tlshd/netlink.c
@@ -188,13 +188,6 @@ static void tlshd_parse_peer_identity(struct tlshd_handshake_parms *parms,
}
parms->num_peerids = 1;
-
- parms->peerids = calloc(parms->num_peerids, sizeof(key_serial_t));
- if (!parms->peerids) {
- parms->num_peerids = 0;
- return;
- }
-
parms->peerids[0] = nla_get_s32(head);
}
@@ -312,7 +305,7 @@ static const struct tlshd_handshake_parms tlshd_default_handshake_parms = {
.auth_mode = HANDSHAKE_AUTH_UNSPEC,
.x509_cert = TLS_NO_CERT,
.x509_privkey = TLS_NO_PRIVKEY,
- .peerids = NULL,
+ .peerids = { 0 },
.num_peerids = 0,
.msg_status = 0,
.session_status = EIO,
diff --git a/src/tlshd/tlshd.h b/src/tlshd/tlshd.h
index 135e1e0..f058a1a 100644
--- a/src/tlshd/tlshd.h
+++ b/src/tlshd/tlshd.h
@@ -39,7 +39,7 @@ struct tlshd_handshake_parms {
key_serial_t keyring;
key_serial_t x509_cert;
key_serial_t x509_privkey;
- key_serial_t *peerids;
+ key_serial_t peerids[1];
unsigned int num_peerids;
int msg_status;
--
2.47.2
next reply other threads:[~2025-06-08 17:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-08 17:42 Ken Milmore [this message]
2025-06-08 18:03 ` [PATCH 1/7] tlshd_handshake_parms: Dispense with unnecessary dynamic storage for peerids Chuck Lever
2025-06-08 19:08 ` Ken Milmore
2025-06-09 16:08 ` Chuck Lever
2025-06-13 21:42 ` Chuck Lever
2025-06-13 23:09 ` Ken Milmore
2025-06-14 0:40 ` Chuck Lever
2025-06-14 2:03 ` Ken Milmore
2025-06-18 13:42 ` Chuck Lever
2025-06-18 15:03 ` Ken Milmore
2025-06-18 16:00 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28cbbced-681c-420e-9015-bb8b6dda3b39@gmail.com \
--to=ken.milmore@gmail.com \
--cc=kernel-tls-handshake@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox