LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-12-2005, 12:53 PM   #16
jacques83
Member
 
Registered: Nov 2005
Posts: 34

Original Poster
Rep: Reputation: 15

the only change that needs to be done to the above code to run is the setting of k_ipad and k_opad to the values as shown....

/* start out by storing key in pads */
bzero( k_ipad, sizeof k_ipad);
bzero( k_opad, sizeof k_opad);
bcopy( key, k_ipad, key_len);
bcopy( key, k_opad, key_len);

/* XOR key with ipad and opad values */
for (i=0; i<64; i++) {
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
 
Old 11-12-2005, 01:48 PM   #17
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
Man, you're implementing the HMAC algorithm wrong. You're not XORing the ipad with the key, nor the opad. Re-read the RFC. For the HMAC, it's better to have a key-setup function, an update function and a final function, just like MD5, SHA1, et al. OpenSSL has HMAC functions that perform what you're trying to code.
Check the manual:
http://www.freebsd.org/cgi/man.cgi?q...ts&format=html

Last edited by primo; 11-12-2005 at 01:50 PM.
 
Old 11-12-2005, 01:57 PM   #18
jacques83
Member
 
Registered: Nov 2005
Posts: 34

Original Poster
Rep: Reputation: 15
well i am not quite able to understand how to use the HMAC functions given in openssl. i am using the code given in the rfc itself for implementing hmac
 
Old 11-12-2005, 02:00 PM   #19
jacques83
Member
 
Registered: Nov 2005
Posts: 34

Original Poster
Rep: Reputation: 15
do you have any idea as to how to directly invoke those functions in the implementation of HMAC?i mean i am confused with the parameters that are passed to the init,update,final functions.any help will b most welcome.


thanks
 
Old 04-11-2013, 05:17 AM   #20
Stenry
LQ Newbie
 
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Thumbs down About your question

In freebsd,I have the same question.I solve them as below:
man 3 md5
search the lib of md5.h
It's lmd
so i add -lmd to LIBS in my Makefile
 
Old 04-11-2013, 07:23 AM   #21
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
You might want to check the date on the question before providing an answer.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting undefined reference to main error?? Mistro116@yahoo.com Programming 14 07-29-2011 08:28 AM
Undefined reference error in MD5_Init() jacques83 Linux - Networking 0 11-11-2005 09:44 PM
gcc ld error. Undefined reference redness Linux - Software 4 02-08-2005 02:01 AM
undefined reference error Quest101 Programming 3 01-01-2005 12:27 PM
Undefined reference to function error Quest101 Linux - Newbie 0 12-30-2004 05:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration