On Wed, May 29, 2002, Eugene B. Rupakov wrote: > > Hello there. > > There is a bug in ASN1_BITSTRING length calculation during packing to DER (function >i2c_ASN1_BITSTRING). > > According to ITU-T X.690, DER encoders should remove all trailing 0 bits BEFORE >encoding. > I.e. the length of the encoded bitstring should be calculated after removing such >bits. > > The original code (given NULL as *pp) calculates bitstring's length before removing >the 0 bits and puts > that length into ASN.1 length structure -- that is wrong. The bug may be seen when >you try to encode > a bitstring with 1 or more zero trailing bytes, e.g 0A4D27F000. >
Indeed, it also only copies the calculated length (without trailing zeroes) into the output buffer. It result in part of it being unitialized. I'll check in a fix, thanks for the report. Steve. -- Dr. Stephen Henson [EMAIL PROTECTED] OpenSSL Project http://www.openssl.org/~steve/ ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
