[Git][NTPsec/ntpsec][master] Use stdint, not Linux-local types. Reindent.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Feb 6 02:42:00 UTC 2019


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
c8ed48d5 by Eric S. Raymond at 2019-02-06T02:41:12Z
Use stdint, not Linux-local types. Reindent.

- - - - -


3 changed files:

- include/nts_lib.h
- ntpd/nts_lib.c
- tests/ntpd/nts_lib.c


Changes:

=====================================
include/nts_lib.h
=====================================
@@ -1,7 +1,7 @@
 #ifndef GUARD_NTS_LIB_H
 #define GUARD_NTS_LIB_H
 
-#include <linux/types.h>
+#include <stdint.h>
 #include <openssl/evp.h>
 #include <stdbool.h>
 
@@ -14,32 +14,32 @@ typedef struct {
   char *cookie;
   void *iv;
   void *bit; // pointer for mempcpy, upf
-  __u8 addr_peer[16];
+  uint8_t addr_peer[16];
 
   int tally;
 
-  __u16 size_iv;
-  __u16 size_key_csc;
-  __u16 size_nonce;
-  __u16 size_ciphertext;
-  __u16 size_plaintext;
-  __u16 nts_algo;
-  __u16 cookie_key_id;
-  __u16 recipe;
-  __u16 countdown;
-  __u16 now; // network order word
+  uint16_t size_iv;
+  uint16_t size_key_csc;
+  uint16_t size_nonce;
+  uint16_t size_ciphertext;
+  uint16_t size_plaintext;
+  uint16_t nts_algo;
+  uint16_t cookie_key_id;
+  uint16_t recipe;
+  uint16_t countdown;
+  uint16_t now; // network order word
 } cookie_bits;
 
 typedef struct {
-  __u8 *next;
-  __u8 *record;
-  __u8 *body;
-  __u8 *bit; // pointer for mempcpy, upf
-
-  __u16 body_length;
-  __u16 record_type;
-  __u16 record_length;
-  __u16 now; // network order word
+  uint8_t *next;
+  uint8_t *record;
+  uint8_t *body;
+  uint8_t *bit; // pointer for mempcpy, upf
+
+  uint16_t body_length;
+  uint16_t record_type;
+  uint16_t record_length;
+  uint16_t now; // network order word
   bool critical;
 } record_bits;
 
@@ -97,7 +97,7 @@ enum aead_ciphers {
   AEAD_CHACHA20_POLY1305 = 29
 };
 
-extern __u8 *upf(void *src, void *dest, size_t n);
+extern uint8_t *upf(void *src, void *dest, size_t n);
 
 extern int nts_record_form(record_bits *in);
 extern int nts_record_parse(record_bits *in);
@@ -107,4 +107,4 @@ extern int nts_cookie_clean(cookie_bits *a);
 extern int nts_cookie_plaintext_parse(cookie_bits *out);
 extern int nts_cookie_plaintext_form(cookie_bits *in);
 
-#endif // GUARD_NTS_LIB_H
\ No newline at end of file
+#endif // GUARD_NTS_LIB_H


=====================================
ntpd/nts_lib.c
=====================================
@@ -8,9 +8,9 @@
 #include <string.h>
 
 // a binary unpack function it should sort of reverse mempcpy
