On Fri, Sep 09, 2016, Aleksandr Konstantinov wrote:

> Hello,
> 
> Thanks for your answer. Here is one of d2i functions simplified:
> 
> MYEXT * d2i_MYEXT(MYEXT ** myext, unsigned char ** pp, long length) {
>   M_ASN1_D2I_vars(myext, MYEXT *, MYEXT_new);
>   M_ASN1_D2I_Init();
>   M_ASN1_D2I_start_sequence();
>   M_ASN1_D2I_get_EXP_opt(ret->intmember, d2i_ASN1_INTEGER, 1);
>   M_ASN1_D2I_get_opt(ret->intmember, d2i_ASN1_INTEGER, V_ASN1_INTEGER);
>   M_ASN1_D2I_Finish(myext, MYEXT_free, ASN1_F_D2I_MYEXT);
> }
> 
> 

Presumably the two fields aren't the same? I'll call one intmember2 for
this example.

The above would translate to something like:

ASN1_SEQUENCE(MYEXT) = {
        ASN1_EXP_OPT(MYEXT, intmember, ASN1_INTEGER, 1),
        ASN1_OPT(MYEXT, intmember2, ASN1_INTEGER)
} ASN1_SEQUENCE_END(MYEXT)

IMPLEMENT_ASN1_FUNCTIONS(MYEXT)

Then you include:

DECLARE_ASN1_FUNCTIONS(MYEXT)

in a header file.

That generates four functions MYEXT_new(), MYEXT_free(), d2i_MYEXT() and 
i2d_MYEXT().

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to