Link to home
Start Free TrialLog in
Avatar of Wathan
Wathan

asked on

Crypto using Libtom with ECDSA

Hi,
I am doing a project using the Libtom library to sign sections of a portable executable with ECDSA signature in C language.
I downloaded the doc of libtom but i don't understand anything about the functions and parameters. I just have to understand how to use the library.
Someone can help me to find tutorials and docs more easy to read.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of btan
btan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of btan
btan

Avatar of Wathan

ASKER

Hi,
In the ecc_test.c how does tom use yarrow_prng (line 223) without initialize it?
I copied his code from line 218 to 230 as is, trying to sign a hashed charstream but Visual Studio tell me that there is an error yarrow_prng undeclared identifier.
Below is my code:
#include<stdio.h>
#include<tomcrypt.h>

void main()
{
	unsigned long x;
	unsigned char buf[4][4096];
	int stat, stat2;
	ecc_key usera, userb, pubKey, privKey;

	for (x = 0; x < 16; x++) {
		buf[0][x] = x;
	}
	x = sizeof (buf[1]);
	ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey);
	ecc_verify_hash (buf[1], x, buf[0], 16, &stat, &pubKey);
	buf[0][0] ^= 1;
	ecc_verify_hash (buf[1], x, buf[0], 16, &stat2, &privKey);
	if (!(stat == 1 && stat2 == 0)) { 
		fprintf(stderr, "ecc_verify_hash failed %d, %d, ", stat, stat2);
	}
}

Open in new window

"yarrow_prng" is not declared in the main function.
So have to check the header file such as tomcrypt.h.
Suggest you open a new question thanks
Avatar of Wathan

ASKER

Now i have a problem in compiling:

Error      7      error LNK2019: unresolved external symbol _sha1_init referenced in function _hashSHA1      D:\Dropbox\ProjSecSoft\Siger\Siger\Main.obj      Siger
Error      8      error LNK2019: unresolved external symbol _sha1_process referenced in function _hashSHA1      D:\Dropbox\ProjSecSoft\Siger\Siger\Main.obj      Siger
Error      9      error LNK2019: unresolved external symbol _sha1_done referenced in function _hashSHA1      D:\Dropbox\ProjSecSoft\Siger\Siger\Main.obj      Siger
Error      10      error LNK2001: unresolved external symbol _sha1_desc      D:\Dropbox\ProjSecSoft\Siger\Siger\Main.obj      Siger
Error      11      error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup      D:\Dropbox\ProjSecSoft\Siger\Siger\MSVCRTD.lib(crtexew.obj)      Siger
Error      12      error LNK1120: 5 unresolved externals      D:\Dropbox\ProjSecSoft\Siger\Debug\Siger.exe      Siger
Error      13      error C1083: Cannot open include file: 'tommath.h': No such file or directory      d:\downloads\compressed\libtom\libtomcrypt-1.17\src\math\ltm_desc.c      17      1      libtomcrypt