-__u8 *upf(void *src, void *dest, size_t n) {
-  (void)memcpy(dest, src, n);
-  return (__u8 *)src + n;
+uint8_t *upf(void *src, void *dest, size_t n) {
+	(void)memcpy(dest, src, n);
+	return (uint8_t *)src + n;
 }
 
 /* parse an NTS record to retrieve the body, body_length and record_type
@@ -22,23 +22,23 @@ __u8 *upf(void *src, void *dest, size_t n) {
  * returns 0 on success
  */
 int nts_record_parse(record_bits *in) {
-  in->bit = upf(in->record, &in->now, sizeof(__u16));
+	in->bit = upf(in->record, &in->now, sizeof(uint16_t));
 
-  if (0x80 & in->record[0]) {
-     in->critical = true;
-     in->now &= htons(~0x8000);
-  }
-  in->record_type = ntohs(in->now);
+	if (0x80 & in->record[0]) {
+		in->critical = true;
+		in->now &= htons(~0x8000);
+	}
+	in->record_type = ntohs(in->now);
 
-  in->bit = upf(in->bit, &in->now, sizeof(__u16));
-  in->body_length = ntohs(in->now);
-  if (0 != in->body_length) {
-    in->body = in->bit;
-    in->bit += in->body_length;
-  } else {
-    in->body = NULL;
-  }
-  return 0;
+	in->bit = upf(in->bit, &in->now, sizeof(uint16_t));
+	in->body_length = ntohs(in->now);
+	if (0 != in->body_length) {
+		in->body = in->bit;
+		in->bit += in->body_length;
+	} else {
+		in->body = NULL;
+	}
+	return 0;
 }
 
 /* form an NTS record
@@ -52,34 +52,34 @@ int nts_record_parse(record_bits *in) {
  * returns 1 on memory allcation failure;
  */
 int nts_record_form(record_bits *in) {
-  in->record_length = (4 + in->body_length);
-  in->record = malloc(in->record_length);
-  if (NULL == in->record) {
-    return 1;
-  }
-  in->now = htons(in->record_type);
-  if (in->critical) {
-    in->now |= htons(0x8000);
-  }
-  in->bit = mempcpy(in->record, &in->now, sizeof(__u16));
-  in->now = htons(in->body_length);
-  in->bit = mempcpy(in->bit, &in->now, sizeof(__u16));
-  if (0 < in->body_length) {
-    in->bit = mempcpy(in->bit, in->body, in->body_length);
-  }
-  return 0;
+	in->record_length = (4 + in->body_length);
+	in->record = malloc(in->record_length);
+	if (NULL == in->record) {
+		return 1;
+	}
+	in->now = htons(in->record_type);
+	if (in->critical) {
+		in->now |= htons(0x8000);
+	}
+	in->bit = mempcpy(in->record, &in->now, sizeof(uint16_t));
+	in->now = htons(in->body_length);
+	in->bit = mempcpy(in->bit, &in->now, sizeof(uint16_t));
+	if (0 < in->body_length) {
+		in->bit = mempcpy(in->bit, in->body, in->body_length);
+	}
+	return 0;
 }
 
 // Allocate & initialize structure & fields for NTS cookie generation/parsing
 int nts_cookie_prep(cookie_bits *input) {
-  UNUSED_ARG(input);
-  return 0;
+	UNUSED_ARG(input);
+	return 0;
 }
 
 // Free (most) storage used by NTS cookie generation/parsing routines
 int nts_cookie_clean(cookie_bits *a) {
-  UNUSED_ARG(a);
-  return 0;
+	UNUSED_ARG(a);
+	return 0;
 }
 
 /* Parse the plaintext to retrieve the AEAD algorithm to use when processing,
@@ -94,8 +94,8 @@ int nts_cookie_clean(cookie_bits *a) {
  * returns number of bytes remaining in the plaintext (should be 0)
  */
 int nts_cookie_plaintext_parse(cookie_bits *out) {
-  UNUSED_ARG(out);
-  return 0;
+	UNUSED_ARG(out);
+	return 0;
 }
 
 /* Form the cookie plaintext from the AEAD algorithm number, the c2s key and
@@ -109,6 +109,6 @@ int nts_cookie_plaintext_parse(cookie_bits *out) {
  * returns 0 on success
  */
 int nts_cookie_plaintext_form(cookie_bits *in) {
-  UNUSED_ARG(in);
-  return 0;
+	UNUSED_ARG(in);
+	return 0;
 }


=====================================
tests/ntpd/nts_lib.c
=====================================
@@ -13,259 +13,260 @@ TEST_SETUP(nts_lib) {}
 TEST_TEAR_DOWN(nts_lib) {}
 
 TEST(nts_lib, record_decode_null) {
-  __u8 expected[4] = {0x80, 0, 0, 0};
-  record_bits *record;
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->record = malloc(4);
-  if (NULL == record->record) {
-    TEST_FAIL_MESSAGE("record value malloc");
-    return;
-  }
-  memcpy(record->record, expected, 4);
-  record->record_length = 4;
-
-  nts_record_parse(record);
-
-  TEST_ASSERT_TRUE(record->critical);
-  TEST_ASSERT_EQUAL_INT16(0, record->record_type);
-  TEST_ASSERT_EQUAL_INT16(0, record->body_length);
-  TEST_ASSERT_NULL(record->body);
-  record->body = NULL;
-
-  free(record->record);
-  free(record);
+	uint8_t expected[4] = {0x80, 0, 0, 0};
+	record_bits *record;
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->record = malloc(4);
+	if (NULL == record->record) {
+		TEST_FAIL_MESSAGE("record value malloc");
+		return;
+	}
+	memcpy(record->record, expected, 4);
+	record->record_length = 4;
+
+	nts_record_parse(record);
+
+	TEST_ASSERT_TRUE(record->critical);
+	TEST_ASSERT_EQUAL_INT16(0, record->record_type);
+	TEST_ASSERT_EQUAL_INT16(0, record->body_length);
+	TEST_ASSERT_NULL(record->body);
+	record->body = NULL;
+
+	free(record->record);
+	free(record);
 }
 
 TEST(nts_lib, record_decode_u16) {
-  __u8 expected[6] = {0, port_negotiation, 0, 2, 0, 123};
-  record_bits *record;
-  int lints[1];
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->record = malloc(6);
-  if (NULL == record->record) {
-    TEST_FAIL_MESSAGE("record value malloc");
-    return;
-  }
-  memcpy(record->record, expected, 6);
-  record->record_length = 6;
-
-  nts_record_parse(record);
-  if (record->body_length & 1) {
-    TEST_FAIL_MESSAGE("odd byte out");
-  }
-  memcpy(lints, record->body, 2);
-
-  TEST_ASSERT_FALSE(record->critical);
-  TEST_ASSERT_EQUAL_INT16(port_negotiation, record->record_type);
-  TEST_ASSERT_EQUAL_INT16(2, record->body_length);
-  TEST_ASSERT_NOT_NULL(record->body);
-
-  TEST_ASSERT_EQUAL_INT16(123, ntohs(lints[0]));
-  record->body = NULL;
-
-  free(record->record);
-  free(record);
+	uint8_t expected[6] = {0, port_negotiation, 0, 2, 0, 123};
+	record_bits *record;
+	int lints[1];
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->record = malloc(6);
+	if (NULL == record->record) {
+		TEST_FAIL_MESSAGE("record value malloc");
+		return;
+	}
+	memcpy(record->record, expected, 6);
+	record->record_length = 6;
+
+	nts_record_parse(record);
+	if (record->body_length & 1) {
+		TEST_FAIL_MESSAGE("odd byte out");
+	}
+	memcpy(lints, record->body, 2);
+
+	TEST_ASSERT_FALSE(record->critical);
+	TEST_ASSERT_EQUAL_INT16(port_negotiation, record->record_type);
+	TEST_ASSERT_EQUAL_INT16(2, record->body_length);
+	TEST_ASSERT_NOT_NULL(record->body);
+
+	TEST_ASSERT_EQUAL_INT16(123, ntohs(lints[0]));
+	record->body = NULL;
+
+	free(record->record);
+	free(record);
 }
 
 TEST(nts_lib, record_decode_u16s) {
-  __u8 expected[8] = {0, algorithm_negotiation, 0, 4,
-                      0, AEAD_AES_SIV_CMAC_512, 0, AEAD_CHACHA20_POLY1305};
-  record_bits *record;
-  int lints[2];
-  void *there;
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->record = malloc(8);
-  if (NULL == record->record) {
-    TEST_FAIL_MESSAGE("record value malloc");
-    return;
-  }
-  memcpy(record->record, expected, 8);
-  record->record_length = 8;
-
-  nts_record_parse(record);
-  there = record->body;
-  if (record->body_length & 1) {
-    TEST_FAIL_MESSAGE("odd byte out");
-  }
-  for (int count = 0; (count * 2) < record->body_length; count++) {
-    there = upf(there, &lints[count], 2);
-  }
-
-  TEST_ASSERT_FALSE(record->critical);
-  TEST_ASSERT_EQUAL_INT16(algorithm_negotiation, record->record_type);
-  TEST_ASSERT_EQUAL_INT16(4, record->body_length);
-  TEST_ASSERT_NOT_NULL(record->body);
-
-  TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_512, ntohs(lints[0]));
-  TEST_ASSERT_EQUAL_INT16(AEAD_CHACHA20_POLY1305, ntohs(lints[1]));
-  record->body = NULL;
-
-  free(record->record);
-  free(record);
+	uint8_t expected[8] = {0, algorithm_negotiation, 0, 4,
+			       0, AEAD_AES_SIV_CMAC_512, 0, AEAD_CHACHA20_POLY1305};
+	record_bits *record;
+	int lints[2];
+	void *there;
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->record = malloc(8);
+	if (NULL == record->record) {
+		TEST_FAIL_MESSAGE("record value malloc");
+		return;
+	}
+	memcpy(record->record, expected, 8);
+	record->record_length = 8;
+
+	nts_record_parse(record);
+	there = record->body;
+	if (record->body_length & 1) {
+		TEST_FAIL_MESSAGE("odd byte out");
+	}
+	for (int count = 0; (count * 2) < record->body_length; count++) {
+		there = upf(there, &lints[count], 2);
+	}
+
+	TEST_ASSERT_FALSE(record->critical);
+	TEST_ASSERT_EQUAL_INT16(algorithm_negotiation, record->record_type);
+	TEST_ASSERT_EQUAL_INT16(4, record->body_length);
+	TEST_ASSERT_NOT_NULL(record->body);
+
+	TEST_ASSERT_EQUAL_INT16(AEAD_AES_SIV_CMAC_512, ntohs(lints[0]));
+	TEST_ASSERT_EQUAL_INT16(AEAD_CHACHA20_POLY1305, ntohs(lints[1]));
+	record->body = NULL;
+
+	free(record->record);
+	free(record);
 }
 
 TEST(nts_lib, record_decode_text) {
-  record_bits *record;
-  const char *expserv = "asus.internal.jamesb192.com";
-  __u8 expected[31] = {0,   server_negotiation,
-                       0,   27,
-                       'a', 's', 'u', 's', '.', 'i', 'n', 't', 'e',
-                       'r', 'n', 'a', 'l', '.', 'j', 'a', 'm', 'e',
-                       's', 'b', '1', '9', '2', '.', 'c', 'o', 'm'
-                      };
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->record = malloc(31);
-  if (NULL == record->record) {
-    TEST_FAIL_MESSAGE("record value malloc");
-    return;
-  }
-  memcpy(record->record, expected, 31);
-  record->record_length = 31;
-
-  nts_record_parse(record);
-
-  TEST_ASSERT_FALSE(record->critical);
-  TEST_ASSERT_EQUAL_INT16(server_negotiation, record->record_type);
-  TEST_ASSERT_EQUAL_INT16(27, record->body_length);
-  TEST_ASSERT_NOT_NULL(record->body);
-
-  TEST_ASSERT_EQUAL_STRING_LEN(expserv, record->body, 27);
-  record->body = NULL;
-
-  free(record->record);
-  free(record);
+	record_bits *record;
+	const char *expserv = "asus.internal.jamesb192.com";
+	uint8_t expected[31] = {0,   server_negotiation,
+				0,   27,
+				'a', 's', 'u', 's', '.', 'i', 'n', 't', 'e',
+				'r', 'n', 'a', 'l', '.', 'j', 'a', 'm', 'e',
+				's', 'b', '1', '9', '2', '.', 'c', 'o', 'm'
+	};
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->record = malloc(31);
+	if (NULL == record->record) {
+		TEST_FAIL_MESSAGE("record value malloc");
+		return;
+	}
+	memcpy(record->record, expected, 31);
+	record->record_length = 31;
+
+	nts_record_parse(record);
+
+	TEST_ASSERT_FALSE(record->critical);
+	TEST_ASSERT_EQUAL_INT16(server_negotiation, record->record_type);
+	TEST_ASSERT_EQUAL_INT16(27, record->body_length);
+	TEST_ASSERT_NOT_NULL(record->body);
+
+	TEST_ASSERT_EQUAL_STRING_LEN(expserv, record->body, 27);
+	record->body = NULL;
+
+	free(record->record);
+	free(record);
 }
 
 TEST(nts_lib, record_encode_null) {
-  __u8 expected[4] = {0x80, end_of_message, 0, 0};
-  record_bits *record;
+	uint8_t expected[4] = {0x80, end_of_message, 0, 0};
+	record_bits *record;
 
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->critical = true;
-  record->body_length = 0;
-  record->record_type = end_of_message;
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->critical = true;
+	record->body_length = 0;
+	record->record_type = end_of_message;
 
-  nts_record_form(record);
+	nts_record_form(record);
 
-  TEST_ASSERT_EQUAL_UINT16(4, record->record_length);
-  TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 4);
+	TEST_ASSERT_EQUAL_UINT16(4, record->record_length);
+	TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 4);
 
