Solved

Crypto using Libtom with ECDSA

Posted on 2013-12-17
5
610 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 62

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 62

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 62

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
An analysis of the phishing scam that has been affecting Google users, along with steps to take for protection, as well as what to do if you receive one of the emails.
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

863 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

27 Experts available now in Live!

Get 1:1 Help Now