Fixed some build issues.

This commit is contained in:
Ken MacKay
2014-04-01 18:59:13 -07:00
parent e82da6db49
commit 8157219275
2 changed files with 13 additions and 22 deletions
+12 -1
View File
@@ -31,7 +31,6 @@
#endif
#if (ECC_CURVE == secp160r1) && (ECC_WORD_SIZE == 8)
#pragma message ("Using a word size of 4 for secp160r1")
#undef ECC_WORD_SIZE
#define ECC_WORD_SIZE 4
#if (ECC_PLATFORM == ecc_x86_64)
@@ -1786,6 +1785,18 @@ static ecc_word_t vli_sub_n(ecc_word_t *p_result, ecc_word_t *p_left, ecc_word_t
return l_borrow;
}
#if asm_mult
static void muladd(ecc_word_t a, ecc_word_t b, ecc_word_t *r0, ecc_word_t *r1, ecc_word_t *r2)
{
ecc_dword_t p = (ecc_dword_t)a * b;
ecc_dword_t r01 = ((ecc_dword_t)(*r1) << ECC_WORD_BITS) | *r0;
r01 += p;
*r2 += (r01 < p);
*r1 = r01 >> ECC_WORD_BITS;
*r0 = (ecc_word_t)r01;
}
#endif
static void vli_mult_n(ecc_word_t *p_result, ecc_word_t *p_left, ecc_word_t *p_right)
{
ecc_word_t r0 = 0;
+1 -21
View File
@@ -2,18 +2,6 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
int randfd;
void getRandomBytes(void *p_dest, unsigned p_size)
{
if(read(randfd, p_dest, p_size) != (int)p_size)
{
printf("Failed to get random bytes.\n");
}
}
int main()
{
@@ -26,13 +14,6 @@ int main()
int i;
randfd = open("/dev/urandom", O_RDONLY);
if(randfd == -1)
{
printf("No access to urandom\n");
return -1;
}
printf("Testing 256 signatures\n");
for(i=0; i<256; ++i)
@@ -41,8 +22,7 @@ int main()
fflush(stdout);
ecc_make_key(l_public, l_private);
getRandomBytes((char *)l_hash, ECC_BYTES);
memcpy(l_hash, l_public, ECC_BYTES);
if(!ecdsa_sign(l_private, l_hash, l_sig))
{