<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Richard, all,<br>
    </p>
    <p>I tried to do the forward declaration also for the TEST_SIGNATURE
      together with the TEST one, but that did not really work :( It is
      still complaining about the use of 'sizeof' on an incomplete type.
      In particular, the two errors are:</p>
    <blockquote>
      <p>src/ocspv2/****: error: use of undeclared identifier 'TEST_it'<br>
        ASN1_EXP_SEQUENCE_OF_OPT(TEST_TBS, otherTests, TEST, 5),<br>
        ^</p>
      <p>and</p>
      <p>src/ocspv2/****: error: invalid application of 'sizeof' to an
        incomplete type 'const ASN1_TEMPLATE []'<br>
        } ASN1_SEQUENCE_END(TEST_TBS)<br>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
      </p>
    </blockquote>
    <p>I guess I need to checkout the macros a bit more.. :D <br>
    </p>
    <p>Question: does anybody know if  there is any other structure
      already implemented in OpenSSL that resembles the one I am trying
      to do here? I tried to look for something similar, but no
      success.. :D <br>
    </p>
    <p>If there is no easy answer, I guess I will have to either change
      the envisioned approach (maybe introducing an intermediate data
      structure of some kind..?) or use the ASN1_ANY approach.</p>
    <p>Cheers,<br>
      Max<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 12/2/17 4:54 AM, Richard Levitte
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20171202.125408.1222423086056733693.levitte@openssl.org">
      <pre wrap="">In message <a class="moz-txt-link-rfc2396E" href="mailto:d1eeba62-f25f-c984-dc77-94a150cf73c1@openca.org"><d1eeba62-f25f-c984-dc77-94a150cf73c1@openca.org></a> on Fri, 1 Dec 2017 20:22:09 -0700, "Dr. Pala" <a class="moz-txt-link-rfc2396E" href="mailto:madwolf@openca.org"><madwolf@openca.org></a> said:

madwolf> Hi Richard,
madwolf> 
madwolf> thanks :D That worked. I have a new challenge for you now. Here's what
madwolf> I am trying to do:
madwolf> 
madwolf> ASN1_SEQUENCE(TEST);
madwolf> ASN1_SEQUENCE(TBS_TEST) = {
madwolf>     ASN1_SIMPLE(TBS_TEST, version, ASN1_INTEGER),
madwolf>     ASN1_EXP_SEQUENCE_OF_OPT(TBS_TEST, otherTests, TEST, 0)
madwolf> } ASN1_SEQUENCE_END(TEST)
madwolf> 
madwolf> IMPLEMENT_ASN1_FUNCTIONS(TBS_TEST) [**]
madwolf> 
madwolf> ASN1_SEQUENCE(TEST) = {
madwolf>     ASN1_SIMPLE(TEST, tbsTest, ASN1_INTEGER),
madwolf>     ASN1_EXP_OPT(TEST, optionalSignature, TEST_SIGNATURE, 0)
madwolf> } ASN1_SEQUENCE_END(TEST)
madwolf> 
madwolf> IMPLEMENT_ASN1_FUNCTIONS(TEST) [**]
madwolf> 
madwolf> In this case, the difference is that TBS_TEST has, inside the
madwolf> otherTests that are of type TEST. The TEST is built out of a tbsTest
madwolf> and an optionalSignature - but it is defined after TBS_TEST.
madwolf> 
madwolf> What to do in this case ?

It seems to me that you need to do some kind of forward declaration of
TEST_SIGNATURE as well, before the construction of TEST.  (also, to be
picky, you need to make sure that ASN1_SEQUENCE(TBS_TEST) is ended
with ASN1_SEQUENCE_END(TBS_TEST), not ASN1_SEQUENCE_END(TEST))

Cheers,
Richard

</pre>
    </blockquote>
    <br>
  </body>
</html>