Minor cleanup
diff --git a/platform-specific.inc b/platform-specific.inc index 3eb95cd..1bb595a 100644 --- a/platform-specific.inc +++ b/platform-specific.inc
@@ -3,7 +3,7 @@ #ifndef _UECC_PLATFORM_SPECIFIC_H_ #define _UECC_PLATFORM_SPECIFIC_H_ -#include "types.inc" +#include "types.h" #if (defined(_WIN32) || defined(_WIN64)) /* Windows */
diff --git a/types.inc b/types.h similarity index 100% rename from types.inc rename to types.h
diff --git a/uECC.c b/uECC.c index d34d0c5..a119738 100644 --- a/uECC.c +++ b/uECC.c
@@ -1,6 +1,7 @@ /* Copyright 2014, Kenneth MacKay. Licensed under the BSD 2-clause license. */ #include "uECC.h" +#include "uECC_vli.h" #ifndef uECC_RNG_MAX_TRIES #define uECC_RNG_MAX_TRIES 64 @@ -22,10 +23,6 @@ #define uECC_MAX_BYTES 32 #endif -#ifndef uECC_ENABLE_VLI_API - #define uECC_ENABLE_VLI_API 0 -#endif - #if uECC_ENABLE_VLI_API #define uECC_VLI_API #else @@ -1411,7 +1408,7 @@ } if (!uECC_vli_isZero(random, num_n_words) && - uECC_vli_cmp(curve->n, random, num_n_words) == 1) + uECC_vli_cmp(curve->n, random, num_n_words) == 1) { return 1; } }
diff --git a/uECC_vli.h b/uECC_vli.h index 475c7d3..e445888 100644 --- a/uECC_vli.h +++ b/uECC_vli.h
@@ -4,16 +4,21 @@ #define _UECC_VLI_H_ #include "uECC.h" -#include "types.inc" +#include "types.h" /* Functions for raw large-integer manipulation. These are only available if uECC.c is compiled with uECC_ENABLE_VLI_API defined to 1. */ +#ifndef uECC_ENABLE_VLI_API + #define uECC_ENABLE_VLI_API 0 +#endif #ifdef __cplusplus extern "C" { #endif +#if uECC_ENABLE_VLI_API + void uECC_vli_clear(uECC_word_t *vli, wordcount_t num_words); /* Constant-time comparison to zero - secure way to compare long integers */ @@ -135,6 +140,8 @@ const uECC_word_t *uECC_curve_G(uECC_Curve curve); const uECC_word_t *uECC_curve_b(uECC_Curve curve); +int uECC_valid_point(const uECC_word_t *point, uECC_Curve curve); + /* Multiplies a point by a scalar. Points are represented by the X coordinate followed by the Y coordinate in the same array, both coordinates are curve->num_words long. Note that scalar must be curve->num_n_words long (NOT curve->num_words). */ @@ -146,6 +153,8 @@ /* Generates a random integer r in the range 0 < r < curve->n */ int uECC_generate_random_int(uECC_word_t *random, uECC_Curve curve); +#endif /* uECC_ENABLE_VLI_API */ + #ifdef __cplusplus } /* end of extern "C" */ #endif