[openssl-users] ASN1 & Recursive Structures definition

Dr. Pala director at openca.org
Fri Dec 1 19:14:54 UTC 2017


Hi all,

I am trying to define an ASN1 structure similar to this:

ASN1_SEQUENCE(TEST) = {
     ASN1_SIMPLE(TEST, version, ASN1_INTEGER),
     ASN1_EXP_SEQUENCE_OF_OPT(TEST, otherTests, TEST, 0)
} ASN1_SEQUENCE_END(TEST)

IMPLEMENT_ASN1_FUNCTIONS(TEST) [**]

what is the correct procedure for doing that ? The problem is that the 
"otherTests" field should be a sequence of "TEST" structures, but 
defined like that it won't work.

Is there a way to solve the issue ? Or shall we use something like 
ASN1_ANY to avoid the circular reference ?

Cheers,
Max

[**] = For completeness, that is what is defined in the test.c - in 
test.h we define the struct as usual

     struct test_st;
     typedef struct test_st TEST;

     typedef struct test_st {
         ASN1_INTEGER * version;
         STACK_OF(TEST) * otherTests;
     } TEST;

     DECLARE_ASN1_FUNCTIONS(TEST)

-- 
Best Regards,
Massimiliano Pala, Ph.D.
OpenCA Labs Director
OpenCA Logo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171201/5a26df89/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecglhfmndemlfmfa.png
Type: image/png
Size: 3146 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171201/5a26df89/attachment-0001.png>


More information about the openssl-users mailing list