[Pardon if this has been raised before -- I'm new to the list.]

This is a question regarding the correct ASN.1 encoding for bitstrings.

#define ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)

This does not set the a->flags parameter as (for instance) ASN1_sign does:

        signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
        signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;

Hence, a subsequent call to i2d_ASN1_BIT_STRING to encode the bitstring can
lose
the last N bytes, if those bytes happen to be all zeroes.

In a perfect world, shouldn't ASN1_BIT_STRING_set have a fourth parameter to
hold
the number-of-padding-bits value?  Or am I not grokking the programming
model here?

Kathy Wienhold
CertCo
[EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to