On 3/22/07, Richard Salz <[EMAIL PROTECTED]> wrote:
> Ah. You're correct about BN_num_bytes. Actually, in the above code, if
> you use BN_num_bytes(bn), it will return 0 which should not be the
> case. I just hardcoded the 16 there to illustrate. I believe the bug
> might be in BN_hex2bn.

Nope, a zero has an optimized representation of no digits.  The manpage
isn't clear, but BN_bn2bin always returns the number of digits needed to
represent the number.

It is generally a mistake to ignore return values.
        /r$

--
STSM
Senior Security Architect
DataPower SOA Appliances



Oh. Okay. I thought that BN_hex2bn would create the BN representing
"0000" and then calling BN_num_bytes on that resulting BN would return
2 because that's two bytes. Thanks for the clarification!
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to