i2d & ASN1_SEQUENCE related query in openssl 1.1.1.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am trying to write replacement ASN1 macros for i2d/d2i functions in openssl 1.1.1
Previously: 
typedef struct pkcs7_issuer_and_subject_st
{
    X509_NAME *issuer;          /* Certificate Issuer's name */
    X509_NAME *subject;         /* Certificate's subject name */
} PKCS7_ISSUER_AND_SUBJECT;
----
i2d function:
int i2d_PKCS7_ISSUER_AND_SUBJECT (PKCS7_ISSUER_AND_SUBJECT * a,
                                              unsigned char **pp)
 {
     M_ASN1_I2D_vars (a);
     M_ASN1_I2D_len (a->issuer, i2d_X509_NAME);
     M_ASN1_I2D_len (a->subject, i2d_X509_NAME); 
     M_ASN1_I2D_seq_total ();
     M_ASN1_I2D_put (a->issuer, i2d_X509_NAME);
     M_ASN1_I2D_put (a->subject, i2d_X509_NAME);
     M_ASN1_I2D_finish ();
 }

======================================
New :

DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SUBJECT) 

ASN1_SEQUENCE(PKCS7_ISSUER_AND_SUBJECT) = {
        ASN1_SIMPLE(PKCS7_ISSUER_AND_SUBJECT, issuer, X509_NAME),
        ASN1_SIMPLE(PKCS7_ISSUER_AND_SUBJECT, subject, X509_NAME)
} ASN1_SEQUENCE_END(PKCS7_ISSUER_AND_SUBJECT)

IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SUBJECT)

Finally , we can call the function : 
 ulLen = i2d_PKCS7_ISSUER_AND_SUBJECT (&pkcs7IssuerAndSub, &ptr);

Is this the correct way , or am I missing anything ??
( does it need  DECLARE_ASN1_ALLOC_FUNCTIONS  & DECLARE_ASN1_ITEM .. ...etc.,.)   
Can anyone help me out in this regard !!

Thanks,
Prudvi.







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux