Compiler error ASN1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler error ASN1

Daniel Diaz Sanchez-2
Hello to everybody,
        I have a problem when implementing a simple structure using OpenSSL
Asn1. This is the problem:

        When I try to implement this data structure:

        A ::= SEQUENCE {
                        b
                        CHOICE {
                                        b1 INTEGER,
                     b2 INTEGER},
                        a1 BOOLEAN,
                        a2 INTEGER OPTIONAL,
                        a3 [0] INTEGER OPTIONAL,
                        a4 [1] INTEGER
        }
 
        I do it in the following way:

        /* .h */
        typedef struct B_st
        {
                int type ;
                union {
                        ASN1_INTEGER *b1;
                        ASN1_INTEGER *b2;
                }value;
        }B;

        typedef struct A_st
        {
                B *b;
                ASN1_BOOLEAN *a1;
                ASN1_INTEGER *a2;
                ASN1_INTEGER *a3;
                ASN1_INTEGER *a4;
        }A;

        DECLARE_ASN1_ITEM(B)
        DECLARE_ASN1_ITEM(A)
        DECLARE_ASN1_FUNCTIONS(B)
        DECLARE_ASN1_FUNCTIONS(A)

        /* .c */
       
        ASN1_CHOICE(B) = {
                ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
                ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
        }ASN1_CHOICE_END(B) //(*2)

        ASN1_SEQUENCE(A) = {
                ASN1_EXP(A,b,B) //choice
                ASN1_SIMPLE(A,a1,ASN1_BOOLEAN)
                ASN1_OPT(A,a2,ASN1_INTEGER)
                ASN1_IMP_OPT(A,a3,ASN1_INTEGER,0)
                ASN1_IMP(A,a4,ASN1_INTEGER,1)
        }ASN1_SEQUENCE_END(A)

        IMPLEMENT_ASN1_FUNCTION(A)

        But I obtain (using Visual Studio)

        error C2059: syntax error : '{' at line (*1) and
        error C2059: syntax error : '{' at line (*2)

        I'm doing it ok or there is something missing?.

        Thanks!,

        Regards,
                                       
--
Daniel Diaz Sanchez
Telecommunication Engineer
Researcher / Teaching Assistant
 
Dep. Ing. Telemática
Universidad Carlos III de Madrid
Av. Universidad, 30
28911 Leganés (Madrid/Spain)
Tel: (+34) 91-624-8817, Fax: -8749

Web: www.it.uc3m.es/dds
web: http://www.it.uc3m.es/pervasive
A toolkit for attribute certificates:
http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml

Mail: dds[at].it.uc3m.es
Skype: dds.it.uc3m.es



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Compiler error ASN1

Peter Sylvester-3
Daniel Diaz Sanchez wrote:

> Hello to everybody,
> I have a problem when implementing a simple structure using OpenSSL
> Asn1. This is the problem:
>
> When I try to implement this data structure:
>
> A ::= SEQUENCE {
> b
> CHOICE {
> b1 INTEGER,
>                      b2 INTEGER},
>  
The previous is ambiguous. use for example b2 [0] INTEGER
Also, the given syntax does not say whether you are in global
environment of EXPLICIT or IMPLICIT tagging. It seems
that you assume IMPLICIT


> a1 BOOLEAN,
> a2 INTEGER OPTIONAL,
> a3 [0] INTEGER OPTIONAL,
> a4 [1] INTEGER
> }
>  
> I do it in the following way:
>
> /* .h */
> typedef struct B_st
> {
> int type ;
> union {
> ASN1_INTEGER *b1;
> ASN1_INTEGER *b2;
> }value;
> }B;
>
> typedef struct A_st
> {
> B *b;
> ASN1_BOOLEAN *a1;
> ASN1_INTEGER *a2;
> ASN1_INTEGER *a3;
> ASN1_INTEGER *a4;
> }A;
>
> DECLARE_ASN1_ITEM(B)
> DECLARE_ASN1_ITEM(A)
> DECLARE_ASN1_FUNCTIONS(B)
> DECLARE_ASN1_FUNCTIONS(A)
>
> /* .c */
>
> ASN1_CHOICE(B) = {
> ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
>  
missing ,
> ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
>  
missing }

ASN1_IMP(A,value.b2,ASN1_INTEGER,0)


> }ASN1_CHOICE_END(B) //(*2)
>
> ASN1_SEQUENCE(A) = {
> ASN1_EXP(A,b,B) //choice
>  
,
> ASN1_SIMPLE(A,a1,ASN1_BOOLEAN)
>  
,
> ASN1_OPT(A,a2,ASN1_INTEGER)
>  
,
> ASN1_IMP_OPT(A,a3,ASN1_INTEGER,0)
>  
,

> ASN1_IMP(A,a4,ASN1_INTEGER,1)
> }ASN1_SEQUENCE_END(A)
>
> IMPLEMENT_ASN1_FUNCTION(A)
>
> But I obtain (using Visual Studio)
>
> error C2059: syntax error : '{' at line (*1) and
> error C2059: syntax error : '{' at line (*2)
>
> I'm doing it ok or there is something missing?.
>
> Thanks!,
>
> Regards,
>
> --
> Daniel Diaz Sanchez
> Telecommunication Engineer
> Researcher / Teaching Assistant
>  
> Dep. Ing. Telemática
> Universidad Carlos III de Madrid
> Av. Universidad, 30
> 28911 Leganés (Madrid/Spain)
> Tel: (+34) 91-624-8817, Fax: -8749
>
> Web: www.it.uc3m.es/dds
> web: http://www.it.uc3m.es/pervasive
> A toolkit for attribute certificates:
> http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml
>
> Mail: dds[at].it.uc3m.es
> Skype: dds.it.uc3m.es
>
>
>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [hidden email]
> Automated List Manager                           [hidden email]
>
>
>
>  

