Solved

Crypto using Libtom with ECDSA

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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