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 ::=3D
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 ::=3D {
SYNTAX TimeSpecification
IDENTIFIED BY id-ce-timeSpecification
}

TimeSpecification ::=3D 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 ::=3D 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 ::=3D CHOICE {
first [1] NamedDay,
second [2] NamedDay,
third [3] NamedDay,
fourth [4] NamedDay,
fifth [5] NamedDay
}

NamedDay ::=3D 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 ::=3D SEQUENCE {
startDayTime [0] DayTime DEFAULT {hour 0},
endDayTime [1] DayTime DEFAULT {hour 23, minute 59, second 59}
}

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

TimeZone ::=3D 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) =3D {
ASN1_SIMPLE(NAMEDDAY,value.intNamedDays,ASN1_ENUME RATED)
=09
ASN1_SIMPLE(NAMEDDAY,value.bitNamedDays,ASN1_BIT_S TRING)<--C2059
}ASN1_CHOICE_END(NAMEDDAY)<-error C2059/warning C4034 sizeof returns
0=20
=09
// fatal error unable to recover from previous errors

ASN1_CHOICE(XDAYOF) =3D {
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) =3D {
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) =3D {
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) =3D {
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) =3D {
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)=20
}ASN1_SEQUENCE_END(TIME_PERIOD)

ASN1_SEQUENCE(TIME_ABSOLUTE) =3D {
ASN1_IMP_OPT(TIME_ABSOLUTE,startTime,ASN1_GENERALI ZEDTIME,0)
ASN1_IMP_OPT(TIME_ABSOLUTE,endTime,ANS1_GENERALIZE DTIME,1)
}ASN1_SEQUENCE_END(TIME_ABSOLUTE)

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

ASN1_SEQUENCE(TIME_SPECIFICATION) =3D {
ASN1_EXP(TIME_SPECIFICATION,time,TIME)
ASN1_SIMPLE(TIME_SPECIFICATION,notThisTime,ASN1_BO OLEAN)
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
=20
Dep. Ing. Telem=E1tica
Universidad Carlos III de Madrid
Av. Universidad, 30
28911 Legan=E9s (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: owner-openssl-users@openssl.org [mailtowner-openssl-
-$ users@openssl.org] En nombre de Peter Sylvester
-$ Enviado el: martes, 17 de octubre de 2006 12:40
-$ Para: openssl-users@openssl.org
-$ Asunto: Re: Compiler error ASN1
-$ =20
-$ 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 ::=3D 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
-$ =20
-$ =20
-$ > 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) =3D {
-$ > ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
-$ >
-$ missing ,
-$ > ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
-$ >
-$ missing }
-$ =20
-$ ASN1_IMP(A,value.b2,ASN1_INTEGER,0)
-$ =20
-$ =20
-$ > }ASN1_CHOICE_END(B) //(*2)
-$ >
-$ > ASN1_SEQUENCE(A) =3D {
-$ > 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=E1tica
-$ > Universidad Carlos III de Madrid
-$ > Av. Universidad, 30
-$ > 28911 Legan=E9s (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-users@openssl.org
-$ > Automated List Manager =
majordomo@openssl.org
-$ >
-$ >
-$ >
-$ >
-$ =20
-$ =20
-$ --
-$ To verify the signature, see http://edelpki.edelweb.fr/
-$ Cela vous permet de charger le certificat de l'autorit=E9;
-$ die Liste mit zur=FCckgerufenen Zertifikaten finden Sie da auch.


__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org