[Git][NTPsec/ntpsec][cookie] 4 commits: tests/ntpd/nts.c: Remove tabs, Single line /* comments to //

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Thu Aug 6 17:31:13 UTC 2026



Hal Murray pushed to branch cookie at NTPsec / ntpsec


Commits:
e69a219e by Gary E. Miller at 2026-08-06T10:17:37-07:00
tests/ntpd/nts.c: Remove tabs, Single line /* comments to //

No functional changes.

- - - - -
d9279df1 by Gary E. Miller at 2026-08-06T10:22:00-07:00
include/nts.h: Remove tabs, Single line /* comments to //

- - - - -
227a1ca3 by Gary E. Miller at 2026-08-06T10:30:59-07:00
ntpd/nts_cookie.c: Remove tabs, Single line /* comments to //

No functional changes.

- - - - -
f2a4febf by Gary E. Miller at 2026-08-06T10:30:59-07:00
ntpd/nts_cookie.c: restore previous comment indents

No functional changes.

- - - - -


3 changed files:

- include/nts.h
- ntpd/nts_cookie.c
- tests/ntpd/nts.c


Changes:

=====================================
include/nts.h
=====================================
@@ -12,20 +12,20 @@
 
 #include "ntp_fp.h"
 
-/* default file names */
+// default file names
 #define NTS_CERT_FILE "/etc/ntp/cert-chain.pem"
 #define NTS_KEY_FILE "/etc/ntp/key.pem"
 #define NTS_COOKIE_KEY_FILE "/var/lib/ntp/nts-keys"
 
-#define NTS_KE_PORT		4460
-#define NTS_KE_PORTA		"4460"
+#define NTS_KE_PORT             4460
+#define NTS_KE_PORTA            "4460"
 
-#define NTS_KE_TIMEOUT		3
+#define NTS_KE_TIMEOUT          3
 
 bool nts_server_init(void);
 bool nts_client_init(void);
 bool nts_cookie_init(void);
-bool nts_server_init2(void);    /* after sandbox */
+bool nts_server_init2(void);    // after sandbox
 bool nts_cookie_init2(void);
 
 void nts_cert_timer(void);
@@ -42,18 +42,18 @@ bool nts_unpack_cookie(uint8_t *cookie, int cookielen,
   uint16_t *aead,
   uint8_t *c2s, uint8_t *s2c, int *keylen);
 
-/* working finger into a buffer - updated by append/unpack routines */
+// working finger into a buffer - updated by append/unpack routines
 struct BufCtl_t {
-    uint8_t *next;  /* pointer to next data/space */
-    int left;       /* data left or space available */
+    uint8_t *next;  // pointer to next data/space
+    int left;       // data left or space available
 };
 typedef struct BufCtl_t BufCtl;
 
-/* Here for test routines */
+// Here for test routines
 bool nts_ke_process_receive(struct BufCtl_t *buf, int *aead,
   char *errbuf, int errlng, const char **errtxt);
 
-/***********************************************************/
+// *********************************************************
 
 /* buffer packing/unpacking routines.
  * NB: The length field in NTP extensions includes the header
@@ -67,12 +67,12 @@ bool nts_ke_process_receive(struct BufCtl_t *buf, int *aead,
  */
 
 
-/* 2 byte type, 2 byte length */
+// 2 byte type, 2 byte length
 #define NTS_KE_HDR_LNG 4
 #define NTS_KE_U16_LNG 2
 
-/* xxx_append_record_foo makes whole record with one foo */
-/* append_foo appends foo to existing partial record */
+// xxx_append_record_foo makes whole record with one foo
+// append_foo appends foo to existing partial record
 void ke_append_record_null(BufCtl* buf, uint16_t type);
 void ke_append_record_uint16(BufCtl* buf, uint16_t type, uint16_t data);
 void ke_append_record_bytes(BufCtl* buf, uint16_t type, uint8_t *data, int length);
@@ -87,19 +87,19 @@ void append_uint16(BufCtl* buf, uint16_t data);
 void append_bytes(BufCtl* buf, uint8_t *data, int length);
 
 uint16_t ke_next_record(BufCtl* buf, int *length);
-uint16_t ex_next_record(BufCtl* buf, int *length);  /* body length */
+uint16_t ex_next_record(BufCtl* buf, int *length);  // body length
 uint16_t next_uint16(BufCtl* buf);
 uint16_t next_bytes(BufCtl* buf, uint8_t *data, int length);
 
-/***********************************************************/
+// *********************************************************
 
-#define NTS_MAX_KEYLEN		64	/* used in cookies */
-#define NTS_MAX_COOKIELEN	192	/* see nts_cookie.c */
-#define NTS_MAX_COOKIES		8	/* RFC 4.1.6 */
-#define NTS_UID_LENGTH		32	/* RFC 5.3 */
-#define NTS_UID_MAX_LENGTH	64
+#define NTS_MAX_KEYLEN          64      // used in cookies
+#define NTS_MAX_COOKIELEN       192     // see nts_cookie.c
+#define NTS_MAX_COOKIES         8       // RFC 4.1.6
+#define NTS_UID_LENGTH          32      // RFC 5.3
+#define NTS_UID_MAX_LENGTH      64
 
