[Git][NTPsec/ntpsec][master] include/nts.h: Remove tabs, Single line /* comments to //
Hal Murray (@hal.murray)
gitlab at mg.gitlab.com
Thu Aug 6 17:25:19 UTC 2026
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
d9279df1 by Gary E. Miller at 2026-08-06T10:22:00-07:00
include/nts.h: Remove tabs, Single line /* comments to //
- - - - -
1 changed file:
- include/nts.h
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
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/d9279df132a3030fdc40cffda8b431cf4a778570
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/d9279df132a3030fdc40cffda8b431cf4a778570
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/9721c30e/attachment-0001.htm>
More information about the vc
mailing list