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=20
CHOICE {=09
b1 INTEGER,
b2 INTEGER},
a1 BOOLEAN,
a2 INTEGER OPTIONAL,
a3 [0] INTEGER OPTIONAL,
a4 [1] INTEGER
}
=20
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 */
=09
ASN1_CHOICE(B) =3D {
ASN1_SIMPLE(B,value.b1,ASN1_INTEGER)
ASN1_SIMPLE(B,value.b2,ASN1_INTEGER) //(*1)
}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=20
error C2059: syntax error : '{' at line (*2)

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

Thanks!,

Regards,
=09
--
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



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