-/* Here for tester */
+// Here for tester
 struct NTS_Key {
   uint8_t K[NTS_MAX_KEYLEN];
   uint32_t I;
@@ -108,87 +108,87 @@ struct NTS_Key {
   #define NTS_nKEYS 10
 #endif
 extern struct NTS_Key nts_keys[NTS_nKEYS];
-extern int nts_nKeys;		/* for tester */
+extern int nts_nKeys;           // for tester
 
 
 /* Client side configuration data for an NTS association
  * All are optional.
  * part of peer struct */
 struct ntscfg_t {
-	char *ca;		/* root/trusted certificates */
-	char *aead;		/* AEAD algorithms on wire */
+        char *ca;               // root/trusted certificates
+        char *aead;             // AEAD algorithms on wire
 };
 
-/* Client-side state per connection to server */
+// Client-side state per connection to server
 struct ntsclient_t {
-	/* wire connection */
-	uint16_t aead;	/* AEAD algorithm used on wire */
-	int keylen;
-	uint8_t c2s[NTS_MAX_KEYLEN], s2c[NTS_MAX_KEYLEN];
-	/* UID of last request sent - RFC 5.3 */
-	uint8_t UID[NTS_UID_LENGTH];
-	/* cookies */
-	int readIdx, writeIdx;
-	int count;			/* -1 if not in NTS mode */
-	int cookielen;
-	uint8_t cookies[NTS_MAX_COOKIES][NTS_MAX_COOKIELEN];
+        // wire connection
+        uint16_t aead;  // AEAD algorithm used on wire
+        int keylen;
+        uint8_t c2s[NTS_MAX_KEYLEN], s2c[NTS_MAX_KEYLEN];
+        // UID of last request sent - RFC 5.3
+        uint8_t UID[NTS_UID_LENGTH];
+        // cookies
+        int readIdx, writeIdx;
+        int count;                      // -1 if not in NTS mode
+        int cookielen;
+        uint8_t cookies[NTS_MAX_COOKIES][NTS_MAX_COOKIELEN];
 };
 
-/* Server-side state per packet */
+// Server-side state per packet
 struct ntspacket_t {
-	bool valid;
-	int uidlen;
-	uint8_t UID[NTS_UID_MAX_LENGTH];
-	int needed;
-	uint16_t aead;
-	int keylen;
-	uint8_t c2s[NTS_MAX_KEYLEN], s2c[NTS_MAX_KEYLEN];
+        bool valid;
+        int uidlen;
+        uint8_t UID[NTS_UID_MAX_LENGTH];
+        int needed;
+        uint16_t aead;
+        int keylen;
+        uint8_t c2s[NTS_MAX_KEYLEN], s2c[NTS_MAX_KEYLEN];
 };
 
 
-/* Configuration data for an NTS server or client instance */
+// Configuration data for an NTS server or client instance
 struct ntsconfig_t {
-	bool ntsenable; 	/* enable NTS KE server on this ntpd */
-	const char * mintls;	/* minimum TLS version allowed */
-	const char * maxtls;	/* maximum TLS version allowed */
-	const char *tlsciphersuites;/* allowed TLS 1.3 ciphersuites */
-	const char *tlsecdhcurves; /* allowed ecdhcurves list*/
-	const char *cert;	/* file holding server certificate key */
-	const char *key;	/* file holding server private key */
-	const char *KI;		/* file holding K/I for making cookies */
-	const char *ca;		/* root cert dir/file */
-	const char *aead;	/* AEAD algorithms on wire */
-	bool tlscipherserverpreference;  /* OpenSSL 3.0 default is client */
+        bool ntsenable;         // enable NTS KE server on this ntpd
+        const char * mintls;    // minimum TLS version allowed
+        const char * maxtls;    // maximum TLS version allowed
+        const char *tlsciphersuites;  // allowed TLS 1.3 ciphersuites
+        const char *tlsecdhcurves;  // allowed ecdhcurves list
+        const char *cert;       // file holding server certificate key
+        const char *key;        // file holding server private key
+        const char *KI;         // file holding K/I for making cookies
+        const char *ca;         // root cert dir/file
+        const char *aead;       // AEAD algorithms on wire
+        bool tlscipherserverpreference;  // OpenSSL 3.0 default is client
 };
 
 
-/* CMAC length is wired into AEAD_AES_SIV_CMAC_nnn. */
+// CMAC length is wired into AEAD_AES_SIV_CMAC_nnn.
 #define CMAC_LENGTH 16
-/* The NONCE length comes from RFC 5116 and/or 5297. */
+// The NONCE length comes from RFC 5116 and/or 5297.
 #define NONCE_LENGTH 16
 
-/* NTS protocol constants */
+// NTS protocol constants
 
 #define NTS_CRITICAL 0x8000
 enum nts_record_type {
-	nts_end_of_message = 0,		/* CRITICAL */
-	nts_next_protocol_negotiation = 1,	/* CRITICAL */
-	nts_error = 2,			/* CRITICAL */
-	nts_warning = 3,
-	nts_algorithm_negotiation = 4,
-	nts_new_cookie = 5,
-	nts_server_negotiation = 6,
-	nts_port_negotiation = 7
+        nts_end_of_message = 0,         // CRITICAL
+        nts_next_protocol_negotiation = 1,      // CRITICAL
+        nts_error = 2,                  // CRITICAL
+        nts_warning = 3,
+        nts_algorithm_negotiation = 4,
+        nts_new_cookie = 5,
+        nts_server_negotiation = 6,
+        nts_port_negotiation = 7
 };
 
 enum nts_protocol_type {
-	nts_protocol_NTP = 0,
+        nts_protocol_NTP = 0,
 };
 
 
 enum nts_errors_type {
-	nts_unrecognized_critical_section = 0,
-	nts_bad_request = 1
+        nts_unrecognized_critical_section = 0,
+        nts_bad_request = 1
 };
 
 
@@ -197,50 +197,50 @@ enum nts_errors_type {
  */
 enum aead_ciphers {
 #define NO_AEAD 0xffff
-	AEAD_AES_128_GCM = 1,
-	AEAD_AES_256_GCM = 2,
-	AEAD_AES_128_CCM = 3,
-	AEAD_AES_256_CCM = 4,
-
-	AEAD_AES_128_GCM_8 = 5,
-	AEAD_AES_256_GCM_8 = 6,
-	AEAD_AES_128_GCM_12 = 7,
-	AEAD_AES_256_GCM_12 = 8,
-
-	AEAD_AES_128_CCM_SHORT = 9,
-	AEAD_AES_256_CCM_SHORT = 10,
-	AEAD_AES_128_CCM_SHORT_8 = 11,
-	AEAD_AES_256_CCM_SHORT_8 = 12,
-	AEAD_AES_128_CCM_SHORT_12 = 13,
-	AEAD_AES_256_CCM_SHORT_12 = 14,
-
-	AEAD_AES_SIV_CMAC_256 = 15,     /* RFC 5297 */
-	AEAD_AES_SIV_CMAC_384 = 16,     /* These 3 are the ones we use */
-	AEAD_AES_SIV_CMAC_512 = 17,
+        AEAD_AES_128_GCM = 1,
+        AEAD_AES_256_GCM = 2,
+        AEAD_AES_128_CCM = 3,
+        AEAD_AES_256_CCM = 4,
+
+        AEAD_AES_128_GCM_8 = 5,
+        AEAD_AES_256_GCM_8 = 6,
+        AEAD_AES_128_GCM_12 = 7,
+        AEAD_AES_256_GCM_12 = 8,
+
+        AEAD_AES_128_CCM_SHORT = 9,
+        AEAD_AES_256_CCM_SHORT = 10,
+        AEAD_AES_128_CCM_SHORT_8 = 11,
+        AEAD_AES_256_CCM_SHORT_8 = 12,
+        AEAD_AES_128_CCM_SHORT_12 = 13,
+        AEAD_AES_256_CCM_SHORT_12 = 14,
+
+        AEAD_AES_SIV_CMAC_256 = 15,     // RFC 5297
+        AEAD_AES_SIV_CMAC_384 = 16,     // These 3 are the ones we use
+        AEAD_AES_SIV_CMAC_512 = 17,
 #define AEAD_AES_SIV_CMAC_256_KEYLEN 32
 #define AEAD_AES_SIV_CMAC_384_KEYLEN 48
 #define AEAD_AES_SIV_CMAC_512_KEYLEN 64
 
-	AEAD_AES_128_CCM_8 = 18,
-	AEAD_AES_256_CCM_8 = 19,
+        AEAD_AES_128_CCM_8 = 18,
+        AEAD_AES_256_CCM_8 = 19,
 
-	AEAD_AES_128_OCB_TAGLEN128 = 20,
-	AEAD_AES_128_OCB_TAGLEN96 = 21,
-	AEAD_AES_128_OCB_TAGLEN64 = 22,
-	AEAD_AES_192_OCB_TAGLEN128 = 23,
-	AEAD_AES_192_OCB_TAGLEN96 = 24,
-	AEAD_AES_192_OCB_TAGLEN64 = 25,
-	AEAD_AES_256_OCB_TAGLEN128 = 26,
-	AEAD_AES_256_OCB_TAGLEN96 = 27,
-	AEAD_AES_256_OCB_TAGLEN64 = 28,
+        AEAD_AES_128_OCB_TAGLEN128 = 20,
+        AEAD_AES_128_OCB_TAGLEN96 = 21,
+        AEAD_AES_128_OCB_TAGLEN64 = 22,
+        AEAD_AES_192_OCB_TAGLEN128 = 23,
+        AEAD_AES_192_OCB_TAGLEN96 = 24,
+        AEAD_AES_192_OCB_TAGLEN64 = 25,
+        AEAD_AES_256_OCB_TAGLEN128 = 26,
+        AEAD_AES_256_OCB_TAGLEN96 = 27,
+        AEAD_AES_256_OCB_TAGLEN64 = 28,
 
-	AEAD_CHACHA20_POLY1305 = 29,
+        AEAD_CHACHA20_POLY1305 = 29,
 
-	AEAD_AES_128_GCM_SIV = 30,
-	AEAD_AES_256_GCM_SIV = 31,
+        AEAD_AES_128_GCM_SIV = 30,
+        AEAD_AES_256_GCM_SIV = 31,
 
-	AEAD_AEGIS128L = 32,
-	AEAD_AEGIS256 = 33
+        AEAD_AEGIS128L = 32,
+        AEAD_AEGIS256 = 33
 };
 
 
@@ -249,7 +249,7 @@ extern struct ntsconfig_t ntsconfig;
 
 
 
-/* NTS-related statistics visible via ntpq -c nts */
+// NTS-related statistics visible via ntpq -c nts
 struct nts_counters {
   uint64_t client_send;
   uint64_t client_recv_good;
@@ -258,17 +258,17 @@ struct nts_counters {
   uint64_t server_recv_good;
   uint64_t server_recv_bad;
   uint64_t cookie_make;
-  uint64_t cookie_not_server;   /* we are not a NTS server */
-  uint64_t cookie_decode_total; /* total attempts, includes too old */
+  uint64_t cookie_not_server;   // we are not a NTS server
+  uint64_t cookie_decode_total;  // total attempts, includes too old
   uint64_t cookie_decode_current;
   uint64_t cookie_decode_old;
   uint64_t cookie_decode_old2;
   uint64_t cookie_decode_older;
-  uint64_t cookie_decode_too_old; /* or garbage */
+  uint64_t cookie_decode_too_old;  // or garbage
   uint64_t cookie_decode_error;
 };
 struct ntske_counters {
-  /* Server */
+  // Server
   uint64_t serves_nossl;
   l_fp     serves_nossl_wall;
   l_fp     serves_nossl_cpu;
@@ -278,7 +278,7 @@ struct ntske_counters {
   uint64_t serves_good;
   l_fp     serves_good_wall;
   l_fp     serves_good_cpu;
-  /* Client */
+  // Client
   uint64_t probes_good;
   uint64_t probes_bad;
 };
@@ -286,4 +286,4 @@ extern struct nts_counters nts_cnt, old_nts_cnt;
 extern struct ntske_counters ntske_cnt, old_ntske_cnt;
 
 
-#endif /* GUARD_NTS_H */
+#endif  // GUARD_NTS_H


=====================================
ntpd/nts_cookie.c
=====================================
@@ -81,7 +81,7 @@
  * #define is in include/nts.h
  */
 
-/* cookies use same AEAD algorithms as wire */
+// cookies use same AEAD algorithms as wire
 /* This determines which algorithm we use.
  * Valid choices are 32, 48, and 64
  * making this a variable rather than #define
@@ -90,7 +90,7 @@
  * You can change that by editing the keys file.
  */
 int K_length = AEAD_AES_SIV_CMAC_256_KEYLEN;
-time_t K_time = 0;	/* time K was created, 0 for none */
+time_t K_time = 0;      // time K was created, 0 for none
 struct NTS_Key nts_keys[NTS_nKEYS];
 int nts_nKeys = 0;
 
@@ -105,11 +105,11 @@ void nts_lock_cookielock(void);
 void nts_unlock_cookielock(void);
 
 // FIXME  AEAD_LENGTH
-/* Associated data: aead (rounded up to 4) plus NONCE */
+// Associated data: aead (rounded up to 4) plus NONCE
 #define AD_LENGTH 20
 #define AEAD_LENGTH 4
 
-/* cookie_ctx needed for client side */
+// cookie_ctx needed for client side
 bool nts_cookie_init(void) {
   cookie_ctx = AES_SIV_CTX_new();
   if (NULL == cookie_ctx) {
@@ -119,16 +119,16 @@ bool nts_cookie_init(void) {
   return true;
 }
 
-/* cookie key needed for server side */
+// cookie key needed for server side
 bool nts_cookie_init2(void) {
-	bool OK = true;
-	if (!nts_read_cookie_keys()) {
-		/* Can't read cookie file.  Make one */
-		nts_make_cookie_key();
-		K_time = time(NULL);
-		nts_write_cookie_keys();
-	}
-	return OK;
+        bool OK = true;
+        if (!nts_read_cookie_keys()) {
+                // Can't read cookie file.  Make one
+                nts_make_cookie_key();
+                K_time = time(NULL);
+                nts_write_cookie_keys();
+        }
+        return OK;
 }
 
 /* Rotate key -- 24 hours after last rotation
@@ -142,83 +142,83 @@ bool nts_cookie_init2(void) {
 // Just uncommenting the next line will generate a warning reminder.
 // #define SecondsPerDay 3600
 void nts_cookie_timer(void) {
-	time_t now;
-	if (0 == K_time) {
-		return;
-	}
-	now = time(NULL);
-	if (SecondsPerDay > (now-K_time)) {
-		return;
-	}
-	nts_make_cookie_key();
-	/* In case we were off for many days. */
-	while (SecondsPerDay < (now-K_time)) {
-		K_time += SecondsPerDay;
-	}
-	if (nts_write_cookie_keys() )
-		msyslog(LOG_INFO, "NTS: Wrote new cookie file, %d keys.", nts_nKeys);
-	else
-		msyslog(LOG_INFO, "NTS: Trouble writing new cookie file.");
-	return;
+        time_t now;
+        if (0 == K_time) {
+                return;
+        }
+        now = time(NULL);
+        if (SecondsPerDay > (now-K_time)) {
+                return;
+        }
+        nts_make_cookie_key();
+        // In case we were off for many days.
+        while (SecondsPerDay < (now-K_time)) {
+                K_time += SecondsPerDay;
+        }
+        if (nts_write_cookie_keys() )
+                msyslog(LOG_INFO, "NTS: Wrote new cookie file, %d keys.", nts_nKeys);
+        else
+                msyslog(LOG_INFO, "NTS: Trouble writing new cookie file.");
+        return;
 }
 
 
 bool nts_read_cookie_keys(void) {
-	const char *cookie_filename = NTS_COOKIE_KEY_FILE;
-	FILE *in;
-	unsigned long templ;
-	if (NULL != ntsconfig.KI)
-		cookie_filename = ntsconfig.KI;
-	in = fopen(cookie_filename, "r");
-	if (NULL == in) {
-		char errbuf[100];
-		if (ENOENT == errno)
-			return false;		/* File doesn't exist */
-		ntp_strerror_r(errno, errbuf, sizeof(errbuf));
-		msyslog(LOG_ERR, "NTSs: can't read old cookie file: %s=>%s",
-			cookie_filename, errbuf);
-		exit(1);
-	}
-	if (1 != fscanf(in, "T: %lu\n", &templ)) {
-		goto bail;
-	}
-	K_time = templ;
-	if (1 != fscanf(in, "L: %d\n", &K_length)) {
-		goto bail;
-	}
-	if ( !((32 == K_length) || (48 == K_length) || (64 == K_length))) {
-		goto bail;
-	}
-	nts_nKeys = 0;
-	for (int i=0; i<NTS_nKEYS; i++) {
-	  struct NTS_Key *key = &nts_keys[i];
-	  if (1 != fscanf(in, "I: %u\n", &key->I)) {
-		if (0 < nts_nKeys) break;
-		goto bail;
-	  }
-	  if (0 != fscanf(in, "K: ")) {
-		goto bail;
-	  }
-	  for (int j=0; j< K_length; j++) {
-		unsigned int temp;
-		if (1 != fscanf(in, "%02x", &temp)) {
-			goto bail;
-		}
-		key->K[j] = temp;
-	  }
-	  if (0 != fscanf(in, "\n")) {
-		goto bail;
-	  }
-	  nts_nKeys = i+1;
-	}
-	fclose(in);
-	msyslog(LOG_INFO, "NTS: Read cookie file, %d keys.", nts_nKeys);
-	return true;
+        const char *cookie_filename = NTS_COOKIE_KEY_FILE;
+        FILE *in;
+        unsigned long templ;
+        if (NULL != ntsconfig.KI)
+                cookie_filename = ntsconfig.KI;
+        in = fopen(cookie_filename, "r");
+        if (NULL == in) {
+                char errbuf[100];
+                if (ENOENT == errno)
+                        return false;           // File doesn't exist
+                ntp_strerror_r(errno, errbuf, sizeof(errbuf));
+                msyslog(LOG_ERR, "NTSs: can't read old cookie file: %s=>%s",
+                        cookie_filename, errbuf);
+                exit(1);
+        }
+        if (1 != fscanf(in, "T: %lu\n", &templ)) {
+                goto bail;
+        }
+        K_time = templ;
+        if (1 != fscanf(in, "L: %d\n", &K_length)) {
+                goto bail;
+        }
+        if ( !((32 == K_length) || (48 == K_length) || (64 == K_length))) {
+                goto bail;
+        }
+        nts_nKeys = 0;
+        for (int i=0; i<NTS_nKEYS; i++) {
+          struct NTS_Key *key = &nts_keys[i];
+          if (1 != fscanf(in, "I: %u\n", &key->I)) {
+                if (0 < nts_nKeys) break;
+                goto bail;
+          }
+          if (0 != fscanf(in, "K: ")) {
+                goto bail;
+          }
+          for (int j=0; j< K_length; j++) {
+                unsigned int temp;
+                if (1 != fscanf(in, "%02x", &temp)) {
+                        goto bail;
+                }
+                key->K[j] = temp;
+          }
+          if (0 != fscanf(in, "\n")) {
+                goto bail;
+          }
+          nts_nKeys = i+1;
+        }
+        fclose(in);
+        msyslog(LOG_INFO, "NTS: Read cookie file, %d keys.", nts_nKeys);
+        return true;
 
   bail:
-	msyslog(LOG_ERR, "ERR: Error parsing cookie keys file");
-	fclose(in);
-	return false;
+        msyslog(LOG_ERR, "ERR: Error parsing cookie keys file");
+        fclose(in);
+        return false;
 }
 
 /* RFC 8915 describes a ratchet mode to make new keys
@@ -229,241 +229,241 @@ bool nts_read_cookie_keys(void) {
  * they copy the key file to other systems and have them load it.
  */
 void nts_make_cookie_key(void) {
-	if (nts_nKeys < NTS_nKEYS) nts_nKeys++;
-	for (int i=nts_nKeys-1; i>0; i--) {
-	  nts_keys[i] = nts_keys[i-1];
-	}
-	ntp_RAND_priv_bytes(nts_keys[0].K, K_length);
-	ntp_RAND_bytes((uint8_t *)&nts_keys[0].I, sizeof(nts_keys[0].I));
-	return;
+        if (nts_nKeys < NTS_nKEYS) nts_nKeys++;
+        for (int i=nts_nKeys-1; i>0; i--) {
+          nts_keys[i] = nts_keys[i-1];
+        }
+        ntp_RAND_priv_bytes(nts_keys[0].K, K_length);
+        ntp_RAND_bytes((uint8_t *)&nts_keys[0].I, sizeof(nts_keys[0].I));
+        return;
 }
 
 bool nts_write_cookie_keys(void) {
-	const char *cookiefile = NTS_COOKIE_KEY_FILE;
-	char tempfile[PATH_MAX];
-	int fd;
-	FILE *out;
-	char errbuf[100];
-	if (NULL != ntsconfig.KI)
-		cookiefile = ntsconfig.KI;
-	strlcpy(tempfile, cookiefile, sizeof(tempfile));
-	strlcat(tempfile, "-tmp", sizeof(tempfile));
-	fd = open(tempfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
-	if (-1 == fd) {
-		ntp_strerror_r(errno, errbuf, sizeof(errbuf));
-		msyslog(LOG_ERR, "ERR: can't open %s: %s", tempfile, errbuf);
-		return false;
-	}
-	out = fdopen(fd, "w");
-	if (NULL == out) {
-		ntp_strerror_r(errno, errbuf, sizeof(errbuf));
-		msyslog(LOG_ERR, "ERR: can't fdopen %s: %s", tempfile, errbuf);
-		close(fd);
-		return false;
-	}
-
-	fprintf(out, "T: %lu\n", (unsigned long)K_time);
-	fprintf(out, "L: %d\n", K_length);
-	for (int i=0; i<nts_nKeys; i++) {
-	  struct NTS_Key *key = &nts_keys[i];
-	  fprintf(out, "I: %u\n", key->I);
-	  fprintf(out, "K: ");
-	    for (int j=0; j< K_length; j++) fprintf(out, "%02x", key->K[j]);
-	  fprintf(out, "\n");
-	  key++;
-	}
-	fclose(out);
+        const char *cookiefile = NTS_COOKIE_KEY_FILE;
+        char tempfile[PATH_MAX];
+        int fd;
+        FILE *out;
+        char errbuf[100];
+        if (NULL != ntsconfig.KI)
+                cookiefile = ntsconfig.KI;
+        strlcpy(tempfile, cookiefile, sizeof(tempfile));
+        strlcat(tempfile, "-tmp", sizeof(tempfile));
+        fd = open(tempfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
+        if (-1 == fd) {
+                ntp_strerror_r(errno, errbuf, sizeof(errbuf));
+                msyslog(LOG_ERR, "ERR: can't open %s: %s", tempfile, errbuf);
+                return false;
+        }
+        out = fdopen(fd, "w");
+        if (NULL == out) {
+                ntp_strerror_r(errno, errbuf, sizeof(errbuf));
+                msyslog(LOG_ERR, "ERR: can't fdopen %s: %s", tempfile, errbuf);
+                close(fd);
+                return false;
+        }
+
+        fprintf(out, "T: %lu\n", (unsigned long)K_time);
+        fprintf(out, "L: %d\n", K_length);
+        for (int i=0; i<nts_nKeys; i++) {
+          struct NTS_Key *key = &nts_keys[i];
+          fprintf(out, "I: %u\n", key->I);
+          fprintf(out, "K: ");
+            for (int j=0; j< K_length; j++) fprintf(out, "%02x", key->K[j]);
+          fprintf(out, "\n");
+          key++;
+        }
+        fclose(out);
         if (rename(tempfile, cookiefile)) {
-	    ntp_strerror_r(errno, errbuf, sizeof(errbuf));
+            ntp_strerror_r(errno, errbuf, sizeof(errbuf));
             msyslog(LOG_WARNING,
                     "LOG: Unable to rename temp cookie file %s to %s, %s",
                     tempfile, cookiefile, errbuf);
-	    return false;
-	}
-	return true;
+            return false;
+        }
+        return true;
 }
 
-/* returns actual length */
+// returns actual length
 int nts_make_cookie(uint8_t *cookie,
   uint16_t aead,
   uint8_t *c2s, uint8_t *s2c, int keylen) {
-	uint8_t plaintext[NTS_MAX_COOKIELEN];
-	uint8_t *nonce;
-	int used, plainlength;
-	bool ok;
-	uint8_t * finger;
-	uint32_t temp;	/* keep 4 byte alignment */
-	size_t left;
-
-	if (NULL == cookie_ctx)
-		return 0;		/* We aren't initialized yet. */
-
-	nts_cnt.cookie_make++;
-
-	INSIST(keylen <= NTS_MAX_KEYLEN);
-
-	/* collect plaintext
-	 * separate buffer avoids encrypt in place
-	 * but costs cache space
-	 */
-	finger = plaintext;
-	temp = aead;
-	memcpy(finger, &temp, AEAD_LENGTH);
-	finger += AEAD_LENGTH;
-	memcpy(finger, c2s, keylen);
-	finger += keylen;
-	memcpy(finger, s2c, keylen);
-	finger += keylen;
-	plainlength = finger-plaintext;
-
-	/* collect associated data */
-	finger = cookie;
-
-	memcpy(finger, &nts_keys[0].I, sizeof(nts_keys[0].I));
-	finger += sizeof(nts_keys[0].I);
-
-	nonce = finger;
-	ntp_RAND_bytes(finger, NONCE_LENGTH);
-	finger += NONCE_LENGTH;
-
-	used = finger-cookie;
-	left = NTS_MAX_COOKIELEN-used;
-
-	nts_lock_cookielock();
-
-	ok = AES_SIV_Encrypt(cookie_ctx,
-			     finger, &left,   /* left: in: max out length, out: length used */
-			     nts_keys[0].K, K_length,
-			     nonce, NONCE_LENGTH,
-			     plaintext, plainlength,
-			     cookie, AD_LENGTH);
-
-	nts_unlock_cookielock();
-
-	if (!ok) {
-		msyslog(LOG_ERR, "NTS: nts_make_cookie - Error from AES_SIV_Encrypt");
-		/* I don't think this should happen,
-		 * so crash rather than work incorrectly.
-		 * Hal, 2019-Feb-17
-		 * Similar code in ntp_extens
-		 */
-		exit(1);
-	}
-
-	used += left;
-	INSIST(used <= NTS_MAX_COOKIELEN);
-
-	return used;
+        uint8_t plaintext[NTS_MAX_COOKIELEN];
+        uint8_t *nonce;
+        int used, plainlength;
+        bool ok;
+        uint8_t * finger;
+        uint32_t temp;  // keep 4 byte alignment
+        size_t left;
+
+        if (NULL == cookie_ctx)
+                return 0;               // We aren't initialized yet.
+
+        nts_cnt.cookie_make++;
+
+        INSIST(keylen <= NTS_MAX_KEYLEN);
+
+        /* collect plaintext
+         * separate buffer avoids encrypt in place
+         * but costs cache space
+         */
+        finger = plaintext;
+        temp = aead;
+        memcpy(finger, &temp, AEAD_LENGTH);
+        finger += AEAD_LENGTH;
+        memcpy(finger, c2s, keylen);
+        finger += keylen;
+        memcpy(finger, s2c, keylen);
+        finger += keylen;
+        plainlength = finger-plaintext;
+
+        // collect associated data
+        finger = cookie;
+
+        memcpy(finger, &nts_keys[0].I, sizeof(nts_keys[0].I));
+        finger += sizeof(nts_keys[0].I);
+
+        nonce = finger;
+        ntp_RAND_bytes(finger, NONCE_LENGTH);
+        finger += NONCE_LENGTH;
+
+        used = finger-cookie;
+        left = NTS_MAX_COOKIELEN-used;
+
+        nts_lock_cookielock();
+
+        ok = AES_SIV_Encrypt(cookie_ctx,
+                             finger, &left,   // left: in: max out length, out: length used
+                             nts_keys[0].K, K_length,
+                             nonce, NONCE_LENGTH,
+                             plaintext, plainlength,
+                             cookie, AD_LENGTH);
+
+        nts_unlock_cookielock();
+
+        if (!ok) {
+                msyslog(LOG_ERR, "NTS: nts_make_cookie - Error from AES_SIV_Encrypt");
+                /* I don't think this should happen,
+                 * so crash rather than work incorrectly.
+                 * Hal, 2019-Feb-17
+                 * Similar code in ntp_extens
+                 */
+                exit(1);
+        }
+
+        used += left;
+        INSIST(used <= NTS_MAX_COOKIELEN);
+
+        return used;
 }
 
-/* can't decrypt in place - that would trash the unauthenticated packet */
+// can't decrypt in place - that would trash the unauthenticated packet
 bool nts_unpack_cookie(uint8_t *cookie, int cookielen,
   uint16_t *aead,
   uint8_t *c2s, uint8_t *s2c, int *keylen) {
-	uint8_t *finger;
-	uint8_t plaintext[NTS_MAX_COOKIELEN];
-	uint8_t *nonce;
-	uint32_t temp;
-	size_t plainlength;
-	int cipherlength;
-	bool ok;
-	struct NTS_Key *key;
-	int i;
-
-	if (NULL == cookie_ctx)
-		return false;	/* We aren't initialized yet. */
-
-	if (0 == nts_nKeys) {
-		nts_cnt.cookie_not_server++;
-		return false;  /* We are not a NTS enabled server. */
-	}
-
-	/* We may get garbage from the net */
-	if (cookielen > NTS_MAX_COOKIELEN)
-		return false;
-
-	finger = cookie;
-	key = NULL;		/* squash uninitialized warning */
-	for (i=0; i<nts_nKeys; i++) {
-	  key = &nts_keys[i];
-	  if (0 == memcmp(finger, &key->I, sizeof(key->I))) {
-		break;
-	  }
-	}
-	nts_cnt.cookie_decode_total++;  /* total attempts, includes too old */
-	if (nts_nKeys == i) {
-		nts_cnt.cookie_decode_too_old++;
-		return false;
+        uint8_t *finger;
+        uint8_t plaintext[NTS_MAX_COOKIELEN];
+        uint8_t *nonce;
+        uint32_t temp;
+        size_t plainlength;
+        int cipherlength;
+        bool ok;
+        struct NTS_Key *key;
+        int i;
+
+        if (NULL == cookie_ctx)
+                return false;   // We aren't initialized yet.
+
+        if (0 == nts_nKeys) {
+                nts_cnt.cookie_not_server++;
+                return false;  // We are not a NTS enabled server.
+        }
+
+        // We may get garbage from the net
+        if (cookielen > NTS_MAX_COOKIELEN)
+                return false;
+
+        finger = cookie;
+        key = NULL;             // squash uninitialized warning
+        for (i=0; i<nts_nKeys; i++) {
+          key = &nts_keys[i];
+          if (0 == memcmp(finger, &key->I, sizeof(key->I))) {
+                break;
+          }
+        }
+        nts_cnt.cookie_decode_total++;  // total attempts, includes too old
+        if (nts_nKeys == i) {
+                nts_cnt.cookie_decode_too_old++;
+                return false;
+        }
+        if (0 == i) {
+                nts_cnt.cookie_decode_current++;
+        } else if (1 == i) {
+                nts_cnt.cookie_decode_old++;
+        } else if (2 == i) {
+                nts_cnt.cookie_decode_old2++;
+        } else {
+                nts_cnt.cookie_decode_older++;
         }
-	if (0 == i) {
-		nts_cnt.cookie_decode_current++;
-	} else if (1 == i) {
-		nts_cnt.cookie_decode_old++;
-	} else if (2 == i) {
-		nts_cnt.cookie_decode_old2++;
-	} else {
-		nts_cnt.cookie_decode_older++;
-	}
 #if 0
-	if (1<i) {
-	  /* Hack for debugging */
-	  /* Beware: DoS possibility on a public server */
-	  msyslog(LOG_INFO, "NTS: Old cookie: %d days.", i);
-	}
+        if (1<i) {
+          // Hack for debugging
+          // Beware: DoS possibility on a public server
+          msyslog(LOG_INFO, "NTS: Old cookie: %d days.", i);
+        }
 #endif
 
-	finger += sizeof(key->I);
-	nonce = finger;
-	finger += NONCE_LENGTH;
-
-	// require(AD_LENGTH==finger-cookie);
+        finger += sizeof(key->I);
+        nonce = finger;
+        finger += NONCE_LENGTH;
 
-	cipherlength = cookielen - AD_LENGTH;
-	plainlength = NTS_MAX_COOKIELEN;
+        // require(AD_LENGTH==finger-cookie);
 
-	nts_lock_cookielock();
+        cipherlength = cookielen - AD_LENGTH;
+        plainlength = NTS_MAX_COOKIELEN;
 
-	ok = AES_SIV_Decrypt(cookie_ctx,
-			     plaintext, &plainlength,
-			     key->K, K_length,
-			     nonce, NONCE_LENGTH,
-			     finger, cipherlength,
-			     cookie, AD_LENGTH);
+        nts_lock_cookielock();
 
-	nts_unlock_cookielock();
+        ok = AES_SIV_Decrypt(cookie_ctx,
+                             plaintext, &plainlength,
+                             key->K, K_length,
+                             nonce, NONCE_LENGTH,
+                             finger, cipherlength,
+                             cookie, AD_LENGTH);
 
-	if (!ok) {
-		nts_cnt.cookie_decode_error++;
-		return false;
-	}
+        nts_unlock_cookielock();
 
-	*keylen = (plainlength-AEAD_LENGTH)/2;
-	finger = plaintext;
-	memcpy(&temp, finger, AEAD_LENGTH);
-	*aead = temp;
-	finger += AEAD_LENGTH;
-	memcpy(c2s, finger, *keylen);
-	finger += *keylen;
-	memcpy(s2c, finger, *keylen);
-	finger += *keylen;
+        if (!ok) {
+                nts_cnt.cookie_decode_error++;
+                return false;
+        }
 
-	return true;
+        *keylen = (plainlength-AEAD_LENGTH)/2;
+        finger = plaintext;
+        memcpy(&temp, finger, AEAD_LENGTH);
+        *aead = temp;
+        finger += AEAD_LENGTH;
+        memcpy(c2s, finger, *keylen);
+        finger += *keylen;
+        memcpy(s2c, finger, *keylen);
+        finger += *keylen;
+
+        return true;
 }
 
 void nts_lock_cookielock(void) {
-	int err = pthread_mutex_lock(&cookie_lock);
-	if (0 != err) {
-		msyslog(LOG_ERR, "ERR: Can't lock cookie_lock: %d", err);
-		exit(2);
-	}
+        int err = pthread_mutex_lock(&cookie_lock);
+        if (0 != err) {
+                msyslog(LOG_ERR, "ERR: Can't lock cookie_lock: %d", err);
+                exit(2);
+        }
 }
 
 void nts_unlock_cookielock(void) {
-	int err = pthread_mutex_unlock(&cookie_lock);
-	if (0 != err) {
-		msyslog(LOG_ERR, "ERR: Can't unlock cookie_lock: %d", err);
-		exit(2);
-	}
+        int err = pthread_mutex_unlock(&cookie_lock);
+        if (0 != err) {
+                msyslog(LOG_ERR, "ERR: Can't unlock cookie_lock: %d", err);
+                exit(2);
+        }
 }
 
-/* end */
+// end


=====================================
tests/ntpd/nts.c
=====================================
@@ -15,405 +15,405 @@ TEST_SETUP(nts) {}
 TEST_TEAR_DOWN(nts) {}
 
 TEST(nts, nts_translate_version) {
-	TEST_ASSERT_EQUAL_INT32(0, nts_translate_version(NULL));
-	TEST_ASSERT_EQUAL_INT32(TLS1_3_VERSION, nts_translate_version("TLS1.3"));
-	TEST_ASSERT_EQUAL_INT32(-1, nts_translate_version("blah"));
+        TEST_ASSERT_EQUAL_INT32(0, nts_translate_version(NULL));
+        TEST_ASSERT_EQUAL_INT32(TLS1_3_VERSION, nts_translate_version("TLS1.3"));
+        TEST_ASSERT_EQUAL_INT32(-1, nts_translate_version("blah"));
 }
 
 TEST(nts, nts_string_to_aead) {
-	TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_256,
-				nts_string_to_aead("AES_SIV_CMAC_256"));
-	TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_384,
-				nts_string_to_aead("AES_SIV_CMAC_384"));
-	TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_512,
-				nts_string_to_aead("AES_SIV_CMAC_512"));
-	TEST_ASSERT_EQUAL_INT16(NO_AEAD, nts_string_to_aead("blah"));
+        TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_256,
+                                nts_string_to_aead("AES_SIV_CMAC_256"));
+        TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_384,
+                                nts_string_to_aead("AES_SIV_CMAC_384"));
+        TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_512,
+                                nts_string_to_aead("AES_SIV_CMAC_512"));
+        TEST_ASSERT_EQUAL_INT16(NO_AEAD, nts_string_to_aead("blah"));
 }
 
 TEST(nts, nts_get_key_length) {
-	TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_256_KEYLEN,
-				nts_get_key_length(AEAD_AES_SIV_CMAC_256));
-	TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_384_KEYLEN,
-				nts_get_key_length(AEAD_AES_SIV_CMAC_384));
-	TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_512_KEYLEN,
-				nts_get_key_length(AEAD_AES_SIV_CMAC_512));
-	TEST_ASSERT_EQUAL_INT32(0, nts_get_key_length(-23));
+        TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_256_KEYLEN,
+                                nts_get_key_length(AEAD_AES_SIV_CMAC_256));
+        TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_384_KEYLEN,
+                                nts_get_key_length(AEAD_AES_SIV_CMAC_384));
+        TEST_ASSERT_EQUAL_INT32(AEAD_AES_SIV_CMAC_512_KEYLEN,
+                                nts_get_key_length(AEAD_AES_SIV_CMAC_512));
+        TEST_ASSERT_EQUAL_INT32(0, nts_get_key_length(-23));
 }
 
 TEST(nts, ke_append_record_null) {
-	/* Setup */
-	uint8_t buf[128];
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 128;
-	/* Run test */
-	ke_append_record_null(&cursor, 0xFA7E);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0x7E, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[3]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(124, cursor.left);
+        // Setup
+        uint8_t buf[128];
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 128;
+        // Run test
+        ke_append_record_null(&cursor, 0xFA7E);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0x7E, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[3]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(124, cursor.left);
 }
 
 TEST(nts, ke_append_record_uint16) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x02, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0x12, buf[4]);
