Robert Eiglmaier wrote:
> 
> Hi, developers!
> 
> While trying to understand the ASN.1 stuff I wrote the following lines:
> 
>         ASN1_INTEGER * pInt, * qInt;
>         unsigned char buf[1024], *cPtr;
>         int l, p, q;
> 
>         p = -2;
>         pInt = ASN1_INTEGER_new();
>         ASN1_INTEGER_set(pInt, p);
>         cPtr = buf;
>         i2d_ASN1_INTEGER(pInt, &cPtr);  // DER encode p
>         l = (cPtr - buf);
>         cPtr = buf;
>         qInt = d2i_ASN1_INTEGER(NULL, &cPtr, l);        // DER decode q
>         q = ASN1_INTEGER_get(qInt);
> 
>         printf("p = %d  q = %d\n", p, q);
> 
> why is q = -32770 ???? and not -2 ?
> 

Ouch! Negative ASN1 INTEGERs are pretty rare so this mustn't have been
checked too closely.

Anyway the problem seems to be that the ASN1 negative INTEGER encoding
stuff is completely broken. I'll look into it...

Thanks for the report.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to