> 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
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]