From 9b98247d9c7f249c3ca79c8149e4158a981f2c6a Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 26 Mar 2020 15:30:28 +0100 Subject: [PATCH] nts: zero cookie placeholder Zero the body of the cookie placeholder in client requests as recommended by the latest NTS draft. --- nts_ntp_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nts_ntp_client.c b/nts_ntp_client.c index 1e23f77c..79d552f8 100644 --- a/nts_ntp_client.c +++ b/nts_ntp_client.c @@ -288,6 +288,7 @@ NNC_GenerateRequestAuth(NNC_Instance inst, NTP_Packet *packet, { NKE_Cookie *cookie; int i, req_cookies; + void *ef_body; if (inst->num_cookies == 0 || !inst->siv_c2s) return 0; @@ -308,9 +309,10 @@ NNC_GenerateRequestAuth(NNC_Instance inst, NTP_Packet *packet, return 0; for (i = 0; i < req_cookies - 1; i++) { - if (!NEF_AddField(packet, info, NTP_EF_NTS_COOKIE_PLACEHOLDER, - cookie->cookie, cookie->length)) + if (!NEF_AddBlankField(packet, info, NTP_EF_NTS_COOKIE_PLACEHOLDER, + cookie->length, &ef_body)) return 0; + memset(ef_body, 0, cookie->length); } if (!NNA_GenerateAuthEF(packet, info, inst->siv_c2s, inst->nonce, sizeof (inst->nonce), -- 2.47.3