Minor cleanup

This commit is contained in:
Ken MacKay
2015-09-09 18:26:25 -07:00
parent 69744ae539
commit f58c04fdec
4 changed files with 13 additions and 7 deletions
+1 -1
View File
@@ -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 */
View File
+2 -5
View File
@@ -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 @@ int uECC_generate_random_int(uECC_word_t *random, uECC_Curve curve) {
}
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;
}
}
+10 -1
View File
@@ -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_n(uECC_Curve curve);
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 @@ void uECC_point_mult(uECC_word_t *result,
/* 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