logo       

libopensc asn1 boolean handling: msg#00241

encryption.opensc.devel

Subject: libopensc asn1 boolean handling

Hello list,

There seems to be a problem with handling / encoding / decoding
values in libopensc that are stored as ASN1 boolean type.
The higher level code represents these boolean values as integer
values (0/1). However the encoding/decoding functions assume an
u8 (unsigned char) type.

For instance the authority boolean pkcs15-cert.c:

if (infop->authority)
sc_format_asn1_entry(asn1_com_cert_attr + 1, (void *)
&infop->authority, NULL, 1);

This will most likely cause problems on non little-endian systems.
For testing purposes I replaced these constructs with something
like which is a crude fix:
if (infop->authority) {
u8 authority=infop->authority;
sc_format_asn1_entry(asn1_com_cert_attr + 1, (void *)
&authority, NULL, 1);
}
However, it would probably be better to use the u8 type to store
the boolean values for the authority/native attributes, wouldn't it?

WIlliam.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise