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 ?
> 

This should be fixed in the latest snapshot. It was caused by broken
ASN1 handling of negative integers and was rather painfulto fix :-(

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