Solved

Crypto using Libtom with ECDSA

Posted on 2013-12-17
5
604 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:Wathan
  • 3
  • 2
5 Comments
 
LVL 61

Accepted Solution

by:
btan earned 500 total points
ID: 39725754
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..

http://techoverflow.net/blog/2012/11/19/how-to-calculate-hashes-using-libtomcrypt-in-cpp/
0
 
LVL 61

Expert Comment

by:btan
ID: 39725762
0
 

Author Comment

by:Wathan
ID: 39738372
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

0
 
LVL 61

Expert Comment

by:btan
ID: 39738750
"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
0
 

Author Comment

by:Wathan
ID: 39740101
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Finding a job can be stressful - searches, resume tweaks, and networking events can be super boring. Luckily we're here to help you land your dream job!
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now