--
To verify the signature, see http://edelpki.edelweb.fr/ 
Cela vous permet de charger le certificat de l'autorité;
die Liste mit zurückgerufenen Zertifikaten finden Sie da auch.


smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Compiler error ASN1

Daniel Diaz Sanchez-2
Thanks for your reply,

I'm in an implicit TAGS environment:

AttributeCertificateDefinitions {joint-iso-itu-t ds(5) module(1)
  attributeCertificateDefinitions(32) 5} DEFINITIONS IMPLICIT TAGS ::=
BEGIN

What I really want to implement is this extension, but I obtain an error in
the first asn1 structure, have a look to the implementation

error C2059: syntax error : '}'

timeSpecification EXTENSION ::= {
  SYNTAX         TimeSpecification
  IDENTIFIED BY  id-ce-timeSpecification
}

TimeSpecification ::= SEQUENCE {
  time
    CHOICE {absolute
              SEQUENCE {startTime  [0]  GeneralizedTime OPTIONAL,
                        endTime    [1]  GeneralizedTime OPTIONAL},
            periodic  SET OF Period},
  notThisTime  BOOLEAN DEFAULT FALSE,
  timeZone     TimeZone OPTIONAL
}

Period ::= SEQUENCE {
  timesOfDay  [0]  SET SIZE (1..MAX) OF DayTimeBand OPTIONAL,
  days
    [1]  CHOICE {intDay  SET OF INTEGER,
                 bitDay
                   BIT STRING {sunday(0), monday(1), tuesday(2),
wednesday(3),
                               thursday(4), friday(5), saturday(6)},
                 dayOf   XDayOf} OPTIONAL,
  weeks
    [2]  CHOICE {allWeeks  NULL,
                 intWeek   SET OF INTEGER,
                 bitWeek
                   BIT STRING {week1(0), week2(1), week3(2), week4(3),
week5(4)}
  } OPTIONAL,
  months
    [3]  CHOICE {allMonths  NULL,
                 intMonth   SET OF INTEGER,
                 bitMonth
                   BIT STRING {january(0), february(1), march(2), april(3),
                               may(4), june(5), july(6), august(7),
                               september(8), october(9), november(10),
                               december(11)}} OPTIONAL,
  years       [4]  SET OF INTEGER(1000..MAX) OPTIONAL
}

XDayOf ::= CHOICE {
  first   [1]  NamedDay,
  second  [2]  NamedDay,
  third   [3]  NamedDay,
  fourth  [4]  NamedDay,
  fifth   [5]  NamedDay
}

NamedDay ::= CHOICE {
  intNamedDays
    ENUMERATED {sunday(1), monday(2), tuesday(3), wednesday(4), thursday(5),
                friday(6), saturday(7)},
  bitNamedDays
    BIT STRING {sunday(0), monday(1), tuesday(2), wednesday(3), thursday(4),
                friday(5), saturday(6)}
}

DayTimeBand ::= SEQUENCE {
  startDayTime  [0]  DayTime DEFAULT {hour 0},
  endDayTime    [1]  DayTime DEFAULT {hour 23, minute 59, second 59}
}

DayTime ::= SEQUENCE {
  hour    [0]  INTEGER(0..23),
  minute  [1]  INTEGER(0..59) DEFAULT 0,
  second  [2]  INTEGER(0..59) DEFAULT 0
}

TimeZone ::= INTEGER(-12..12)



My implementation is in the following way, the places where I obtain the
error are marked with C2059

