From c9d791e02d491b9f1d46aa4b58f7394ae39d0440 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 29 May 2023 14:12:54 +0200 Subject: [PATCH] nts: don't load zero-length keys with unsupported algorithm Don't load keys and cookies from the client's dump file if it has an unsupported algorithm and unparseable keys (matching the algorithm's expected length of zero). They would fail all SIV operations and trigger new NTS-KE session. --- nts_ntp_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nts_ntp_client.c b/nts_ntp_client.c index 10cf071..2f4b728 100644 --- a/nts_ntp_client.c +++ b/nts_ntp_client.c @@ -650,6 +650,7 @@ load_cookies(NNC_Instance inst) sizeof (inst->context.c2s.key)); if (inst->context.s2c.length != SIV_GetKeyLength(algorithm) || + inst->context.s2c.length <= 0 || inst->context.c2s.length != inst->context.s2c.length) goto error;