Failure of ..new() for CTX objects in openssl 1.1.1g

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Failure of ..new() for CTX objects in openssl 1.1.1g

prudvi raj
Hi,

we are upgrading our codebase to openssl 1.1.1g from openssl 1.0.2k
Previously, all the ctx objects are allocated memory using "calloc"
typedef struct CryptWrapMDContext_t
{
#ifdef OPENSSL
    EVP_MD_CTX  evpMDCtx;
......
    struct CryptWrapMDContext_t *pNext;
}

Allocation :  return ((CryptWrapMDContext_t *)  calloc (1, sizeof (CryptWrapMDContext_t)));

Now that in openssl 1.1.1 , as objects are opaque , we have to use pointers (*) & new()  . 
typedef struct CryptWrapMDContext_t
{
#ifdef OPENSSL
    EVP_MD_CTX *evpMDCtx;
......
    struct CryptWrapMDContext_t *pNext;
}
CryptWrapMDContext_t;
 So Allocation becomes : 
       CryptWrapMDContext_t *pTemp;
        pTemp = ((CryptWrapMDContext_t *) calloc (1, sizeof (CryptWrapMDContext_t)));
         pTemp-> evpMDCtx = EVP_MD_CTX_new();
        return pTemp;

But , we are seeing crash upon the call of  EVP_MD_CTX_new();  (new is returning null)
So, are there any probable reasons why the new() has failed ??

Regards,
prud.