• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 693
  • Last Modified:

Crypto using Libtom with ECDSA

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.
  • 3
  • 2
1 Solution
btanExec ConsultantCommented:
Likely the function Is In #include <tomcrypt.h>   but as you mention on the crypto function parameter can be quite unfathomable. There isn't much collateral but except the crypt.pdf manual that is the most comprehensive so far and comment in the functions.

See this in hashing though not directly on ecdsa and roughly you know the structure of the format to call thise function.  The manual chapter 8 and later chapters has pointers too..

btanExec ConsultantCommented:
WathanAuthor Commented:
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:

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

btanExec ConsultantCommented:
"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
WathanAuthor Commented:
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

Featured Post

The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now