/* .h */

        typedef struct NAMEDDAY_st
        {
                int type;
                union{
                        ASN1_ENUMERATED *intNamedDays;
                        ASN1_BIT_STRING *bitNamedDays;
                }value;
        }NAMEDDAY;

        typedef struct XDAYOF_st
        {
                int type;
                union{
                        NAMEDDAY *first;
                        NAMEDDAY *second;
                        NAMEDDAY *third;
                        NAMEDDAY *fourth;
                        NAMEDDAY *fifth;
                }value;
        }XDAYOF;

        typedef struct DAYTIME_st
        {
                ASN1_INTEGER *hour;
                ASN1_INTEGER *minute;
                ASN1_INTEGER *second;
        }DAYTIME;

        typedef struct DAYTIMEBAND_st
        {
                DAYTIME *startDayTime;
                DAYTIME *endDayTime;
        }DAYTIMEBAND;

        typedef struct DAYS_st
        {
                int type;
                union{
                        STACK_OF(ASN1_INTEGER) *intDay;
                        ASN1_BIT_STRING *bitDay;
                        XDAYOF *dayOf;
                }value;
        }DAYS;

        typedef struct WEEKS_st
        {
                int type;
                union{
                        ASN1_NULL *allWeeks;
                        STACK_OF(ASN1_INTEGER) *intWeek;
                        ASN1_BIT_STRING *bitWeek;
                }value;
        }WEEKS;

        typedef struct MONTHS_st
        {
                int type;
                union{
                        ASN1_NULL *allMonths;
                        STACK_OF(ASN1_INTEGER) *intMonth;
                        ASN1_BIT_STRING *bitMonth;
                }value;
        }MONTHS;

        typedef struct TIME_PERIOD_st
        {
                STACK_OF(DAYTIMEBAND) *timesOfDay;
                DAYS *days;
                WEEKS *weeks;
                MONTHS *months;
                STACK_OF(INTEGER) *years;
        }TIME_PERIOD;

        typedef struct TIME_ABSOLUTE_st
        {
                ASN1_GENERALIZEDTIME *startTime;
                ASN1_GENERALIZEDTIME *endTime;
        }TIME_ABSOLUTE;

        typedef struct TIME_st
        {
                int type ;
                union {
                        TIME_ABSOLUTE *absolute;
                        TIME_PERIOD *periodic;
                }value;
        }TIME;
        typedef struct TIME_SPECIFICATION_st
        {
                TIME *time;
                ASN1_BOOLEAN notThisTime;
                ASN1_INTEGER *timeZone;
        }TIME_SPECIFICATION;


/* .c */

        ASN1_CHOICE(NAMEDDAY) = {
                ASN1_SIMPLE(NAMEDDAY,value.intNamedDays,ASN1_ENUMERATED)
       
ASN1_SIMPLE(NAMEDDAY,value.bitNamedDays,ASN1_BIT_STRING)<--C2059
        }ASN1_CHOICE_END(NAMEDDAY)<-error C2059/warning C4034 sizeof returns
0
       
        // fatal error unable to recover from previous errors

        ASN1_CHOICE(XDAYOF) = {
                ASN1_EXP(XDAYOF,value.first,NAMEDDAY,0)
                ASN1_EXP(XDAYOF,value.second,NAMEDDAY,1)
                ASN1_EXP(XDAYOF,value.third,NAMEDDAY,2)
                ASN1_EXP(XDAYOF,value.fourth,NAMEDDAY,3)
                ASN1_EXP(XDAYOF,value.fifth,NAMEDDAY,4)
        }ASN1_CHOICE_END(XDAYOF)

        ASN1_CHOICE(MONTHS) = {
                ASN1_SIMPLE(MONTHS,value.allMonths,ASN1_NULL)
                ASN1_SET_OF(MONTHS,value.intMonths,ASN1_INTEGER)
                ASN1_SIMPLE(MONTHS,value.bitMonths,ASN1_BIT_STRING)
        }ASN1_CHOICE_END(MONTHS)

        ASN1_CHOICE(WEEKS) = {
                ASN1_SIMPLE(WEEKS,value.allWeeks,ASN1_NULL)
                ASN1_SET_OF(WEEKS,value.intWeek,ASN1_INTEGER)
                ASN1_SIMPLE(WEEKS,value.bitWeek,ASN1_BIT_STRING)
        }ASN1_CHOICE_END(WEEKS)

        ASN1_CHOICE(DAYS) = {
                ASN1_SET_OF(DAYS,value.intDay,ASN1_INTEGER)
                ASN1_SIMPLE(DAYS,value.bitDay,ASN1_BIT_STRING)
                ASN1_EXP_OPT(DAYS,value.XDayOf,XDAYOF) //XDAYOF is CHOICE
        }ASN1_CHOICE_END(DAYS)

        ASN1_SEQUENCE(TIME_PERIOD) = {
                ASN1_EXP_OPT(TIME_PERIOD,timesOfDay,DAYTIMEBAND,0) //is
CHOICE
                ASN1_EXP_OPT(TIME_PERIOD,days,DAYS,1) //is CHOICE
                ASN1_EXP_OPT(TIME_PERIOD,weeks,WEEKS,2) //is CHOICE
                ASN1_EXP_OPT(TIME_PERIOD,months,MONTHS,3) //is CHOICE
                ASN1_IMP_SET_OF_OPT(TIME_PERIOD,years,ASN1_INTEGER,4)
        }ASN1_SEQUENCE_END(TIME_PERIOD)

        ASN1_SEQUENCE(TIME_ABSOLUTE) = {
                ASN1_IMP_OPT(TIME_ABSOLUTE,startTime,ASN1_GENERALIZEDTIME,0)
                ASN1_IMP_OPT(TIME_ABSOLUTE,endTime,ANS1_GENERALIZEDTIME,1)
        }ASN1_SEQUENCE_END(TIME_ABSOLUTE)

        ASN1_CHOICE(TIME) = {
                ASN1_SIMPLE(TIME,value.absolute,TIME_ABSOLUTE)
                ASN1_SIMPLE(TIME,value.periodic,TIME_PERIOD)
        }ASN1_CHOICE_END(TIME)

        ASN1_SEQUENCE(TIME_SPECIFICATION) = {
                ASN1_EXP(TIME_SPECIFICATION,time,TIME)
                ASN1_SIMPLE(TIME_SPECIFICATION,notThisTime,ASN1_BOOLEAN)
                ASN1_OPT(TIME_SPECIFICATION,timeZone,TIMEZONE)
        }ASN1_SEQUENCE_END(TIME_SPECIFICATION)


        IMPLEMENT_ASN1_FUNCTION(TIME_ABSOLUTE)
        IMPLEMENT_ASN1_FUNCTION(TIME)
        IMPLEMENT_ASN1_FUNCTION(TIME_SPECIFICATION)
        IMPLEMENT_ASN1_DUP_FUNCTION(TIME_ABSOLUTE)
        IMPLEMENT_ASN1_DUP_FUNCTION(TIME)
        IMPLEMENT_ASN1_DUP_FUNCTION(TIME_SPECIFICATION)

