logo       

Re: libopensc asn1 boolean handling: msg#00280

encryption.opensc.devel

Subject: Re: libopensc asn1 boolean handling

On Wed, Mar 30, 2005 at 07:39:24PM +0200, Nils Larsch wrote:
> William Wanders wrote:
> >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?
>
> I've changed the asn.1 code to use integers instead of u8, a little
> bit more type safety would have been nice here ...
> Please test a new snapshot.
I just updated my checked out subversion trunk of opensc and
tested it on a Solaris Sparc based system and everything seems
to work ok.

William.


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

News | FAQ | advertise