Re: Openssl_malloc returns NULL. - Openssl
This is a discussion on Re: Openssl_malloc returns NULL. - Openssl ; On Mon July 14 2008 03:34, vikas khanna wrote:
>
> Thanks for a quick reply.
>
> Looking at how HMAC_Init is defined.. it calls both the function you mentioned so I assume I am correct in using HMAC_Init ...
-
Re: Openssl_malloc returns NULL.
On Mon July 14 2008 03:34, vikas khanna wrote:
>
> Thanks for a quick reply.
>
> Looking at how HMAC_Init is defined.. it calls both the function you mentioned so I assume I am correct in using HMAC_Init . Key and md are never null in my case.
>
> void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
> const EVP_MD *md)
Did you mean:
{
if(key && md){
HMAC_CTX_init(ctx);
HMAC_Init_ex(ctx,key,len,md, NULL);
}
}
Mike
>
> Regards,
> Vikas
>
>
> --- On Mon, 14/7/08, Klarth wrote:
>
> > From: Klarth
> > Subject: Re: Openssl_malloc returns NULL.
> > To: "vikas khanna"
> > Date: Monday, 14 July, 2008, 1:31 PM
> > Hi,
> >
> > Its difficult to give you a straight answer on this
> > question because I
> > can't figure out which of those parameters, apart from
> > hmacCtx, are
> > pointers, which ones you allocate before using the HMAC
> > functions, how
> > you allocate them, and how you manipulate them before this
> > function
> > (that is if you do manipulate them). However ....
> >
> > I believe the documentation has the answer in your case. If
> > you look
> > at the documentation for the HMAC functions
> > (http://www.openssl.org/
> > docs/crypto/hmac.html), you will notice that it says taht
> > HMAC_CTX_init() MUST be called on hmacCtx first. This is
> > regardless
> > whether you are using malloc or not for the context. I
> > believe this is
> > why you are getting stack corruption. Another point from
> > the
> > documentation is that you should now be using
> > HMAC_Init_ex() instead
> > of HMAC_init, since HMAC_init has been deprecated (although
> > it still
> > works in 0.9.8e).
> >
>
>
> >
> > --- Kah
> >
> >
> > On Jul 14, 3:40Â*pm, vikas191...@yahoo.com (vikas khanna)
> > wrote:
> > > Hi ,
> > > I am using openssl-0.9.8e in my codebase.
> > > I am using SHA1 in my code base to authenticate my
> > data. The code seems to work fine for 5-10 mins. But after
> > sometime it crashes as openssl_malloc returns null in
> > function EVP_DigestInit_ex . This is defiantly not the
> > problem of memory exhaustion as, the crash dumps shows 700
> > KB of largest free memory block available and the ctx size
> > is of 100 bytes.
> > > This seems to be the case of stack corruption. While
> > surfing though the net , I found exactly similar problem on
> > this link
> > >
> > http://www.mail-archive.com/openssl-.../msg51093.html
> > .
> > >
> > > I would like to know Â*, if this problem is due to my
> > code , or some bug in openssl. My code snippet is shown
> > below…
> > >
> > > Calculate_Hash(….)
> > > {
> > >
> > > Â* Â* HMAC_CTX hmacCtx;
> > > Â* Â* HMAC_Init( &hmacCtx , (const void *)authKey
> > , keyLength , EVP_sha1());
> > > Â* Â* HMAC_Update( &hmacCtx , authStart ,
> > authLength );
> > > Â* Â* HMAC_Final( &hmacCtx , tagOffset , &len
> > );
> > > Â* Â* HMAC_CTX_cleanup(&hmacCtx);
> > >
> > > }
> > >
> > > Regards,
> > > Vikas
> > >
> > > Â* Â* Â*
> > __________________________________________________ ________
> > > Not happy with your email address?.
> > > Get the one you really want - millions of new email
> > addresses available now at
> > Yahoo!http://uk.docs.yahoo.com/ymail/new.html
> > >
> > __________________________________________________ ____________________
> > > OpenSSL Project Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*
> > Â* Â* Â*http://www.openssl.org
> > > User Support Mailing List Â* Â* Â* Â* Â* Â* Â* Â* Â*
> > Â*openssl-us...@openssl.org
> > > Automated List Manager Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*
> > Â* Â* Â* majord...@openssl.org
>
>
> __________________________________________________ ________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
> __________________________________________________ ____________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List openssl-users@openssl.org
> Automated List Manager majordomo@openssl.org
>
>
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org
-
Re: Openssl_malloc returns NULL.
Yes.. Thanks for correcting me..
Vikas
--- On Mon, 14/7/08, Michael S. Zick wrote:
> From: Michael S. Zick
> Subject: Re: Openssl_malloc returns NULL.
> To: openssl-users@openssl.org
> Date: Monday, 14 July, 2008, 5:15 PM
> On Mon July 14 2008 03:34, vikas khanna wrote:
> >
> > Thanks for a quick reply.
> >
> > Looking at how HMAC_Init is defined.. it calls both
> the function you mentioned so I assume I am correct in
> using HMAC_Init . Key and md are never null in my case.
> >
> > void HMAC_Init(HMAC_CTX *ctx, const void *key, int
> len,
> > const EVP_MD *md)
> Did you mean:
> {
> if(key && md){
> HMAC_CTX_init(ctx);
> HMAC_Init_ex(ctx,key,len,md, NULL);
> }
> }
>
> Mike
> >
> > Regards,
> > Vikas
> >
> >
> > --- On Mon, 14/7/08, Klarth
> wrote:
> >
> > > From: Klarth
> > > Subject: Re: Openssl_malloc returns NULL.
> > > To: "vikas khanna"
>
> > > Date: Monday, 14 July, 2008, 1:31 PM
> > > Hi,
> > >
> > > Its difficult to give you a straight answer on
> this
> > > question because I
> > > can't figure out which of those parameters,
> apart from
> > > hmacCtx, are
> > > pointers, which ones you allocate before using
> the HMAC
> > > functions, how
> > > you allocate them, and how you manipulate them
> before this
> > > function
> > > (that is if you do manipulate them). However ....
> > >
> > > I believe the documentation has the answer in
> your case. If
> > > you look
> > > at the documentation for the HMAC functions
> > > (http://www.openssl.org/
> > > docs/crypto/hmac.html), you will notice that it
> says taht
> > > HMAC_CTX_init() MUST be called on hmacCtx first.
> This is
> > > regardless
> > > whether you are using malloc or not for the
> context. I
> > > believe this is
> > > why you are getting stack corruption. Another
> point from
> > > the
> > > documentation is that you should now be using
> > > HMAC_Init_ex() instead
> > > of HMAC_init, since HMAC_init has been deprecated
> (although
> > > it still
> > > works in 0.9.8e).
> > >
> >
> >
> > >
> > > --- Kah
> > >
> > >
> > > On Jul 14, 3:40Â*pm, vikas191...@yahoo.com (vikas
> khanna)
> > > wrote:
> > > > Hi ,
> > > > I am using openssl-0.9.8e in my codebase.
> > > > I am using SHA1 in my code base to
> authenticate my
> > > data. The code seems to work fine for 5-10 mins.
> But after
> > > sometime it crashes as openssl_malloc returns
> null in
> > > function EVP_DigestInit_ex . This is defiantly
> not the
> > > problem of memory exhaustion as, the crash dumps
> shows 700
> > > KB of largest free memory block available and the
> ctx size
> > > is of 100 bytes.
> > > > This seems to be the case of stack
> corruption. While
> > > surfing though the net , I found exactly similar
> problem on
> > > this link
> > > >
> > >
> http://www.mail-archive.com/openssl-.../msg51093.html
> > > .
> > > >
> > > > I would like to know Â*, if this problem is
> due to my
> > > code , or some bug in openssl. My code snippet is
> shown
> > > below…
> > > >
> > > > Calculate_Hash(….)
> > > > {
> > > >
> > > > Â* Â* HMAC_CTX hmacCtx;
> > > > Â* Â* HMAC_Init( &hmacCtx , (const void
> *)authKey
> > > , keyLength , EVP_sha1());
> > > > Â* Â* HMAC_Update( &hmacCtx , authStart
> ,
> > > authLength );
> > > > Â* Â* HMAC_Final( &hmacCtx , tagOffset ,
> &len
> > > );
> > > > Â* Â* HMAC_CTX_cleanup(&hmacCtx);
> > > >
> > > > }
> > > >
> > > > Regards,
> > > > Vikas
> > > >
> > > > Â* Â* Â*
> > >
> __________________________________________________ ________
> > > > Not happy with your email address?.
> > > > Get the one you really want - millions of
> new email
> > > addresses available now at
> > > Yahoo!http://uk.docs.yahoo.com/ymail/new.html
> > > >
> > >
> __________________________________________________ ____________________
> > > > OpenSSL Project Â* Â* Â* Â* Â* Â* Â* Â* Â*
> Â* Â* Â* Â*
> > > Â* Â* Â*http://www.openssl.org
> > > > User Support Mailing List Â* Â* Â* Â* Â* Â*
> Â* Â* Â*
> > > Â*openssl-us...@openssl.org
> > > > Automated List Manager Â* Â* Â* Â* Â* Â* Â*
> Â* Â* Â*
> > > Â* Â* Â* majord...@openssl.org
> >
> >
> >
> __________________________________________________ ________
> > Not happy with your email address?.
> > Get the one you really want - millions of new email
> addresses available now at Yahoo!
> http://uk.docs.yahoo.com/ymail/new.html
> >
> __________________________________________________ ____________________
> > OpenSSL Project
> http://www.openssl.org
> > User Support Mailing List
> openssl-users@openssl.org
> > Automated List Manager
> majordomo@openssl.org
> >
> >
> __________________________________________________ ____________________
> OpenSSL Project
> http://www.openssl.org
> User Support Mailing List
> openssl-users@openssl.org
> Automated List Manager
> majordomo@openssl.org
__________________________________________________ ________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org