[openssl-users] M_ASN1_D2I_* replacement in OpenSSL 1.1.0

Aleksandr Konstantinov aleksandr.v.konstantinov at gmail.com
Fri Sep 9 06:41:44 UTC 2016


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);
}


Regards,


A.K.



On Thu, Sep 8, 2016 at 10:23 PM, Dr. Stephen Henson <steve at openssl.org>
wrote:

> On Thu, Sep 08, 2016, Aleksandr Konstantinov wrote:
>
> > Hello all,
> >
> > I'm in process of porting our project to OpenSSL 1.1.0. We have part of
> > code which heavily uses M_ASN1_D2I_* and M_ASN1_I2D_* for defining d2i_*
> > and i2d_* methods for new extension. For example code uses
> M_ASN1_D2I_vars,
> > M_ASN1_D2I_Init and M_ASN1_D2I_start_sequence to start reading sequence
> of
> > items and then proceeds with M_ASN1_D2I_get_* for content of the
> > sequence. Could please anybody advise what would be proper replacement
> for
> > those macros in OpenSSL 1.1.0? Is there any new API for such things? Or
> > shall one do raw byte banging?
> >
>
> Those old macros were updated way back in OpenSSL 0.9.7 and finally
> retired in
> OpenSSL 1.1.0.
>
> You need to write an appropriate ASN.1 module to encode and decode your
> structure. There are many examples of this such as in crypto/cms/cms_asn1.c
> and some much simpler ones in crypto/x509v3 which are perhaps better
> suited to
> you needs.
>
> They use macros which start with ASN1_SEQUENCE*
>
> Is it possible to look at your old code? Then I could give some more
> specific
> pointers.
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20160909/d16d8b11/attachment.html>


More information about the openssl-users mailing list