From: Miroslav Lichvar Date: Thu, 26 Mar 2020 14:30:28 +0000 (+0100) Subject: nts: zero cookie placeholder X-Git-Tag: 4.0-pre2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b98247d9c7f249c3ca79c8149e4158a981f2c6a;p=thirdparty%2Fchrony.git nts: zero cookie placeholder Zero the body of the cookie placeholder in client requests as recommended by the latest NTS draft. --- 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),