[EXTERNAL] ASN.1 macros for composite structures

Sands, Daniel dnsands at sandia.gov
Thu Jan 26 20:10:58 UTC 2023


You need to provide an implementation for those.  This is just the data structure.

In the C file, add something like this:
ASN1_SEQUENCE(example) = {
   ASN1_SIMPLE(example, a, ASN1_OBJECT),
   ASN1_SIMPLE(example, b, ASN1_OBJECT)
} ASN1_SEQUENCE_END(example);

This defines the instructions necessary for the ASN1 code to serialize your data.

Now you can implement the functions:

IMPLEMENT_ASN1_FUNCTIONS(example)


In your header file you also want to declare those functions:

DECLARE_ASN1_FUNCTIONS(example)


> -----Original Message-----
> From: openssl-users <openssl-users-bounces at openssl.org> On Behalf Of Ladd,
> Watson via openssl-users
> Sent: Thursday, January 26, 2023 10:57 AM
> To: openssl-users at openssl.org
> Subject: [EXTERNAL] ASN.1 macros for composite structures
> 
> Dear OpenSSL Users,
> 
> I have a structure of the form
> 
> typdef struct {
>       ASN1_OBJECT *a;
>        ASN1_OBJECT *b;
> } example;
> 
> and I cannot figure out how to make the ASN.1 macros serialize it correctly.
> 
> When I tried to use an ASN1_SEQUENCE with two ASN1_SIMPLEs the code
> failed to serialize the structure.
> I've been trying to use various ASN1_TYPE, but it seems those only work when
> ASN1_OPTS are used or some variant.
> 
> Any suggestions/pointers to documentation on how to do this? It seems like the
> resources that used to exist for the very old macros don't exist anymore, and the
> newer more explicit stuff is only used inside of providers and not exposed
> elsewhere.
> 
> Sincerely,
> Watson Ladd


More information about the openssl-users mailing list