Add tinycrypt 0.2.8

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/ext/tinycrypt/tests/include/test_ecc_utils.h b/ext/tinycrypt/tests/include/test_ecc_utils.h
index 97c183c..4e29054 100644
--- a/ext/tinycrypt/tests/include/test_ecc_utils.h
+++ b/ext/tinycrypt/tests/include/test_ecc_utils.h
@@ -1,7 +1,30 @@
 /*  test_ecc_utils.h - TinyCrypt interface to common functions for ECC tests */
 
+/* Copyright (c) 2014, Kenneth MacKay
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.*/
+
 /*
- *  Copyright (C) 2015 by Intel Corporation, All Rights Reserved.
+ *  Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
  *
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions are met:
@@ -35,48 +58,43 @@
 #ifndef __TEST_ECC_UTILS_H__
 #define __TEST_ECC_UTILS_H__
 
-#include <stdlib.h>
-#include <stdbool.h>
-#include <tinycrypt/constants.h>
-
-EccPoint keygen_vectors(char **d_vec,
-    char **qx_vec,
-    char **qy_vec,
-    int tests,
-    bool verbose);
-
-void getRandomBytes(void *p_dest, unsigned p_size);
-
-void string2host(uint32_t *native, const uint8_t *bytes, size_t len);
+#include <tinycrypt/ecc_dh.h>
+#include <tinycrypt/ecc.h>
+#include <test_utils.h>
 
 int hex2int (char hex);
 
-int hex2bin(
-    uint8_t *buf,
-    const size_t buflen,
-    const char *hex,
-    const size_t hexlen);
 
-void string2scalar(uint32_t * scalar, uint32_t num_word32, char *str);
+/*
+ * Convert hex string to byte string
+ * Return number of bytes written to buf, or 0 on error
+ */
+int hex2bin(uint8_t *buf, const size_t buflen, const char *hex,
+	    const size_t hexlen);
 
-void vli_print(uint32_t *p_vli, unsigned int p_size);
+/*
+ * Convert hex string to zero-padded nanoECC scalar
+ */
+void string2scalar(unsigned int * scalar, unsigned int num_word32, char *str);
 
-void print_ecc_scalar(
-    const char *label,
-    const uint32_t * p_vli,
-    uint32_t num_word32);
 
-void check_code(const int num,
-    const char *name,
-    const int expected,
-    const int computed,
-    const int verbose);
+void print_ecc_scalar(const char *label, const unsigned int * p_vli,
+		      unsigned int num_word32);
 
-void check_ecc_result(const int num, const char *name,
-    const uint32_t *expected,
-    const uint32_t *computed,
-    const uint32_t num_word32,
-    const bool verbose);
+int check_ecc_result(const int num, const char *name,
+		      const unsigned int *expected, 
+		      const unsigned int *computed,
+		      const unsigned int num_word32, const bool verbose);
 
-#endif
+/* Test ecc_make_keys, and also as keygen part of other tests */
+int keygen_vectors(char **d_vec, char **qx_vec, char **qy_vec, int tests, bool verbose);
+
+void vli_print_bytes(uint8_t *vli, unsigned int size);
+
+
+int check_code(const int num, const char *name, const int expected,
+		const int computed, const int verbose);
+
+
+#endif /* __TEST_ECC_UTILS_H__ */
 
diff --git a/ext/tinycrypt/tests/include/test_utils.h b/ext/tinycrypt/tests/include/test_utils.h
index 5f51511..055f91b 100644
--- a/ext/tinycrypt/tests/include/test_utils.h
+++ b/ext/tinycrypt/tests/include/test_utils.h
@@ -1,7 +1,7 @@
 /*  test_utils.h - TinyCrypt interface to common functions for tests */
 
 /*
- *  Copyright (C) 2015 by Intel Corporation, All Rights Reserved.
+ *  Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
  *
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions are met:
@@ -83,18 +83,19 @@
 			"PROJECT EXECUTION %s\n",               \
 			result == TC_PASS ? "SUCCESSFUL" : "FAILED");   \
 	} while (0)
+
 static inline void show_str(const char *label, const uint8_t *s, size_t len)
 {
-        uint32_t i;
+        unsigned int i;
 
         TC_PRINT("%s = ", label);
-        for (i = 0; i < (uint32_t) len; ++i) {
+        for (i = 0; i < (unsigned int) len; ++i) {
                 TC_PRINT("%02x", s[i]);
         }
         TC_PRINT("\n");
 }
 
-static inline void fatal(uint32_t testnum, const void *expected, size_t expectedlen,
+static inline void fatal(unsigned int testnum, const void *expected, size_t expectedlen,
            const void *computed, size_t computedlen)
 {
 
@@ -104,10 +105,10 @@
         TC_PRINT("\n");
 }
 
-static inline uint32_t check_result(uint32_t testnum, const void *expected, size_t expectedlen,
+static inline unsigned int check_result(unsigned int testnum, const void *expected, size_t expectedlen,
                    const void *computed, size_t computedlen)
 {
-	uint32_t result = TC_PASS;
+	unsigned int result = TC_PASS;
 
         if (expectedlen != computedlen) {
                 TC_ERROR("The length of the computed buffer (%zu)", computedlen);
@@ -121,4 +122,4 @@
         return result;
 }
 
-#endif
+#endif /* __TEST_UTILS_H__ */