Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6629779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:18:32+00:00 2026-05-25T22:18:32+00:00

First of all I am showing the code for my c file .. #include

  • 0

First of all I am showing the code for my c file ..

#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <memory.h>
#include <string.h>
#include <ctype.h>
#include "sendip_module.h"
#include "ipv6ext.h"
#include "../ipv6.h"
#include "../ipv4.h"
#include "ah.h"
#include "esp.h"
#include "crypto_module.h"

#include <openssl/hmac.h>
#include <openssl/md5.h>

/*
code for hmac_md5 here....

void
hmac_md5(text, text_len, key, key_len, digest)
unsigned char*  text;                /* pointer to data stream */
int text_len;            /* length of data stream */
unsigned char* key;                 /* pointer to authentication key */
int key_len;             /* length of authentication key */
caddr_t digest;              /* caller digest to be filled in */

{
    MD5_CTX context;
    unsigned char k_ipad[65];    /* inner padding -
                                  * key XORd with ipad
                                  */
    unsigned char k_opad[65];    /* outer padding -
                                  * key XORd with opad
                                  */
    unsigned char tk[16];
    int i;
    /* if key is longer than 64 bytes reset it to key=MD5(key) */
    if (key_len > 64) {

            MD5_CTX      tctx;

            MD5Init(&tctx);
            MD5Update(&tctx, key, key_len);
            MD5Final(tk, &tctx);

            key = tk;
            key_len = 16;
    }

    /*
     * the HMAC_MD5 transform looks like:
     *
     * MD5(K XOR opad, MD5(K XOR ipad, text))
     *
     * where K is an n byte key
     * ipad is the byte 0x36 repeated 64 times
     * opad is the byte 0x5c repeated 64 times
     * and text is the data being protected
     */

    /* 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;
    }
    /*
     * perform inner MD5
     */
    MD5Init(&context);                   /* init context for 1st
                                          * pass */
    MD5Update(&context, k_ipad, 64);      /* start with inner pad */
    MD5Update(&context, text, text_len); /* then text of datagram */
    MD5Final(digest, &context);          /* finish up 1st pass */
    /*
     * perform outer MD5
     */
    MD5Init(&context);                   /* init context for 2nd
                                          * pass */
    MD5Update(&context, k_opad, 64);     /* start with outer pad */
    MD5Update(&context, digest, 16);     /* then results of 1st
                                          * hash */
    MD5Final(digest, &context);          /* finish up 2nd pass */

}

*/

/*
rest of the program logic...
*/

I have already included …<.path where openssl is installed…..>../openssl/include to C_INCLUDE_PATH and exported it.

and now when i try to compile it getting error :

 $ make

gcc -o xorauth.so -I.. -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings
wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -  
DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared xorauth.c ../libsendipaux.a  
../libsendipaux.a

cc1: warnings being treated as errors

xorauth.c:34:1: error: function declaration isn’t a prototype
xorauth.c: In function ‘hmac_md5’:
xorauth.c:56:17: error: implicit declaration of function ‘MD5Init’
xorauth.c:56:17: error: nested extern declaration of ‘MD5Init’
xorauth.c:57:17: error: implicit declaration of function ‘MD5Update’
xorauth.c:57:17: error: nested extern declaration of ‘MD5Update’ 
xorauth.c:58:17: error: implicit declaration of function ‘MD5Final’
xorauth.c:58:17: error: nested extern declaration of ‘MD5Final’
make: *** [xorauth.so] Error 1

if required I will edit the other implementation details I have skiped them just to make the post small because I think there is something which i need to do regarding include path and header files and i am unaware of it.

What is going wrong please help me ???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:18:33+00:00Added an answer on May 25, 2026 at 10:18 pm

    There is no MD5Init function in OpenSSL. (There is in the BSD implementation.)

    man MD5_Init (note the underscore), or see here.

    EDIT:

    Now that you’ve shown us the offending code, I can also help with the “not a prototype” message.

    You have (edited a bit):

    void hmac_md5(text, text_len, key, key_len, digest)
    unsigned char*  text;                
    int text_len;            
    unsigned char* key;                 
    int key_len;             
    caddr_t digest;              
    {
        /* ... */
    }
    

    That’s an old-style, or “K&R”, function definition. It’s still valid, but only for backward compatibility, and it means that the compiler won’t be able to warn you about calls with the wrong number or type(s) of arguments. The modern (since 1989) version is:

    void hmac_md5(unsigned char *text, 
                  int text_len, 
                  unsigned char *key, 
                  int key_len, 
                  caddr_t digest)
    {
        /* ... */
    }
    

    When converting old-style function declarations and definitions to use prototypes, you sometimes have to be careful about parameters with narrow types (float, and integer types narrower than int or unsigned int) due to the promotion rules. That doesn’t apply in this particular case.

    Note that you can leave the definition as it is if you like. Since you got the code from an internet draft, that might even be a good idea (if it ain’t broke, don’t fix it) — but as I said you’ll get no help from the compiler if you call it with the wrong number or type(s) of arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all I am showing the PHP code .... <?php echo (hello); echo
First of all, I'd like to point out that I'm not asking for code.
I am using string.split() in my C# code for reading tab separated file. I
I am working with entity framework with code fist design pattern. First of all
First of all, I know how to build a Java application. But I have
First of all, I don't need a textual comparison so Beyond Compare doesn't do
First of all, I'm fairly sure snapping to grid is fairly easy, however I've
First of all: I am not an experienced ClearCase user, but I have lots
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built
First of all there is a partial question regarding this, but it is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.