Re: d2i and ASN1_CHOICE
I found the error. At the end, the problem was a bad definition of Sub_seq100. I have fixed it and ASN1_CHOICE works fine now. Thanks to all. Regards. Fernando Moya Bernal. University of Malaga. Spain. Hi, I am having problems with CHOICE in the following ASN.1 sequence: - DEFINITIONS IMPLICIT TAGS Sub_seq200 ::= SEQUENCE { sub_field1 Sub_seq100 OPTIONAL, sub_field2 [0] Sub_seq400 OPTIONAL } Seq1 ::= CHOICE { field1 Sub_seq100, field2 [0] Sub_seq200 } - Implemented by: typedef struct Sub_seq200_st { Sub_seq100 *sub_field1; Sub_seq200 *sub_field2; }Sub_seq200; typedef struct Seq1_st { int type; union { char *ptr; Sub_seq100 *field1; Sub_seq200 *field2; }value; }Seq1; ASN1_SEQUENCE(Sub_seq200) = { ASN1_OPT(Sub_seq200,sub_field1, Sub_seq100), ASN1_IMP_OPT(Sub_seq200,sub_field2, Sub_seq400,0), } ASN1_SEQUENCE_END(Sub_seq200) IMPLEMENT_ASN1_FUNCTIONS(Sub_seq200) ASN1_CHOICE(Seq1) = { ASN1_SIMPLE(Seq1, value.field1,Sub_seq100), ASN1_IMP(Seq1, value.field2,Sub_seq200, 0) } ASN1_CHOICE_END(Seq1) IMPLEMENT_ASN1_FUNCTIONS(Seq1) Well, Seq1_new, Seq1_free and i2d_Seq1 functions work correctly and DER output is right, but when I call d2i_Seq1 with DER output from i2d_Seq1, it returns NULL. I think it could be an incorrect definition of ASN1_CHOICE(Seq1). Does Anybody know what is wrong? See what error message you get with ERR_print_errors_fp(srderr); Steve. -- Dr Stephen N. Henson. Core developer of the OpenSSL project: http://www.openssl.org/ Freelance consultant see: http://www.drh-consultancy.demon.co.uk/ Email: [EMAIL PROTECTED], PGP key: via homepage. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
d2i and ASN1_CHOICE
Hi, I am having problems with CHOICE in the following ASN.1 sequence: - DEFINITIONS IMPLICIT TAGS Sub_seq200 ::= SEQUENCE { sub_field1 Sub_seq100 OPTIONAL, sub_field2 [0] Sub_seq400 OPTIONAL } Seq1 ::= CHOICE { field1 Sub_seq100, field2 [0] Sub_seq200 } - Implemented by: typedef struct Sub_seq200_st { Sub_seq100 *sub_field1; Sub_seq200 *sub_field2; }Sub_seq200; typedef struct Seq1_st { int type; union { char *ptr; Sub_seq100 *field1; Sub_seq200 *field2; }value; }Seq1; ASN1_SEQUENCE(Sub_seq200) = { ASN1_OPT(Sub_seq200,sub_field1, Sub_seq100), ASN1_IMP_OPT(Sub_seq200,sub_field2, Sub_seq400,0), } ASN1_SEQUENCE_END(Sub_seq200) IMPLEMENT_ASN1_FUNCTIONS(Sub_seq200) ASN1_CHOICE(Seq1) = { ASN1_SIMPLE(Seq1, value.field1,Sub_seq100), ASN1_IMP(Seq1, value.field2,Sub_seq200, 0) } ASN1_CHOICE_END(Seq1) IMPLEMENT_ASN1_FUNCTIONS(Seq1) Well, Seq1_new, Seq1_free and i2d_Seq1 functions work correctly and DER output is right, but when I call d2i_Seq1 with DER output from i2d_Seq1, it returns NULL. I think it could be an incorrect definition of ASN1_CHOICE(Seq1). Does Anybody know what is wrong? Thanks in advance. Fernando Moya Bernal. University of Malaga. Spain. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: d2i and ASN1_CHOICE
Fernando, I think all user-defined tags in a CHOICE (e.g., [0]) are EXPLICIT -- I could be wrong and don't have time to check right now (it's been a while ...). So I think you want: ASN1_EXP(Seq1, value.field2,Sub_seq200, 0) Frank Fernando Moya [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Sent by: Subject: d2i and ASN1_CHOICE owner-openssl-dev@ openssl.org 06/26/2003 04:55 AM Please respond to openssl-dev Hi, I am having problems with CHOICE in the following ASN.1 sequence: - DEFINITIONS IMPLICIT TAGS Sub_seq200 ::= SEQUENCE { sub_field1 Sub_seq100 OPTIONAL, sub_field2 [0] Sub_seq400 OPTIONAL } Seq1 ::= CHOICE { field1 Sub_seq100, field2 [0] Sub_seq200 } - Implemented by: typedef struct Sub_seq200_st { Sub_seq100 *sub_field1; Sub_seq200 *sub_field2; }Sub_seq200; typedef struct Seq1_st { int type; union { char *ptr; Sub_seq100 *field1; Sub_seq200 *field2; }value; }Seq1; ASN1_SEQUENCE(Sub_seq200) = { ASN1_OPT(Sub_seq200,sub_field1, Sub_seq100), ASN1_IMP_OPT(Sub_seq200,sub_field2, Sub_seq400,0), } ASN1_SEQUENCE_END(Sub_seq200) IMPLEMENT_ASN1_FUNCTIONS(Sub_seq200) ASN1_CHOICE(Seq1) = { ASN1_SIMPLE(Seq1, value.field1,Sub_seq100), ASN1_IMP(Seq1, value.field2,Sub_seq200, 0) } ASN1_CHOICE_END(Seq1) IMPLEMENT_ASN1_FUNCTIONS(Seq1) Well, Seq1_new, Seq1_free and i2d_Seq1 functions work correctly and DER output is right, but when I call d2i_Seq1 with DER output from i2d_Seq1, it returns NULL. I think it could be an incorrect definition of ASN1_CHOICE(Seq1). Does Anybody know what is wrong? Thanks in advance. Fernando Moya Bernal. University of Malaga. Spain. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: d2i and ASN1_CHOICE
On Thu, Jun 26, 2003, Fernando Moya wrote: Hi, I am having problems with CHOICE in the following ASN.1 sequence: - DEFINITIONS IMPLICIT TAGS Sub_seq200 ::= SEQUENCE { sub_field1 Sub_seq100 OPTIONAL, sub_field2 [0] Sub_seq400 OPTIONAL } Seq1 ::= CHOICE { field1 Sub_seq100, field2 [0] Sub_seq200 } - Implemented by: typedef struct Sub_seq200_st { Sub_seq100 *sub_field1; Sub_seq200 *sub_field2; }Sub_seq200; typedef struct Seq1_st { int type; union { char *ptr; Sub_seq100 *field1; Sub_seq200 *field2; }value; }Seq1; ASN1_SEQUENCE(Sub_seq200) = { ASN1_OPT(Sub_seq200,sub_field1, Sub_seq100), ASN1_IMP_OPT(Sub_seq200,sub_field2, Sub_seq400,0), } ASN1_SEQUENCE_END(Sub_seq200) IMPLEMENT_ASN1_FUNCTIONS(Sub_seq200) ASN1_CHOICE(Seq1) = { ASN1_SIMPLE(Seq1, value.field1,Sub_seq100), ASN1_IMP(Seq1, value.field2,Sub_seq200, 0) } ASN1_CHOICE_END(Seq1) IMPLEMENT_ASN1_FUNCTIONS(Seq1) Well, Seq1_new, Seq1_free and i2d_Seq1 functions work correctly and DER output is right, but when I call d2i_Seq1 with DER output from i2d_Seq1, it returns NULL. I think it could be an incorrect definition of ASN1_CHOICE(Seq1). Does Anybody know what is wrong? See what error message you get with ERR_print_errors_fp(srderr); Steve. -- Dr Stephen N. Henson. Core developer of the OpenSSL project: http://www.openssl.org/ Freelance consultant see: http://www.drh-consultancy.demon.co.uk/ Email: [EMAIL PROTECTED], PGP key: via homepage. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: d2i and ASN1_CHOICE
On Thu, Jun 26, 2003, Frank Balluffi wrote: Fernando, I think all user-defined tags in a CHOICE (e.g., [0]) are EXPLICIT -- I could be wrong and don't have time to check right now (it's been a while ...). So I think you want: ASN1_EXP(Seq1, value.field2,Sub_seq200, 0) The default is EXPLICIT but the ASN1 module can change the default to IMPLICIT. IMPLIICT also must become EXPLICIT if its needed for disambiguiation, for example if the underlying type is a CHOICE. Steve. -- Dr Stephen N. Henson. Core developer of the OpenSSL project: http://www.openssl.org/ Freelance consultant see: http://www.drh-consultancy.demon.co.uk/ Email: [EMAIL PROTECTED], PGP key: via homepage. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: d2i and ASN1_CHOICE
My bad. The following attempts to describe EXPLICIT tagging of elements of type CHOICE: FOO DEFINITIONS EXPLICIT TAGS ::= BEGIN Foo ::= SEQUENCE { foo1 [0] EXPLICIT Goo, foo2 [1] IMPLICIT Goo -- Error: foo2 must be explicitly tagged. } Goo ::= CHOICE { integer1 [0] IMPLICIT INTEGER, integer2 [1] EXPLICIT INTEGER } END Frank Dr. Stephen Henson To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: Subject: Re: d2i and ASN1_CHOICE Sent by: owner-openssl-dev@ openssl.org 06/26/2003 09:43 AM Please respond to openssl-dev On Thu, Jun 26, 2003, Frank Balluffi wrote: Fernando, I think all user-defined tags in a CHOICE (e.g., [0]) are EXPLICIT -- I could be wrong and don't have time to check right now (it's been a while ...). So I think you want: ASN1_EXP(Seq1, value.field2,Sub_seq200, 0) The default is EXPLICIT but the ASN1 module can change the default to IMPLICIT. IMPLIICT also must become EXPLICIT if its needed for disambiguiation, for example if the underlying type is a CHOICE. Steve. -- Dr Stephen N. Henson. Core developer of the OpenSSL project: http://www.openssl.org/ Freelance consultant see: http://www.drh-consultancy.demon.co.uk/ Email: [EMAIL PROTECTED], PGP key: via homepage. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]