--
Daniel Diaz Sanchez
Telecommunication Engineer
Researcher / Teaching Assistant
 
Dep. Ing. Telemática
Universidad Carlos III de Madrid
Av. Universidad, 30
28911 Leganés (Madrid/Spain)
Tel: (+34) 91-624-8817, Fax: -8749

Web: www.it.uc3m.es/dds
web: http://www.it.uc3m.es/pervasive
A toolkit for attribute certificates:
http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml

Mail: dds[at].it.uc3m.es
Skype: dds.it.uc3m.es


-$  -----Mensaje original-----
-$  De: [hidden email] [mailto:owner-openssl-
-$  [hidden email]] En nombre de Peter Sylvester
-$  Enviado el: martes, 17 de octubre de 2006 12:40
-$  Para: [hidden email]
-$  Asunto: Re: Compiler error ASN1
-$  
-$  Daniel Diaz Sanchez wrote:
-$  > Hello to everybody,
-$  > I have a problem when implementing a simple structure using
-$  OpenSSL
-$  > Asn1. This is the problem:
-$  >
-$  > When I try to implement this data structure:
-$  >
-$  > A ::= SEQUENCE {
-$  > b
-$  > CHOICE {
-$  > b1 INTEGER,
-$  >                      b2 INTEGER},
-$  >
-$  The previous is ambiguous. use for example b2 [0] INTEGER
-$  Also, the given syntax does not say whether you are in global
-$  environment of EXPLICIT or IMPLICIT tagging. It seems
-$  that you assume IMPLICIT
-$  
-$  
-$  > a1 BOOLEAN,
-$  > a2 INTEGER OPTIONAL,
-$  > a3 [0] INTEGER OPTIONAL,
-$  > a4 [1] INTEGER
-$  > }
-$  >
-$  > I do it in the following way:
-$  >
-$  > /* .h */
-$  > typedef struct B_st
-$  > {
-$  > int type ;
-$  > union {
-$  > ASN1_INTEGER *b1;
-$  > ASN1_INTEGER *b2;
-$  > }value;
-$  > }B;
-$  >
-$  > typedef struct A_st
-$  > {
-$  > B *b;
-$  > ASN1_BOOLEAN *a1;
-$  > ASN1_INTEGER *a2;
-$  > ASN1_INTEGER *a3;
-$  > ASN1_INTEGER *a4;
-$  > }A;
-$  >
-$  > DECLARE_ASN1_ITEM(B)
-$  > DECLARE_ASN1_ITEM(A)
-$  > DECLARE_ASN1_FUNCTIONS(B)
-$  > DECLARE_ASN1_FUNCTIONS(A)
-$  >
-$  > /* .c */
-$  >
-$  > ASN1_CHOICE(B) = {
-$  > ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
-$  >
-$  missing ,
-$  > ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
-$  >
-$  missing }
-$  
-$  ASN1_IMP(A,value.b2,ASN1_INTEGER,0)
-$  
-$  
-$  > }ASN1_CHOICE_END(B) //(*2)
-$  >
-$  > ASN1_SEQUENCE(A) = {
-$  > ASN1_EXP(A,b,B) //choice
-$  >
-$  ,
-$  > ASN1_SIMPLE(A,a1,ASN1_BOOLEAN)
-$  >
-$  ,
-$  > ASN1_OPT(A,a2,ASN1_INTEGER)
-$  >
-$  ,
-$  > ASN1_IMP_OPT(A,a3,ASN1_INTEGER,0)
-$  >
-$  ,
-$  > ASN1_IMP(A,a4,ASN1_INTEGER,1)
-$  > }ASN1_SEQUENCE_END(A)
-$  >
-$  > IMPLEMENT_ASN1_FUNCTION(A)
-$  >
-$  > But I obtain (using Visual Studio)
-$  >
-$  > error C2059: syntax error : '{' at line (*1) and
-$  > error C2059: syntax error : '{' at line (*2)
-$  >
-$  > I'm doing it ok or there is something missing?.
-$  >
-$  > Thanks!,
-$  >
-$  > Regards,
-$  >
-$  > --
-$  > Daniel Diaz Sanchez
-$  > Telecommunication Engineer
-$  > Researcher / Teaching Assistant
-$  >
-$  > Dep. Ing. Telemática
-$  > Universidad Carlos III de Madrid
-$  > Av. Universidad, 30
-$  > 28911 Leganés (Madrid/Spain)
-$  > Tel: (+34) 91-624-8817, Fax: -8749
-$  >
-$  > Web: www.it.uc3m.es/dds
-$  > web: http://www.it.uc3m.es/pervasive
-$  > A toolkit for attribute certificates:
-$  > http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml
-$  >
-$  > Mail: dds[at].it.uc3m.es
-$  > Skype: dds.it.uc3m.es
-$  >
-$  >
-$  >
-$  > ______________________________________________________________________
-$  > OpenSSL Project                                 http://www.openssl.org
-$  > User Support Mailing List                    [hidden email]
-$  > Automated List Manager                           [hidden email]
-$  >
-$  >
-$  >
-$  >
-$  
-$  
-$  --
-$  To verify the signature, see http://edelpki.edelweb.fr/
-$  Cela vous permet de charger le certificat de l'autorité;
-$  die Liste mit zurückgerufenen Zertifikaten finden Sie da auch.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: Compiler error ASN1

