Error in M_ASN1_New_of function in openssl 1.1.0g

Matt Caswell matt at openssl.org
Fri Apr 19 10:05:39 UTC 2019



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


More information about the openssl-users mailing list