Error in M_ASN1_New_of function in openssl 1.1.0g

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in M_ASN1_New_of function in openssl 1.1.0g

Swamy J-S

I upgraded openssl from 1.0.2n to 1.1.0g in Linux recently and am getting some errors in code because many of the openssl functions are deprecated in new version. One such function is malloc function which is M_ASN1_New_Malloc(Poll, CertInfo) which was defined in asn1_mac.h

 

After openssl upgradation, i searched alternate function to "M_ASN1_New_Malloc" and i changed my code as below

DECLARE_ASN1_ALLOC_FUNCTIONS(CertInfo)

CertInfo *Poll = NULL;

Poll = M_ASN1_New_of(CertInfo)

 

When i build my code am getting error as undefined reference to 'CertInfo_it'.

 

I don't why its adding "_it" to CertInfo unnecessarily**.

 

 

Thanks and Regards,

SWAMY J S

 

Reply | Threaded
Open this post in threaded view
|

Re: Error in M_ASN1_New_of function in openssl 1.1.0g

Matt Caswell-2


On 19/04/2019 10:38, Swamy J-S wrote:

> After openssl upgradation, i searched alternate function to "M_ASN1_New_Malloc"
> and i changed my code as below
>
> DECLARE_ASN1_ALLOC_FUNCTIONS(CertInfo)
>
> CertInfo *Poll = NULL;
>
> Poll = M_ASN1_New_of(CertInfo)

How have you declared and implemented the CertInfo structure?

E.g. You might declare it like this:

typedef struct CertInfo_st {
    ASN1_OCTET_STRING *whatever;
} CertInfo;
DECLARE_ASN1_FUNCTIONS(CertInfo)

And then implement it something like this:

ASN1_SEQUENCE(CertInfo) = {
    ASN1_SIMPLE(CertInfo, whatever, ASN1_OCTET_STRING)
} ASN1_SEQUENCE_END(CertInfo)
IMPLEMENT_ASN1_FUNCTIONS(CertInfo)


The DECLARE_ASN1_FUNCTIONS macro also uses the DECLARE_ASN1_ALLOC_FUNCTIONS
macro so there is no need to use it separately.

Then in your code you can do something like this:

CertInfo *Poll = NULL;

Poll = CertInfo_new();


Don't use the M_ASN1_New_of macro at all.

Matt