Jiri Holinek wrote:
>
> /* need allocate two many size of buffer */
> org_pointer_buf = pvk_buf;
> pvk_len = i2d_RSAPrivateKey(rsa, &pvk_buf);
>
> /* here is the pvk_buf pointer shifted about pvk_len bytes far from
> original position stored in org_pointer_buf (WHY??)
> */
>
This crops up quite often. I'll add it to the FAQ soon.
Basically the OpenSSL library usually outputs several ASN1 structures in
a row. As a result the pointer is updated by each call ready to output
the next one. This has the side effect that if you don't know this you
get the problem you experienced.
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]