adjusted declaration locations at kmackay's request; also removed uECC_FPTR_FIXUP mechanism (not needed in new version of SDCC?)

This commit is contained in:
Justin King-Lacroix
2015-06-10 17:56:01 +01:00
parent 359fc0afe3
commit 0a05258d5f
2 changed files with 4 additions and 10 deletions
+3 -3
View File
@@ -2215,10 +2215,10 @@ int uECC_sign(const uint8_t p_privateKey[uECC_BYTES], const uint8_t p_hash[uECC_
uECC_word_t *k2[2] = {l_tmp, s};
EccPoint p;
uECC_word_t l_tries = 0;
uECC_word_t l_carry;
do
{
uECC_word_t l_carry;
repeat:
if(!g_rng((uint8_t *)k, sizeof(k)) || (l_tries++ >= MAX_TRIES))
{
@@ -2251,7 +2251,7 @@ int uECC_sign(const uint8_t p_privateKey[uECC_BYTES], const uint8_t p_hash[uECC_
}
/* make sure that we don't leak timing information about k. See http://eprint.iacr.org/2011/232.pdf */
uECC_word_t l_carry = vli_add(l_tmp, k, curve_n);
l_carry = vli_add(l_tmp, k, curve_n);
vli_add(s, l_tmp, curve_n);
/* p = k * G */
@@ -2317,7 +2317,6 @@ int uECC_verify(const uint8_t p_publicKey[uECC_BYTES*2], const uint8_t p_hash[uE
uECC_word_t tx[uECC_WORDS];
uECC_word_t ty[uECC_WORDS];
uECC_word_t tz[uECC_WORDS];
uECC_word_t l_index;
const EccPoint *l_points[4];
const EccPoint *l_point;
@@ -2377,6 +2376,7 @@ int uECC_verify(const uint8_t p_publicKey[uECC_BYTES*2], const uint8_t p_hash[uE
for(i = l_numBits - 2; i >= 0; --i)
{
uECC_word_t l_index;
EccPoint_double_jacobian(rx, ry, z);
l_index = (!!vli_testBit(u1, i)) | ((!!vli_testBit(u2, i)) << 1);
+1 -7
View File
@@ -55,12 +55,6 @@ uECC_asm_fast - Use GCC inline assembly optimized for maximum speed. */
#define uECC_BYTES uECC_CONCAT(uECC_size_, uECC_CURVE)
#if(__SDCC_mcs51)
#define uECC_FPTR_FIXUP __reentrant
#else //SDCC_mcs51
#define uECC_FPTR_FIXUP
#endif //SDCC_mcs51
#ifdef __cplusplus
extern "C"
{
@@ -79,7 +73,7 @@ If you are building on another POSIX-compliant system that supports /dev/random
you can define uECC_POSIX to use the predefined RNG. For embedded platforms there is no predefined
RNG function; you must provide your own.
*/
typedef int (*uECC_RNG_Function)(uint8_t *p_dest, unsigned p_size) uECC_FPTR_FIXUP;
typedef int (*uECC_RNG_Function)(uint8_t *p_dest, unsigned p_size);
/* uECC_set_rng() function.
Set the function that will be used to generate random bytes. The RNG function should