-  free(record->body);
-  free(record);
+	free(record->body);
+	free(record);
 }
+
 TEST(nts_lib, record_encode_u16) {
-  __u8 expected[6] = {0, port_negotiation, 0, 2, 0, 123};
-  __u16 exp_port = htons(123);
-  record_bits *record;
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->critical = false;
-  record->body_length = 2;
-  record->record_type = port_negotiation;
-  record->body = malloc(2);
-  if (NULL == record->body) {
-    TEST_FAIL_MESSAGE("body malloc");
-    return;
-  }
-  memcpy(record->body, &exp_port, 2);
-
-  nts_record_form(record);
-
-  TEST_ASSERT_EQUAL_UINT16(6, record->record_length);
-  TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 6);
-
-  free(record->body);
-  free(record);
+	uint8_t expected[6] = {0, port_negotiation, 0, 2, 0, 123};
+	uint16_t exp_port = htons(123);
+	record_bits *record;
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->critical = false;
+	record->body_length = 2;
+	record->record_type = port_negotiation;
+	record->body = malloc(2);
+	if (NULL == record->body) {
+		TEST_FAIL_MESSAGE("body malloc");
+		return;
+	}
+	memcpy(record->body, &exp_port, 2);
+
+	nts_record_form(record);
+
+	TEST_ASSERT_EQUAL_UINT16(6, record->record_length);
+	TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 6);
+
+	free(record->body);
+	free(record);
 }
 
 TEST(nts_lib, record_encode_u16s) {
-  __u8 expected[8] = {0, algorithm_negotiation, 0, 4, 0, 2, 0, 4};
-  __u16 exp_algos[2] = {htons(2), htons(4)};
-  record_bits *record;
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->critical = false;
-  record->body_length = 4;
-  record->record_type = algorithm_negotiation;
-  record->body = malloc(4);
-  if (NULL == record->body) {
-    TEST_FAIL_MESSAGE("body malloc");
-    return;
-  }
-  memcpy(record->body, &exp_algos, 4);
-
-  nts_record_form(record);
-
-  TEST_ASSERT_EQUAL_UINT16(8, record->record_length);
-  TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 8);
-
-  free(record->body);
-  free(record);
+	uint8_t expected[8] = {0, algorithm_negotiation, 0, 4, 0, 2, 0, 4};
+	uint16_t exp_algos[2] = {htons(2), htons(4)};
+	record_bits *record;
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->critical = false;
+	record->body_length = 4;
+	record->record_type = algorithm_negotiation;
+	record->body = malloc(4);
+	if (NULL == record->body) {
+		TEST_FAIL_MESSAGE("body malloc");
+		return;
+	}
+	memcpy(record->body, &exp_algos, 4);
+
+	nts_record_form(record);
+
+	TEST_ASSERT_EQUAL_UINT16(8, record->record_length);
+	TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 8);
+
+	free(record->body);
+	free(record);
 }
 
 TEST(nts_lib, record_encode_text) {
-  const char *expserv = "asus.internal.jamesb192.com";
-  __u8 expected[31] = {  0,  server_negotiation,
-                         0,  27,
-                       'a', 's', 'u', 's', '.', 'i', 'n', 't', 'e',
-                       'r', 'n', 'a', 'l', '.', 'j', 'a', 'm', 'e',
-                       's', 'b', '1', '9', '2', '.', 'c', 'o', 'm'
-                      };
-  record_bits *record;
-
-  record = calloc(1, sizeof(record_bits));
-  if (NULL == record) {
-    TEST_FAIL_MESSAGE("record malloc");
-    return;
-  }
-  record->critical = false;
-  record->body_length = 27;
-  record->record_type = server_negotiation;
-  record->body = malloc(27);
-  if (NULL == record->body) {
-    TEST_FAIL_MESSAGE("body calloc");
-    return;
-  }
-  memcpy(record->body, expserv, 27);
-
-  nts_record_form(record);
-
-  TEST_ASSERT_EQUAL_UINT16(31, record->record_length);
-  TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 31);
-
-  free(record->body);
-  free(record);
+	const char *expserv = "asus.internal.jamesb192.com";
+	uint8_t expected[31] = {  0,  server_negotiation,
+				  0,  27,
+				  'a', 's', 'u', 's', '.', 'i', 'n', 't', 'e',
+				  'r', 'n', 'a', 'l', '.', 'j', 'a', 'm', 'e',
+				  's', 'b', '1', '9', '2', '.', 'c', 'o', 'm'
+	};
+	record_bits *record;
+
+	record = calloc(1, sizeof(record_bits));
+	if (NULL == record) {
+		TEST_FAIL_MESSAGE("record malloc");
+		return;
+	}
+	record->critical = false;
+	record->body_length = 27;
+	record->record_type = server_negotiation;
+	record->body = malloc(27);
+	if (NULL == record->body) {
+		TEST_FAIL_MESSAGE("body calloc");
+		return;
+	}
+	memcpy(record->body, expserv, 27);
+
+	nts_record_form(record);
+
+	TEST_ASSERT_EQUAL_UINT16(31, record->record_length);
+	TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, record->record, 31);
+
+	free(record->body);
+	free(record);
 }
 
 /*TEST(nts_lib, existance) {
@@ -281,13 +282,13 @@ TEST(nts_lib, record_encode_text) {
 TEST_GROUP_RUNNER(nts_lib) {
 //  RUN_TEST_CASE(nts_lib, existance);
 
-  RUN_TEST_CASE(nts_lib, record_decode_null);
-  RUN_TEST_CASE(nts_lib, record_decode_u16);
-  RUN_TEST_CASE(nts_lib, record_decode_u16s);
-  RUN_TEST_CASE(nts_lib, record_decode_text);
+	RUN_TEST_CASE(nts_lib, record_decode_null);
+	RUN_TEST_CASE(nts_lib, record_decode_u16);
+	RUN_TEST_CASE(nts_lib, record_decode_u16s);
+	RUN_TEST_CASE(nts_lib, record_decode_text);
 
-  RUN_TEST_CASE(nts_lib, record_encode_null);
-  RUN_TEST_CASE(nts_lib, record_encode_u16);
-  RUN_TEST_CASE(nts_lib, record_encode_u16s);
-  RUN_TEST_CASE(nts_lib, record_encode_text);
+	RUN_TEST_CASE(nts_lib, record_encode_null);
+	RUN_TEST_CASE(nts_lib, record_encode_u16);
+	RUN_TEST_CASE(nts_lib, record_encode_u16s);
+	RUN_TEST_CASE(nts_lib, record_encode_text);
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c8ed48d558eee79b57fc949ee4be6e0c6da3288f

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c8ed48d558eee79b57fc949ee4be6e0c6da3288f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190206/a988bbea/attachment-0001.html>


More information about the vc mailing list