-	TEST_ASSERT_EQUAL_UINT8(0x34, buf[5]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(10, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x02, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0x12, buf[4]);
+        TEST_ASSERT_EQUAL_UINT8(0x34, buf[5]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(10, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, ke_append_record_bytes) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	uint8_t data[6] = {0, 1, 2, 3, 4, 5};
-	/* Run test */
-	ke_append_record_bytes(&cursor, 0xCAFE, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x06, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_EQUAL_UINT8(1, buf[5]);
-	TEST_ASSERT_EQUAL_UINT8(2, buf[6]);
-	TEST_ASSERT_EQUAL_UINT8(3, buf[7]);
-	TEST_ASSERT_EQUAL_UINT8(4, buf[8]);
-	TEST_ASSERT_EQUAL_UINT8(5, buf[9]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
-	TEST_ASSERT_EQUAL_INT(6, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	ke_append_record_bytes(&cursor, 0xCAFE, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[10]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        uint8_t data[6] = {0, 1, 2, 3, 4, 5};
+        // Run test
+        ke_append_record_bytes(&cursor, 0xCAFE, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x06, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_EQUAL_UINT8(1, buf[5]);
+        TEST_ASSERT_EQUAL_UINT8(2, buf[6]);
+        TEST_ASSERT_EQUAL_UINT8(3, buf[7]);
+        TEST_ASSERT_EQUAL_UINT8(4, buf[8]);
+        TEST_ASSERT_EQUAL_UINT8(5, buf[9]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
+        TEST_ASSERT_EQUAL_INT(6, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        ke_append_record_bytes(&cursor, 0xCAFE, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[10]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, ex_append_record_null) {
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	ex_append_record_null(&cursor, 0xFADE);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(4, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(12, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        ex_append_record_null(&cursor, 0xFADE);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(4, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(12, cursor.left);
 }
 
 TEST(nts, ex_append_record_uint16) {
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	ex_append_record_uint16(&cursor, 0xFADE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x06, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0x12, buf[4]);
-	TEST_ASSERT_EQUAL_UINT8(0x34, buf[5]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(10, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        ex_append_record_uint16(&cursor, 0xFADE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x06, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0x12, buf[4]);
+        TEST_ASSERT_EQUAL_UINT8(0x34, buf[5]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(10, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        ke_append_record_uint16(&cursor, 0xCAFE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, ex_append_record_bytes) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	uint8_t data[6] = {0, 1, 2, 3, 4, 5};
-	/* Run test */
-	ex_append_record_bytes(&cursor, 0xCAFE, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x0A, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_EQUAL_UINT8(1, buf[5]);
-	TEST_ASSERT_EQUAL_UINT8(2, buf[6]);
-	TEST_ASSERT_EQUAL_UINT8(3, buf[7]);
-	TEST_ASSERT_EQUAL_UINT8(4, buf[8]);
-	TEST_ASSERT_EQUAL_UINT8(5, buf[9]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
-	TEST_ASSERT_EQUAL_INT(6, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	ex_append_record_bytes(&cursor, 0xCAFE, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[10]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        uint8_t data[6] = {0, 1, 2, 3, 4, 5};
+        // Run test
+        ex_append_record_bytes(&cursor, 0xCAFE, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xCA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xFE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x00, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x0A, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_EQUAL_UINT8(1, buf[5]);
+        TEST_ASSERT_EQUAL_UINT8(2, buf[6]);
+        TEST_ASSERT_EQUAL_UINT8(3, buf[7]);
+        TEST_ASSERT_EQUAL_UINT8(4, buf[8]);
+        TEST_ASSERT_EQUAL_UINT8(5, buf[9]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
+        TEST_ASSERT_EQUAL_INT(6, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        ex_append_record_bytes(&cursor, 0xCAFE, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[10]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[10], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, ex_append_header) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	ex_append_header(&cursor, 0xFADE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x12, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x38, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(12, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	ex_append_header(&cursor, 0xFEED, 0xABCD);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        ex_append_header(&cursor, 0xFADE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x12, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x38, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(12, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        ex_append_header(&cursor, 0xFEED, 0xABCD);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, append_header) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	append_header(&cursor, 0xFADE, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(0x12, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(0x34, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(12, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	append_header(&cursor, 0xFEED, 0xABCD);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        append_header(&cursor, 0xFADE, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFA, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xDE, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(0x12, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(0x34, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(12, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        append_header(&cursor, 0xFEED, 0xABCD);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[4]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, append_uint16) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	/* Run test */
-	append_uint16(&cursor, 0x1234);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0x12, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(0x34, buf[1]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
-	TEST_ASSERT_EQUAL_INT(14, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	append_uint16(&cursor, 0x5678);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        // Run test
+        append_uint16(&cursor, 0x1234);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0x12, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(0x34, buf[1]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
+        TEST_ASSERT_EQUAL_INT(14, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        append_uint16(&cursor, 0x5678);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[2]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, append_bytes) {
-	/* Test change */
-	/* Setup */
-	uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	uint8_t data[6] = {0, 1, 2, 3, 4, 5};
-	/* Run test */
-	append_bytes(&cursor, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[0]);
-	TEST_ASSERT_EQUAL_UINT8(1, buf[1]);
-	TEST_ASSERT_EQUAL_UINT8(2, buf[2]);
-	TEST_ASSERT_EQUAL_UINT8(3, buf[3]);
-	TEST_ASSERT_EQUAL_UINT8(4, buf[4]);
-	TEST_ASSERT_EQUAL_UINT8(5, buf[5]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(10, cursor.left);
-	/* Test no change */
-	/* Setup */
-	cursor.left = 0;
-	/* Run test */
-	append_bytes(&cursor, data, 6);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
-	TEST_ASSERT_EQUAL_INT(0, cursor.left);
+        // Test change
+        // Setup
+        uint8_t buf[16] = {0, 0, 0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        uint8_t data[6] = {0, 1, 2, 3, 4, 5};
+        // Run test
+        append_bytes(&cursor, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[0]);
+        TEST_ASSERT_EQUAL_UINT8(1, buf[1]);
+        TEST_ASSERT_EQUAL_UINT8(2, buf[2]);
+        TEST_ASSERT_EQUAL_UINT8(3, buf[3]);
+        TEST_ASSERT_EQUAL_UINT8(4, buf[4]);
+        TEST_ASSERT_EQUAL_UINT8(5, buf[5]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(10, cursor.left);
+        // Test no change
+        // Setup
+        cursor.left = 0;
+        // Run test
+        append_bytes(&cursor, data, 6);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0, buf[6]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[6], cursor.next);
+        TEST_ASSERT_EQUAL_INT(0, cursor.left);
 }
 
 TEST(nts, ke_next_record) {
-	/* Setup */
-	uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	int length;
-	uint16_t type;
-	/* Run test */
-	type = ke_next_record(&cursor, &length);
-	/* Check */
-	TEST_ASSERT_EQUAL_INT(4, length);
-	TEST_ASSERT_EQUAL_INT(0xFACE, type);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(12, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        int length;
+        uint16_t type;
+        // Run test
+        type = ke_next_record(&cursor, &length);
+        // Check
+        TEST_ASSERT_EQUAL_INT(4, length);
+        TEST_ASSERT_EQUAL_INT(0xFACE, type);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(12, cursor.left);
 }
 
 TEST(nts, ex_next_record) {
-	/* Setup */
-	uint8_t buf[16] = {0xFA, 0xCE, 0, 8, 0xFF, 0xEE, 0xDD, 0xCC,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	int length;
-	uint16_t type;
-	/* Run test */
-	type = ex_next_record(&cursor, &length);
-	/* Check */
-	TEST_ASSERT_EQUAL_INT(4, length);
-	TEST_ASSERT_EQUAL_INT(0xFACE, type);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
-	TEST_ASSERT_EQUAL_INT(12, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0xFA, 0xCE, 0, 8, 0xFF, 0xEE, 0xDD, 0xCC,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        int length;
+        uint16_t type;
+        // Run test
+        type = ex_next_record(&cursor, &length);
+        // Check
+        TEST_ASSERT_EQUAL_INT(4, length);
+        TEST_ASSERT_EQUAL_INT(0xFACE, type);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[4], cursor.next);
+        TEST_ASSERT_EQUAL_INT(12, cursor.left);
 }
 
 TEST(nts, next_uint16) {
-	/* Setup */
-	uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	uint16_t data;
-	/* Run test */
-	data = next_uint16(&cursor);
-	/* Check */
-	TEST_ASSERT_EQUAL_UINT8(0xFACE, data);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
-	TEST_ASSERT_EQUAL_INT(14, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        uint16_t data;
+        // Run test
+        data = next_uint16(&cursor);
+        // Check
+        TEST_ASSERT_EQUAL_UINT8(0xFACE, data);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[2], cursor.next);
+        TEST_ASSERT_EQUAL_INT(14, cursor.left);
 }
 
 TEST(nts, next_bytes) {
-	/* Setup */
-	uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
-		0, 0, 0, 0, 0, 0, 0, 0};
-	BufCtl cursor;
-	cursor.next = buf;
-	cursor.left = 16;
-	uint8_t data[8];
-	uint16_t length;
-	/* Run test */
-	length = next_bytes(&cursor, data, 8);
-	/* Check */
-	TEST_ASSERT_EQUAL_INT(8, length);
-	TEST_ASSERT_EQUAL_UINT8(0xFA, data[0]);
-	TEST_ASSERT_EQUAL_UINT8(0xCE, data[1]);
-	TEST_ASSERT_EQUAL_UINT8(0, data[2]);
-	TEST_ASSERT_EQUAL_UINT8(4, data[3]);
-	TEST_ASSERT_EQUAL_UINT8(0xFF, data[4]);
-	TEST_ASSERT_EQUAL_UINT8(0xEE, data[5]);
-	TEST_ASSERT_EQUAL_UINT8(0xDD, data[6]);
-	TEST_ASSERT_EQUAL_UINT8(0xCC, data[7]);
-	TEST_ASSERT_POINTERS_EQUAL(&buf[8], cursor.next);
-	TEST_ASSERT_EQUAL_INT(8, cursor.left);
+        // Setup
+        uint8_t buf[16] = {0xFA, 0xCE, 0, 4, 0xFF, 0xEE, 0xDD, 0xCC,
+                0, 0, 0, 0, 0, 0, 0, 0};
+        BufCtl cursor;
+        cursor.next = buf;
+        cursor.left = 16;
+        uint8_t data[8];
+        uint16_t length;
+        // Run test
+        length = next_bytes(&cursor, data, 8);
+        // Check
+        TEST_ASSERT_EQUAL_INT(8, length);
+        TEST_ASSERT_EQUAL_UINT8(0xFA, data[0]);
+        TEST_ASSERT_EQUAL_UINT8(0xCE, data[1]);
+        TEST_ASSERT_EQUAL_UINT8(0, data[2]);
+        TEST_ASSERT_EQUAL_UINT8(4, data[3]);
+        TEST_ASSERT_EQUAL_UINT8(0xFF, data[4]);
+        TEST_ASSERT_EQUAL_UINT8(0xEE, data[5]);
+        TEST_ASSERT_EQUAL_UINT8(0xDD, data[6]);
+        TEST_ASSERT_EQUAL_UINT8(0xCC, data[7]);
+        TEST_ASSERT_POINTERS_EQUAL(&buf[8], cursor.next);
+        TEST_ASSERT_EQUAL_INT(8, cursor.left);
 }
 
 TEST_GROUP_RUNNER(nts) {
-	RUN_TEST_CASE(nts, nts_translate_version);
-	RUN_TEST_CASE(nts, nts_string_to_aead);
-	RUN_TEST_CASE(nts, nts_get_key_length);
-	RUN_TEST_CASE(nts, ke_append_record_null);
-	RUN_TEST_CASE(nts, ke_append_record_uint16);
-	RUN_TEST_CASE(nts, ke_append_record_bytes);
-	RUN_TEST_CASE(nts, ex_append_record_null);
-	RUN_TEST_CASE(nts, ex_append_record_uint16);
-	RUN_TEST_CASE(nts, ex_append_record_bytes);
-	RUN_TEST_CASE(nts, ex_append_header);
-	RUN_TEST_CASE(nts, append_header);
-	RUN_TEST_CASE(nts, append_uint16);
-	RUN_TEST_CASE(nts, append_bytes);
-	RUN_TEST_CASE(nts, ke_next_record);
-	RUN_TEST_CASE(nts, ex_next_record);
-	RUN_TEST_CASE(nts, next_uint16);
-	RUN_TEST_CASE(nts, next_bytes);
+        RUN_TEST_CASE(nts, nts_translate_version);
+        RUN_TEST_CASE(nts, nts_string_to_aead);
+        RUN_TEST_CASE(nts, nts_get_key_length);
+        RUN_TEST_CASE(nts, ke_append_record_null);
+        RUN_TEST_CASE(nts, ke_append_record_uint16);
+        RUN_TEST_CASE(nts, ke_append_record_bytes);
+        RUN_TEST_CASE(nts, ex_append_record_null);
+        RUN_TEST_CASE(nts, ex_append_record_uint16);
+        RUN_TEST_CASE(nts, ex_append_record_bytes);
+        RUN_TEST_CASE(nts, ex_append_header);
+        RUN_TEST_CASE(nts, append_header);
+        RUN_TEST_CASE(nts, append_uint16);
+        RUN_TEST_CASE(nts, append_bytes);
+        RUN_TEST_CASE(nts, ke_next_record);
+        RUN_TEST_CASE(nts, ex_next_record);
+        RUN_TEST_CASE(nts, next_uint16);
+        RUN_TEST_CASE(nts, next_bytes);
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/2d5d803d127022e1e209a85a622c107ffa4f90c2...f2a4febf06625afb249e3f018035d777dad0b02b

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/2d5d803d127022e1e209a85a622c107ffa4f90c2...f2a4febf06625afb249e3f018035d777dad0b02b
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20260806/87665cf4/attachment-0001.htm>


More information about the vc mailing list