Daniel Diaz Sanchez-2
I'm sorry, I have noticed some errors. I will check them.

--
Daniel Diaz Sanchez
Telecommunication Engineer
Researcher / Teaching Assistant
 
Dep. Ing. Telemática
Universidad Carlos III de Madrid
Av. Universidad, 30
28911 Leganés (Madrid/Spain)
Tel: (+34) 91-624-8817, Fax: -8749

Web: www.it.uc3m.es/dds
web: http://www.it.uc3m.es/pervasive
A toolkit for attribute certificates:
http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml

Mail: dds[at].it.uc3m.es
Skype: dds.it.uc3m.es


-$  -----Mensaje original-----
-$  De: [hidden email] [mailto:owner-openssl-
-$  [hidden email]] En nombre de Daniel Diaz Sanchez
-$  Enviado el: martes, 17 de octubre de 2006 13:03
-$  Para: [hidden email]
-$  Asunto: RE: Compiler error ASN1
-$  
-$  Thanks for your reply,
-$  
-$  I'm in an implicit TAGS environment:
-$  
-$  AttributeCertificateDefinitions {joint-iso-itu-t ds(5) module(1)
-$    attributeCertificateDefinitions(32) 5} DEFINITIONS IMPLICIT TAGS ::=
-$  BEGIN
-$  
-$  What I really want to implement is this extension, but I obtain an error
-$  in
-$  the first asn1 structure, have a look to the implementation
-$  
-$  error C2059: syntax error : '}'
-$  
-$  timeSpecification EXTENSION ::= {
-$    SYNTAX         TimeSpecification
-$    IDENTIFIED BY  id-ce-timeSpecification
-$  }
-$  
-$  TimeSpecification ::= SEQUENCE {
-$    time
-$      CHOICE {absolute
-$                SEQUENCE {startTime  [0]  GeneralizedTime OPTIONAL,
-$                          endTime    [1]  GeneralizedTime OPTIONAL},
-$              periodic  SET OF Period},
-$    notThisTime  BOOLEAN DEFAULT FALSE,
-$    timeZone     TimeZone OPTIONAL
-$  }
-$  
-$  Period ::= SEQUENCE {
-$    timesOfDay  [0]  SET SIZE (1..MAX) OF DayTimeBand OPTIONAL,
-$    days
-$      [1]  CHOICE {intDay  SET OF INTEGER,
-$                   bitDay
-$                     BIT STRING {sunday(0), monday(1), tuesday(2),
-$  wednesday(3),
-$                                 thursday(4), friday(5), saturday(6)},
-$                   dayOf   XDayOf} OPTIONAL,
-$    weeks
-$      [2]  CHOICE {allWeeks  NULL,
-$                   intWeek   SET OF INTEGER,
-$                   bitWeek
-$                     BIT STRING {week1(0), week2(1), week3(2), week4(3),
-$  week5(4)}
-$    } OPTIONAL,
-$    months
-$      [3]  CHOICE {allMonths  NULL,
-$                   intMonth   SET OF INTEGER,
-$                   bitMonth
-$                     BIT STRING {january(0), february(1), march(2),
-$  april(3),
-$                                 may(4), june(5), july(6), august(7),
-$                                 september(8), october(9), november(10),
-$                                 december(11)}} OPTIONAL,
-$    years       [4]  SET OF INTEGER(1000..MAX) OPTIONAL
-$  }
-$  
-$  XDayOf ::= CHOICE {
-$    first   [1]  NamedDay,
-$    second  [2]  NamedDay,
-$    third   [3]  NamedDay,
-$    fourth  [4]  NamedDay,
-$    fifth   [5]  NamedDay
-$  }
-$  
-$  NamedDay ::= CHOICE {
-$    intNamedDays
-$      ENUMERATED {sunday(1), monday(2), tuesday(3), wednesday(4),
-$  thursday(5),
-$                  friday(6), saturday(7)},
-$    bitNamedDays
-$      BIT STRING {sunday(0), monday(1), tuesday(2), wednesday(3),
-$  thursday(4),
-$                  friday(5), saturday(6)}
-$  }
-$  
-$  DayTimeBand ::= SEQUENCE {
-$    startDayTime  [0]  DayTime DEFAULT {hour 0},
-$    endDayTime    [1]  DayTime DEFAULT {hour 23, minute 59, second 59}
-$  }
-$  
-$  DayTime ::= SEQUENCE {
-$    hour    [0]  INTEGER(0..23),
-$    minute  [1]  INTEGER(0..59) DEFAULT 0,
-$    second  [2]  INTEGER(0..59) DEFAULT 0
-$  }
-$  
-$  TimeZone ::= INTEGER(-12..12)
-$  
-$  
-$  
-$  My implementation is in the following way, the places where I obtain the
-$  error are marked with C2059
-$  
-$  /* .h */
-$  
-$   typedef struct NAMEDDAY_st
-$   {
-$   int type;
-$   union{
-$   ASN1_ENUMERATED *intNamedDays;
-$   ASN1_BIT_STRING *bitNamedDays;
-$   }value;
-$   }NAMEDDAY;
-$  
-$   typedef struct XDAYOF_st
-$   {
-$   int type;
-$   union{
-$   NAMEDDAY *first;
-$   NAMEDDAY *second;
-$   NAMEDDAY *third;
-$   NAMEDDAY *fourth;
-$   NAMEDDAY *fifth;
-$   }value;
-$   }XDAYOF;
-$  
-$   typedef struct DAYTIME_st
-$   {
-$   ASN1_INTEGER *hour;
-$   ASN1_INTEGER *minute;
-$   ASN1_INTEGER *second;
-$   }DAYTIME;
-$  
-$   typedef struct DAYTIMEBAND_st
-$   {
-$   DAYTIME *startDayTime;
-$   DAYTIME *endDayTime;
-$   }DAYTIMEBAND;
-$  
-$   typedef struct DAYS_st
-$   {
-$   int type;
-$   union{
-$   STACK_OF(ASN1_INTEGER) *intDay;
-$   ASN1_BIT_STRING *bitDay;
-$   XDAYOF *dayOf;
-$   }value;
-$   }DAYS;
-$  
-$   typedef struct WEEKS_st
-$   {
-$   int type;
-$   union{
-$   ASN1_NULL *allWeeks;
-$   STACK_OF(ASN1_INTEGER) *intWeek;
-$   ASN1_BIT_STRING *bitWeek;
-$   }value;
-$   }WEEKS;
-$  
-$   typedef struct MONTHS_st
-$   {
-$   int type;
-$   union{
-$   ASN1_NULL *allMonths;
-$   STACK_OF(ASN1_INTEGER) *intMonth;
-$   ASN1_BIT_STRING *bitMonth;
-$   }value;
-$   }MONTHS;
-$  
-$   typedef struct TIME_PERIOD_st
-$   {
-$   STACK_OF(DAYTIMEBAND) *timesOfDay;
-$   DAYS *days;
-$   WEEKS *weeks;
-$   MONTHS *months;
-$   STACK_OF(INTEGER) *years;
-$   }TIME_PERIOD;
-$  
-$   typedef struct TIME_ABSOLUTE_st
-$   {
-$   ASN1_GENERALIZEDTIME *startTime;
-$   ASN1_GENERALIZEDTIME *endTime;
-$   }TIME_ABSOLUTE;
-$  
-$   typedef struct TIME_st
-$   {
-$   int type ;
-$   union {
-$   TIME_ABSOLUTE *absolute;
-$   TIME_PERIOD *periodic;
-$   }value;
-$   }TIME;
-$   typedef struct TIME_SPECIFICATION_st
-$   {
-$   TIME *time;
-$   ASN1_BOOLEAN notThisTime;
-$   ASN1_INTEGER *timeZone;
-$   }TIME_SPECIFICATION;
-$  
-$  
-$  /* .c */
-$  
-$   ASN1_CHOICE(NAMEDDAY) = {
-$   ASN1_SIMPLE(NAMEDDAY,value.intNamedDays,ASN1_ENUMERATED)
-$  
-$  ASN1_SIMPLE(NAMEDDAY,value.bitNamedDays,ASN1_BIT_STRING)<--C2059
-$   }ASN1_CHOICE_END(NAMEDDAY)<-error C2059/warning C4034 sizeof
-$  returns
-$  0
-$  
-$   // fatal error unable to recover from previous errors
-$  
-$   ASN1_CHOICE(XDAYOF) = {
-$   ASN1_EXP(XDAYOF,value.first,NAMEDDAY,0)
-$   ASN1_EXP(XDAYOF,value.second,NAMEDDAY,1)
-$   ASN1_EXP(XDAYOF,value.third,NAMEDDAY,2)
-$   ASN1_EXP(XDAYOF,value.fourth,NAMEDDAY,3)
-$   ASN1_EXP(XDAYOF,value.fifth,NAMEDDAY,4)
-$   }ASN1_CHOICE_END(XDAYOF)
-$  
-$   ASN1_CHOICE(MONTHS) = {
-$   ASN1_SIMPLE(MONTHS,value.allMonths,ASN1_NULL)
-$   ASN1_SET_OF(MONTHS,value.intMonths,ASN1_INTEGER)
-$   ASN1_SIMPLE(MONTHS,value.bitMonths,ASN1_BIT_STRING)
-$   }ASN1_CHOICE_END(MONTHS)
-$  
-$   ASN1_CHOICE(WEEKS) = {
-$   ASN1_SIMPLE(WEEKS,value.allWeeks,ASN1_NULL)
-$   ASN1_SET_OF(WEEKS,value.intWeek,ASN1_INTEGER)
-$   ASN1_SIMPLE(WEEKS,value.bitWeek,ASN1_BIT_STRING)
-$   }ASN1_CHOICE_END(WEEKS)
-$  
-$   ASN1_CHOICE(DAYS) = {
-$   ASN1_SET_OF(DAYS,value.intDay,ASN1_INTEGER)
-$   ASN1_SIMPLE(DAYS,value.bitDay,ASN1_BIT_STRING)
-$   ASN1_EXP_OPT(DAYS,value.XDayOf,XDAYOF) //XDAYOF is CHOICE
-$   }ASN1_CHOICE_END(DAYS)
-$  
-$   ASN1_SEQUENCE(TIME_PERIOD) = {
-$   ASN1_EXP_OPT(TIME_PERIOD,timesOfDay,DAYTIMEBAND,0) //is
-$  CHOICE
-$   ASN1_EXP_OPT(TIME_PERIOD,days,DAYS,1) //is CHOICE
-$   ASN1_EXP_OPT(TIME_PERIOD,weeks,WEEKS,2) //is CHOICE
-$   ASN1_EXP_OPT(TIME_PERIOD,months,MONTHS,3) //is CHOICE
-$   ASN1_IMP_SET_OF_OPT(TIME_PERIOD,years,ASN1_INTEGER,4)
-$   }ASN1_SEQUENCE_END(TIME_PERIOD)
-$  
-$   ASN1_SEQUENCE(TIME_ABSOLUTE) = {
-$   ASN1_IMP_OPT(TIME_ABSOLUTE,startTime,ASN1_GENERALIZEDTIME,0)
-$   ASN1_IMP_OPT(TIME_ABSOLUTE,endTime,ANS1_GENERALIZEDTIME,1)
-$   }ASN1_SEQUENCE_END(TIME_ABSOLUTE)
-$  
-$   ASN1_CHOICE(TIME) = {
-$   ASN1_SIMPLE(TIME,value.absolute,TIME_ABSOLUTE)
-$   ASN1_SIMPLE(TIME,value.periodic,TIME_PERIOD)
-$   }ASN1_CHOICE_END(TIME)
-$  
-$   ASN1_SEQUENCE(TIME_SPECIFICATION) = {
-$   ASN1_EXP(TIME_SPECIFICATION,time,TIME)
-$   ASN1_SIMPLE(TIME_SPECIFICATION,notThisTime,ASN1_BOOLEAN)
-$   ASN1_OPT(TIME_SPECIFICATION,timeZone,TIMEZONE)
-$   }ASN1_SEQUENCE_END(TIME_SPECIFICATION)
-$  
-$  
-$   IMPLEMENT_ASN1_FUNCTION(TIME_ABSOLUTE)
-$   IMPLEMENT_ASN1_FUNCTION(TIME)
-$   IMPLEMENT_ASN1_FUNCTION(TIME_SPECIFICATION)
-$   IMPLEMENT_ASN1_DUP_FUNCTION(TIME_ABSOLUTE)
-$   IMPLEMENT_ASN1_DUP_FUNCTION(TIME)
-$   IMPLEMENT_ASN1_DUP_FUNCTION(TIME_SPECIFICATION)
-$  
-$  --
-$  Daniel Diaz Sanchez
-$  Telecommunication Engineer
-$  Researcher / Teaching Assistant
-$  
-$  Dep. Ing. Telemática
-$  Universidad Carlos III de Madrid
-$  Av. Universidad, 30
-$  28911 Leganés (Madrid/Spain)
-$  Tel: (+34) 91-624-8817, Fax: -8749
-$  
-$  Web: www.it.uc3m.es/dds
-$  web: http://www.it.uc3m.es/pervasive
-$  A toolkit for attribute certificates:
-$  http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml
-$  
-$  Mail: dds[at].it.uc3m.es
-$  Skype: dds.it.uc3m.es
-$  
-$  
-$  -$  -----Mensaje original-----
-$  -$  De: [hidden email] [mailto:owner-openssl-
-$  -$  [hidden email]] En nombre de Peter Sylvester
-$  -$  Enviado el: martes, 17 de octubre de 2006 12:40
-$  -$  Para: [hidden email]
-$  -$  Asunto: Re: Compiler error ASN1
-$  -$
-$  -$  Daniel Diaz Sanchez wrote:
-$  -$  > Hello to everybody,
-$  -$  > I have a problem when implementing a simple structure using
-$  -$  OpenSSL
-$  -$  > Asn1. This is the problem:
-$  -$  >
-$  -$  > When I try to implement this data structure:
-$  -$  >
-$  -$  > A ::= SEQUENCE {
-$  -$  > b
-$  -$  > CHOICE {
-$  -$  > b1 INTEGER,
-$  -$  >                      b2 INTEGER},
-$  -$  >
-$  -$  The previous is ambiguous. use for example b2 [0] INTEGER
-$  -$  Also, the given syntax does not say whether you are in global
-$  -$  environment of EXPLICIT or IMPLICIT tagging. It seems
-$  -$  that you assume IMPLICIT
-$  -$
-$  -$
-$  -$  > a1 BOOLEAN,
-$  -$  > a2 INTEGER OPTIONAL,
-$  -$  > a3 [0] INTEGER OPTIONAL,
-$  -$  > a4 [1] INTEGER
-$  -$  > }
-$  -$  >
-$  -$  > I do it in the following way:
-$  -$  >
-$  -$  > /* .h */
-$  -$  > typedef struct B_st
-$  -$  > {
-$  -$  > int type ;
-$  -$  > union {
-$  -$  > ASN1_INTEGER *b1;
-$  -$  > ASN1_INTEGER *b2;
-$  -$  > }value;
-$  -$  > }B;
-$  -$  >
-$  -$  > typedef struct A_st
-$  -$  > {
-$  -$  > B *b;
-$  -$  > ASN1_BOOLEAN *a1;
-$  -$  > ASN1_INTEGER *a2;
-$  -$  > ASN1_INTEGER *a3;
-$  -$  > ASN1_INTEGER *a4;
-$  -$  > }A;
-$  -$  >
-$  -$  > DECLARE_ASN1_ITEM(B)
-$  -$  > DECLARE_ASN1_ITEM(A)
-$  -$  > DECLARE_ASN1_FUNCTIONS(B)
-$  -$  > DECLARE_ASN1_FUNCTIONS(A)
-$  -$  >
-$  -$  > /* .c */
-$  -$  >
-$  -$  > ASN1_CHOICE(B) = {
-$  -$  > ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
-$  -$  >
-$  -$  missing ,
-$  -$  > ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
-$  -$  >
-$  -$  missing }
-$  -$
-$  -$  ASN1_IMP(A,value.b2,ASN1_INTEGER,0)
-$  -$
-$  -$
-$  -$  > }ASN1_CHOICE_END(B) //(*2)
-$  -$  >
-$  -$  > ASN1_SEQUENCE(A) = {
-$  -$  > ASN1_EXP(A,b,B) //choice
-$  -$  >
-$  -$  ,
-$  -$  > ASN1_SIMPLE(A,a1,ASN1_BOOLEAN)
-$  -$  >
-$  -$  ,
-$  -$  > ASN1_OPT(A,a2,ASN1_INTEGER)
-$  -$  >
-$  -$  ,
-$  -$  > ASN1_IMP_OPT(A,a3,ASN1_INTEGER,0)
-$  -$  >
-$  -$  ,
-$  -$  > ASN1_IMP(A,a4,ASN1_INTEGER,1)
-$  -$  > }ASN1_SEQUENCE_END(A)
-$  -$  >
-$  -$  > IMPLEMENT_ASN1_FUNCTION(A)
-$  -$  >
-$  -$  > But I obtain (using Visual Studio)
-$  -$  >
-$  -$  > error C2059: syntax error : '{' at line (*1) and
-$  -$  > error C2059: syntax error : '{' at line (*2)
-$  -$  >
-$  -$  > I'm doing it ok or there is something missing?.
-$  -$  >
-$  -$  > Thanks!,
-$  -$  >
-$  -$  > Regards,
-$  -$  >
-$  -$  > --
-$  -$  > Daniel Diaz Sanchez
-$  -$  > Telecommunication Engineer
-$  -$  > Researcher / Teaching Assistant
-$  -$  >
-$  -$  > Dep. Ing. Telemática
-$  -$  > Universidad Carlos III de Madrid
-$  -$  > Av. Universidad, 30
-$  -$  > 28911 Leganés (Madrid/Spain)
-$  -$  > Tel: (+34) 91-624-8817, Fax: -8749
-$  -$  >
-$  -$  > Web: www.it.uc3m.es/dds
-$  -$  > web: http://www.it.uc3m.es/pervasive
-$  -$  > A toolkit for attribute certificates:
-$  -$  > http://www.it.uc3m.es/dds/swRelease/pmi/pmi.xml
-$  -$  >
-$  -$  > Mail: dds[at].it.uc3m.es
-$  -$  > Skype: dds.it.uc3m.es
-$  -$  >
-$  -$  >
-$  -$  >
-$  -$  >
-$  ______________________________________________________________________
-$  -$  > OpenSSL Project
-$  http://www.openssl.org
-$  -$  > User Support Mailing List                    openssl-
-$  [hidden email]
-$  -$  > Automated List Manager
-$  [hidden email]
-$  -$  >
-$  -$  >
-$  -$  >
-$  -$  >
-$  -$
-$  -$
-$  -$  --
-$  -$  To verify the signature, see http://edelpki.edelweb.fr/
-$  -$  Cela vous permet de charger le certificat de l'autorité;
-$  -$  die Liste mit zurückgerufenen Zertifikaten finden Sie da auch.
-$  
-$  
-$  ______________________________________________________________________
-$  OpenSSL Project                                 http://www.openssl.org
-$  User Support Mailing List                    [hidden email]
-$  Automated List Manager                           [hidden email]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]